Plan 9 from Bell Labs’s /usr/web/sources/extra/art/msg.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
 * code to print in the message area and to die horrible deaths (with a message)
 */
#include "art.h"
void fatal(char *m){
	fprint(2, "fig: %s\n", m);
	exits(m);
}
#define	NPREV	512
char prevmsg[NPREV];
Image *msgboxcolor, *black;

void lastmsg(void){
	Point p;
	p=string(screen, msgbox.min, black, ZP, font, prevmsg);
	rectf(screen, Rect(p.x, msgbox.min.y, msgbox.max.x, msgbox.max.y), msgboxcolor);
}
void msg(char *fmt, ...){
	va_list arg;

	rectf(screen, Rect(msgbox.min.x, msgbox.min.y, msgbox.max.x, msgbox.max.y), msgboxcolor);
	va_start(arg, fmt);
	vseprint(prevmsg, prevmsg+sizeof(prevmsg), fmt, arg);
	va_end(arg);
	lastmsg();
}
void echo(char *m){
	Point p;
	rectf(screen, Rect(echobox.min.x, echobox.min.y, echobox.max.x, echobox.max.y), msgboxcolor);
	p=string(screen, echobox.min, black, ZP, font, m);
	rectf(screen, Rect(p.x, echobox.min.y, echobox.max.x, echobox.max.y), msgboxcolor);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].