home *** CD-ROM | disk | FTP | other *** search
- #include <fcntl.h>
- #define FONT "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1"
- #include "xdmconsole.h"
-
- int win_err(disp, errorcode)
- Display *disp;
- XErrorEvent *errorcode;
- {
- /* Some obscure old event */
- exit(0);
- }
- int naughty_win_err(disp)
- Display *disp;
- {
- /* Window not currently in existance */
- exit(0);
- }
-
- extern int screen;
- extern Display *disp;
-
- main()
- {
- char buf[128];
- int size=0;
- int inc;
- char *name, stdprint[80];
-
-
- initwin(400, 70, Place, Place, 3, Transient, "Console");
- winfont(FONT);
- inc = 15;
- wincursor(XC_gumby);
- winevents(ExposureMask);
- showwin();
- name = (char *) malloc(64);
- if (gethostname(name, 64) != -1)
- {
- strcpy(stdprint, name);
- }
- strcat(stdprint, " console.");
- winprint(2,15, stdprint);
-
- XSetErrorHandler(win_err);
- XSetIOErrorHandler(naughty_win_err);
-
-
- for(;;)
- {
- if ((size=read(0, buf, sizeof(buf))) > 0);
- {
- buf[size]='\0';
- if (inc > 59)
- {
- inc -= 15;
- scrollup(15);
- }
- inc += 15;
- winwrapprint(2, inc, buf, 15);
- buf[0]='\0';
- size=0;
- }
- }
- }
-
-