spa@hara.DEC.COM (Salvador Pinto Abreu) (08/12/87)
This is xrload, an X to{ol,y} to display the load average of the various machines on a LAN. To check it out, unshar and type "make" followed by "xrload -X". ---------------------------------------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: Makefile README back.bitmap down.bitmap xrload.1x xrload.c # Wrapped by root@mak on Tue Aug 11 00:20:05 1987 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f Makefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Makefile\" else echo shar: Extracting \"Makefile\" \(277 characters\) sed "s/^X//" >Makefile <<'END_OF_Makefile' XPROGRAM = xrload X XMAN = /usr/man/man1 XBIN = /usr/local/bin X XCFLAGS = -O X Xall: $(PROGRAM) X Xinstall: all X install xrload $(BIN) X cp xrload.1x $(MAN)/xrload.1 X chmod a=r $(MAN)/xrload.1 X Xxrload: xrload.o X cc $(CFLAGS) -o xrload xrload.o -lX -lm X Xxrload.o: back.bitmap down.bitmap END_OF_Makefile if test 277 -ne `wc -c <Makefile`; then echo shar: \"Makefile\" unpacked with wrong size! fi # end of overwriting check fi if test -f README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"README\" else echo shar: Extracting \"README\" \(590 characters\) sed "s/^X//" >README <<'END_OF_README' XThis is xrload(1), a tool that serves a function similar to that of Xxload(1) but monitors (part of) a TCP/IP network using a single Xwindow. This avoids having a bunch of xload windows, each with a local Xand a remote associated process, and all the resource waste this would Ximply. X XTo try it, just type: X % make X % xrload -X X X--- XUUCP: ...{mcvax,inria}!inesc!hara.unl.psi!spa PSI/VMS: PSI%+26805010310::SPA XARPA: lisvax.dec!unlai!spa@decwrl.dec.com Phone: + 351 1 295 31 56 X XSnail: Salvador Pinto Abreu X Dept. of Computer Science, Universidade Nova de Lisboa X 2825 Monte Caparica, Portugal END_OF_README if test 590 -ne `wc -c <README`; then echo shar: \"README\" unpacked with wrong size! fi # end of overwriting check fi if test -f back.bitmap -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"back.bitmap\" else echo shar: Extracting \"back.bitmap\" \(679 characters\) sed "s/^X//" >back.bitmap <<'END_OF_back.bitmap' X#define back_width 32 X#define back_height 32 X#define back_x_hot 16 X#define back_y_hot 15 Xstatic short back_bits[] = { X 0xffff, 0xffff, 0x1fff, 0xfff0, X 0xe3ff, 0xff8f, 0x1cff, 0xfe70, X 0x027f, 0xfc80, 0x01bf, 0xfb00, X 0x005f, 0xf400, 0x004f, 0xe400, X 0x002f, 0xe800, 0x0017, 0xd000, X 0x0017, 0xd000, 0x0017, 0xd000, X 0x000b, 0xa000, 0x000b, 0xa000, X 0x800b, 0xa003, 0x800b, 0xa003, X 0x800b, 0xa003, 0x000b, 0xa000, X 0x000b, 0xa000, 0x0017, 0xd000, X 0xc017, 0xd007, 0x2017, 0xd008, X 0xd02f, 0xe817, 0xe84f, 0xe42f, X 0xf45f, 0xf45f, 0xfbbf, 0xfbbf, X 0xfc7f, 0xfc7f, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff}; END_OF_back.bitmap if test 679 -ne `wc -c <back.bitmap`; then echo shar: \"back.bitmap\" unpacked with wrong size! fi # end of overwriting check fi if test -f down.bitmap -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"down.bitmap\" else echo shar: Extracting \"down.bitmap\" \(679 characters\) sed "s/^X//" >down.bitmap <<'END_OF_down.bitmap' X#define down_width 32 X#define down_height 32 X#define down_x_hot 16 X#define down_y_hot 15 Xstatic short down_bits[] = { X 0xffff, 0xffff, 0x1fff, 0xfff0, X 0xe3ff, 0xff8f, 0x1cff, 0xfe70, X 0x827f, 0xfc83, 0x81bf, 0xfb03, X 0x805f, 0xf403, 0x804f, 0xe403, X 0xf82f, 0xe83f, 0xf817, 0xd03f, X 0x8017, 0xd003, 0x8017, 0xd003, X 0x870b, 0xe0e2, 0x890b, 0xa123, X 0x890b, 0xa122, 0x870b, 0xa0e2, X 0x890b, 0xa022, 0xa90b, 0xa02a, X 0x890b, 0xa022, 0xc017, 0xd007, X 0xc017, 0xd007, 0x2017, 0xd008, X 0xd02f, 0xe817, 0xe84f, 0xe42f, X 0xf45f, 0xf45f, 0xfbbf, 0xfbbf, X 0xfc7f, 0xfc7f, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff}; END_OF_down.bitmap if test 679 -ne `wc -c <down.bitmap`; then echo shar: \"down.bitmap\" unpacked with wrong size! fi # end of overwriting check fi if test -f xrload.1x -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"xrload.1x\" else echo shar: Extracting \"xrload.1x\" \(4451 characters\) sed "s/^X//" >xrload.1x <<'END_OF_xrload.1x' X.TH XRLOAD 1 "10 August 1987" "X Version 10" X.SH NAME Xxrload - X window system remote load average display X.SH SYNOPSIS X.B xrload X[ option ] ... X.SH DESCRIPTION X.I xrload Xdisplays the system load average for some or all hosts on a TPC/IP network. X.I xrload Xruns under the X.I X Xwindow system. X.I xrload Xcreates a window in which the load average for each system is represented as a Xdial with two hands and possibly n tick marks. XEach tick mark represents one unit of load average. XThe name of each host is displayed below its dial. The X large hand stands for the load average during the last Xminute, and the small hand stands for the previous 5 minutes. X.PP X.I xrload Xgets its data from the output of the X.I ruptime(1) Xcommand. X.PP X.I xrload Xunderstands the following options: X.PP X.TP 8 X.B \-cols \fIcolumns\fP XSpecify the number of columns in which to display the load statistics. X.PP X.TP 8 X.B \-bw \fIpixels\fP XSpecify the width in pixels of the border around the X.I xrload Xwindow. The default value is 2 pixels. X.PP X.TP 8 X.B \-fn \fIfontname\fP XThe system names will be displayed in the specified font (if none Xis specified, this defaults to timrom10b). X.PP X.TP 8 X.B \-rv XCause X.I xload Xto produce all output in black-on-white instead of white-on-black. X.PP X.TP 8 X.B \-spacing \fIinteger\fP XSpecify the spacing to leave between system meters. Default is 2 (pixels). X.PP X.TP 8 X.B \-delay \fIseconds\fP XSpecify the frequency in seconds with which X.I xrload Xupdates its display (except if the X.I xload Xwindow is obscured and then exposed, immediate redisplay occurs). The default Xupdate frequency is 30 seconds. Specification of a frequency Xless than 30 seconds is ignored and the default frequency is used Xinstead. In general, it is not worth using a very high frequency since Xxrload is subject to the bradcast messages sent by the various rwhod Xdaemons running on the network. X.PP X.TP 8 X.B \-same XDirect X.I xrload Xto use the same scale for all the meters. The scale is indicated by Xtick marks around the border for each meter. X.PP X.TP 8 X.B \-all XTell X.I xrload Xto display the load stats for X.I all Xthe hosts it gets from X.I ruptime. X.PP X.TP 8 X.B \-X XTell X.I xrload Xto display the load stats for all hosts currently able to use the Xdisplay it's running on. This list of hosts can be inspected and Xmodified with the X.I xhost(1) Xcommand. X.PP X.TP 8 X.B =\fIgeometry\fP XThe window is created with the specified Xsize and location Xdetermined Xby the supplied geometry specification. XSee \fIX(1)\fP for a full explanation. X.PP X.TP 8 X.B \[\fIhost\fP]:\[\fIdisplay\fP] XNormally, X.I xrload Xgets the host and display number to use from the environment Xvariable ``DISPLAY''. Either or both can be specified with this option. X.I host Xspecifies which machine to create the X.I xload Xwindow on, and X.I display Xspecifies the display number. XFor example, X``hara.gpl.unl:0'' creates an X.I xload Xon display 0 on machine hara.gpl.unl. Either value can be defaulted Xby omission but ``:'' is necessary to specify one or both. X.SH X DEFAULTS X.PP X.TP 8 X.B BodyFont XSet the hostname font. X.PP X.TP 8 X.B BorderWidth XSet the border width of the window. X.B ReverseVideo XIf ``on'', reverse the definition of foreground and background color. X.PP X.TP 8 X.B SameScale XBoolean value (``on'' or ``off''), determines if all meters will have Xthe same scale. X.PP X.TP 8 X.B Delay XSet the update interval. X.PP X.TP 8 X.B Columns XSets the wanted number of columns for display. X.PP X.TP 8 X.B Spacing XSets the spacing (in pixels) between meters. X.PP X.TP 8 X.B Hosts XTell what system's stats should be displayed: this can be either X``All'', meaning all hosts that appear in ruptime(1), ``X'' meaning Xonly those hosts that can use your display, or a list of Xcoma-separated names. X.SH ENVIRONMENT XDISPLAY - to get the default host and display number. X.SH SEE ALSO XX(1), uwm(1), X(8C), ruptime(1C) X.SH FILES X~/.Xdefaults, /usr/ucb/ruptime X.SH DIAGNOSTICS XVarious X errors. X.SH BUGS X.I xrload Xrelies on the format of ruptime(1) messages. Right now it works fine Xunder Ultrix 1.2 and 2.0, I think it should run on most 4.x BSD systems. X.SH AUTHORS XSalvador P. Abreu (New University of Lisbon -- Portugal, ...!mcvax!inesc!spa) X.br XCopyright (c) 1985, Massachusetts Institute of Technology. X.br XCopyright (c) 1987, GPLIA - Grupo de Programacao em Logica e XInteligencia Artificial, Dep. Informatica, Universidade Nova de XLisboa, 2825 Monte de Caparica, Portugal X.br XSee X(1) for a complete copyright notice. END_OF_xrload.1x if test 4451 -ne `wc -c <xrload.1x`; then echo shar: \"xrload.1x\" unpacked with wrong size! fi # end of overwriting check fi if test -f xrload.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"xrload.c\" else echo shar: Extracting \"xrload.c\" \(13881 characters\) sed "s/^X//" >xrload.c <<'END_OF_xrload.c' X/**************************************************************************/ X/* */ X/* Main Program */ X/* */ X/**************************************************************************/ X X#include <stdio.h> X#include <signal.h> X#include <string.h> X#include <ctype.h> X#include <setjmp.h> X#include <sys/file.h> X#include <sys/wait.h> X#include <sys/time.h> X#include <sys/resource.h> X#include <sys/types.h> X#include <netdb.h> X#include <netinet/in.h> X#include <math.h> X X#include <X/Xlib.h> X X#define streq(a,b) (!(strcmp(a,b))) X X#define TRUE 1 X#define FALSE 0 X X#include "back.bitmap" X#include "down.bitmap" X X#define gray1_width 16 /* from gray1.bitmap */ X#define gray1_height 16 Xstatic short gray1_bits[] = { X 0x5555, 0xaaaa, 0x5555, 0xaaaa, X 0x5555, 0xaaaa, 0x5555, 0xaaaa, X 0x5555, 0xaaaa, 0x5555, 0xaaaa, X 0x5555, 0xaaaa, 0x5555, 0xaaaa}; X X#define DEFAULT_FONT "timrom10b" X#define DEFAULT_DELAY 30 X#define DEFAULT_BWIDTH 2 X#define DEFAULT_SPACING 2 X X#define MAXNAME 32 X#define MAXSYS 128 X XPixmap GrayPixmap; XPixmap whitePixmap, blackPixmap; Xint whitePixel, blackPixel; XFontInfo *theFont; XOpaqueFrame frame; XWindow mainWindow; XWindowInfo mainLoc; Xchar *geometry="", defGeometry[16]; Xint minWidth, minHeight; XBitmap bitmap; Xint mapped = TRUE; Xint nSystems = 0; Xint ncols = 0; Xint dflag = FALSE; Xint delay = DEFAULT_DELAY; Xint border_width = DEFAULT_BWIDTH; Xint same_scale = FALSE; Xchar *font_name = DEFAULT_FONT; Xint reverse = FALSE; Xint all_hosts = FALSE; Xint X_hosts = FALSE; Xchar *host_names[MAXSYS]; Xint ww, dd=DEFAULT_SPACING, hh, rr; X Xtypedef struct { X char sys_name[MAXNAME]; X float load_average[3]; X int users; X int state; X#define DOWN 0 X#define UP 1 X char how_long[10]; X Window w; X} sys_stat; X Xsys_stat stats[MAXSYS]; X Xvoid show_stats (); Xint get_stats (); Xvoid recalc_windows (); Xvoid update_sys (); X X#define max(a,b) (((a)>(b))? (a): (b)) X Xmain (argc, argv) X int argc; X char *argv[]; X{ X extern void initialize (); X extern void doit (); X X initialize (argc, argv); X doit (); X} X Xvoid initialize (argc, argv) X int argc; X char *argv[]; X{ X register int i, nsys; X char *option, *display = NULL, *getenv(); X X if ((option = XGetDefault ("xrload", "SameScale")) != NULL) X same_scale = streq(option, "on"); X if ((option = XGetDefault ("xrload", "Columns")) != NULL) X ncols = atoi(option); X if ((option = XGetDefault ("xrload", "Delay")) != NULL) X delay = atoi(option); X if ((option = XGetDefault ("xrload", "ReverseVideo")) != NULL) X reverse = streq(option, "on"); X if ((option = XGetDefault ("xrload", "BodyFont")) != NULL) X font_name = option; X if ((option = XGetDefault ("xrload", "BorderWidth")) != NULL) X border_width = atoi(option); X if ((option = XGetDefault ("xrload", "Spacing")) != NULL) X dd = atoi(option); X X for (i=1; i<argc; i++) { X if (argv[i][0] == '-') { X if (streq(argv[i], "-same") || streq(argv[i], "-s")) { X same_scale = TRUE; X } X else if (streq(argv[i], "-cols") || streq(argv[i], "-c")) { X ncols = atoi (argv[++i]); X } X else if (streq(argv[i], "-delay") || streq(argv[i], "-d")) { X delay = atoi (argv[++i]); X } X else if (streq(argv[i], "-all") || streq(argv[i], "-a")) { X all_hosts = TRUE; X } X else if (streq(argv[i], "-X")) { X X_hosts = TRUE; X } X else if (streq(argv[i], "-DEBUG") || streq(argv[i], "-D")) { X dflag++; X } X else if (streq(argv[i], "-rv")) { X reverse = TRUE; X } X else if (streq(argv[i], "-fn") || streq(argv[i], "-font")) { X font_name = argv[++i]; X } X else if (streq(argv[i], "-bw")) { X border_width = atoi(argv[++i]); X } X else if (streq(argv[i], "-spacing") || streq(argv[i], "-sp")) { X dd = atoi(argv[++i]); X } X else { X usage (); X } X } X else if (argv[i][0] == '=') X geometry = argv[i]; X else if (display) X usage (); X else X display = argv[i]; X } X X if (!display) { X display = getenv ("DISPLAY"); X if (!display || !*display) X display = "unix:0"; X } X X if (!XOpenDisplay (display)) { X fprintf (stderr, "xrload: can't open display %s.\n", display); X exit (1); X } X X if (!all_hosts) { X option = "X"; X if (X_hosts || ((option = XGetDefault ("xrload", "Hosts")) != NULL)) { X register char *p; X char *get_hostname(); X struct in_addr *hosts, *XGetHosts(); X int nhosts; X X if (streq (option, "All")) { X all_hosts = TRUE; X } X else if (streq (option, "X")) { X register char **host_namep = host_names; X register int i; X struct in_addr *hosts; X X all_hosts = FALSE; X hosts = XGetHosts (&nhosts); X if (nhosts != 0) { X sethostent(1); /* don't close the database each time */ X for (i=0; i<nhosts; i++) { X p = get_hostname(hosts[i]); X if (!streq (p, "localhost")) { X *host_namep = (char *) malloc (strlen(p)+1); X strcpy (*host_namep, p); X } X host_namep++; X } X endhostent(); X } X *host_namep = (char *) NULL; X } X else if (*option == '(') { X register char **host_namep = host_names; X all_hosts = FALSE; X while (*host_namep++ = strtok (option, "(), ;")) X option = (char *) NULL; X } X } X else X all_hosts = TRUE; X } X X if (dflag) { X if (all_hosts) X printf ("all hosts.\n"); X else { X register int i; X printf ("hosts:\n"); X for (i=0; host_names[i]; i++) X printf (" %2d: %s\n", i, host_names[i]); X } X } X X if ((nsys = get_stats (stats)) == 0) { X fprintf (stderr, "no hosts!\n"); X exit (1); X } X X if (ncols == 0) X ncols = (nsys<6)? nsys: (nsys/2); X X if ((theFont = XOpenFont (font_name)) == NULL) { X fprintf (stderr, "xrload: can't find font %s\n", font_name); X exit (1); X } X X { X register int max_swidth = 0; X for (i=0; i<nsys; i++) X max_swidth = max (XQueryWidth (stats[i].sys_name, theFont->id), X max_swidth); X X ww = max (back_width, max_swidth) + dd; X hh = back_height + dd + theFont->height; X rr = (ww-1)/2; X } X X minWidth = ncols * ww + (ncols+1) * dd; X minHeight = ((nsys+ncols-1)/ncols) * hh + ((nsys+ncols-1)/ncols) * dd; X X sprintf (defGeometry, "=%dx%d", minWidth, minHeight); X X if (reverse) { X whitePixmap = WhitePixmap; X blackPixmap = BlackPixmap; X whitePixel = WhitePixel; X blackPixel = BlackPixel; X } X else { X whitePixmap = BlackPixmap; X blackPixmap = WhitePixmap; X whitePixel = BlackPixel; X blackPixel = WhitePixel; X } X X frame.bdrwidth = border_width; X frame.border = whitePixmap; X frame.background = blackPixmap; X X mainWindow = XCreate ("Load Averages", argv[0], X geometry, defGeometry, &frame, minWidth, minHeight); X X XStoreName (mainWindow, "Load Averages"); X XSelectInput (mainWindow, ExposeWindow|UnmapWindow); X X bitmap = XStoreBitmap (gray1_width, gray1_height, gray1_bits); X GrayPixmap = XMakePixmap (bitmap, WhitePixel, BlackPixel); X XFreeBitmap (bitmap); X X XSetResizeHint (mainWindow, dd, 0, ww+dd, hh+dd); X XMapWindow (mainWindow); X} X X/* stolen from xhost.c */ X X/* X * get_hostname - Given an internet address, return a name (CHARON.MIT.EDU) X * or a string representing the address (18.58.0.13) if the name cannot X * be found. X */ X Xjmp_buf env; X Xchar *get_hostname (address) X struct in_addr address; X{ X struct hostent *hp = NULL; X int nameserver_lost(); X char *inet_ntoa(); X X/* X * gethostbyaddr can take a LONG time if the host does not exist. X * Assume that if it does not respond in NAMESERVER_TIMEOUT seconds X * that something is wrong and do not make the user wait. X * gethostbyaddr will continue after a signal, so we have to X * jump out of it. X */ X signal(SIGALRM, nameserver_lost); X alarm(8); X if (setjmp(env) == 0) { X hp = gethostbyaddr (&address, sizeof(struct in_addr), AF_INET); X } X alarm(0); X if (hp) X return (hp->h_name); X else return (inet_ntoa(address)); X} X Xnameserver_lost() X{ X longjmp(env, -1); X} X Xvoid doit () X{ X for (;;) { X if (mapped) { X register int nsys = get_stats (stats); X show_stats (stats, nsys); X } X handle_X_events (); X } X} X Xint pid; /* Gets child process id */ Xint iofd[2]; /* Sincronization pipe */ X Xint get_stats (stats) X sys_stat *stats; X{ X if (pipe (iofd) < 0) { X perror ("pipe"); X exit (1); X } X X if ((pid = fork ()) < 0) X perror ("fork"); X else if (pid == 0) { /* Child: exec ruptime */ X dup2 (iofd[1], 1); /* stdout to pipe */ X execl ("/usr/ucb/ruptime", "ruptime", 0); X perror ("can't exec /usr/ucb/ruptime"); X exit (1); X } X else { /* Parent: parse the stuff */ X static char hstatus[8], junk[8]; X union wait status; X int nh = 0, nf; X FILE *pfile; X X close (iofd[1]); X pfile = fdopen (iofd[0], "r"); X X for (;;) { X nf = fscanf (pfile, "%s %s %s %d %s load %f, %f, %f", X stats[nh].sys_name, hstatus, stats[nh].how_long, X &stats[nh].users, junk, X &stats[nh].load_average[0], X &stats[nh].load_average[1], X &stats[nh].load_average[2]); X if (dflag) X printf ("sys %d(%d): %s %s %s %du, %g %g %g\n", nh, nf, X stats[nh].sys_name, hstatus, stats[nh].how_long, X stats[nh].users, X stats[nh].load_average[0], X stats[nh].load_average[1], X stats[nh].load_average[2]); X if (nf < 3) break; X stats[nh].how_long[strlen(stats[nh].how_long)-1] = '\0'; X stats[nh].state = strcmp(hstatus, "up")? DOWN: UP; X if (all_hosts) X nh++; X else { X register int i = 0; X while (host_names[i] && X !streq(stats[nh].sys_name, host_names[i])) X i++; X if (host_names[i]) X nh++; X } X } X X stats[nh].sys_name[0] = '\0'; X X fclose (pfile); X wait (&status); X return (nh); X } X} X Xvoid dump_stats (stats, nsys) X sys_stat *stats; X int nsys; X{ X register int i; X X for (i=0; stats[i].sys_name[0]; i++) { X if (stats[i].state == UP) { X printf ("%s %s %d %f %f %f\n", X stats[i].sys_name, stats[i].how_long, X stats[i].users, X stats[i].load_average[0], X stats[i].load_average[1], X stats[i].load_average[2]); X } X else { X printf ("%s %s\n", X stats[i].sys_name, stats[i].how_long); X } X } X putchar ('\n'); X} X Xvoid show_stats (stats, nsys) X sys_stat *stats; X int nsys; X{ X float max_scale; X int i; X X if (dflag) dump_stats (stats, nsys); X X recalc_windows (stats, nsys); X X if (same_scale) { X max_scale = 1.0; X for (i=0; i<nsys; i++) { X if (stats[i].state == UP) { X max_scale = max (max_scale, stats[i].load_average[0]); X max_scale = max (max_scale, stats[i].load_average[1]); X /*max_scale = max (max_scale, stats[i].load_average[2]);*/ X } X } X max_scale = ceil (max_scale); X } X X for (i=0; i<nsys; i++) { X if (!same_scale) X max_scale = ceil (max (stats[i].load_average[0], X stats[i].load_average[1])); X if (max_scale < 1.0) max_scale = 1.0; X update_sys (&stats[i], max_scale); X } X XFlush (); X} X Xvoid recalc_windows (stats, nsys) X sys_stat *stats; X int nsys; X{ X WindowInfo wi; X register int x, y, i; X X XQueryWindow (mainWindow, &wi); X if (wi.width != mainLoc.width || X wi.height != mainLoc.height || X nsys != nSystems) { /* recompute subwindow locations */ X mainLoc = wi; X nSystems = nsys; X x = dd; X y = dd; X for (i=0; i<nsys; i++) { X if (stats[i].w) X XMoveWindow (stats[i].w, x, y); X else { X stats[i].w = XCreateWindow (mainWindow, x, y, ww, hh, 0, X NULL, blackPixmap); X XMapWindow (stats[i].w); X } X x += ww+dd; X if (x >= wi.width) { X x = dd; X y += hh+dd; X } X } X } X} X Xvoid update_sys (stat, scale) X sys_stat *stat; X float scale; X{ X register int tw; X float tick; X X if (stat->state == DOWN) { X XBitmapBitsPut (stat->w, (ww-down_width)/2, 0, down_width, down_height, X down_bits, X blackPixel, whitePixel, NULL, GXcopy, AllPlanes); X } X else { X XBitmapBitsPut (stat->w, (ww-back_width)/2, 0, back_width, back_height, X back_bits, X blackPixel, whitePixel, NULL, GXcopy, AllPlanes); X X for (tick=1.0; tick<scale; tick += 1.0) X draw_hand (stat->w, tick, scale, 0.8, 1.1, 2); X X draw_hand (stat->w, stat->load_average[0], scale, 0.0, 0.85, 1); X draw_hand (stat->w, stat->load_average[1], scale, 0.0, 0.50, 1); X } X X tw = XQueryWidth (stat->sys_name, theFont->id); X XText (stat->w, (ww-tw)/2, hh-2-theFont->height, X stat->sys_name, strlen(stat->sys_name), X theFont->id, whitePixel, blackPixel); X} X Xdraw_hand (w, value, scale, l0, l1, thick) X Window w; X float value, scale, l0, l1; X int thick; X{ X float theta = M_PI_4 * (5.0 - 6.0*value/scale); X int x0 = (int) (rr*l0*cos(theta)); X int x1 = (int) (rr*l1*cos(theta)); X int y0 = (int) (rr*l0*sin(-theta)); X int y1 = (int) (rr*l1*sin(-theta)); X X x0 += (ww-back_width)/2+back_x_hot; X x1 += (ww-back_width)/2+back_x_hot; X y0 += back_y_hot; X y1 += back_y_hot; X X XLine (w, x0, y0, x1, y1, thick, thick, blackPixel, GXcopy, AllPlanes); X} X Xhandle_X_events () X{ X struct timeval timeout; X int maxfds, fdmask, readfds, nfound; X XEvent event; X X if (dflag) printf ("in handle_X_event()\n"); X timeout.tv_sec = delay; X timeout.tv_usec = 0; X maxfds = dpyno() + 1; X fdmask = 1 << dpyno(); X X do { X if (XPending()) { X XNextEvent (&event); X switch (event.type) { X X case ExposeWindow: X mapped = TRUE; X show_stats (stats, nSystems); X break; X X case UnmapWindow: X mapped = FALSE; X break; X X default: X fprintf (stderr, "xrload: unexpected X event (%d)\n", X event.type); X exit(1); X } X } X X readfds = fdmask; X if ((nfound = select (maxfds, &readfds, NULL, NULL, &timeout)) < 0) { X perror ("select"); X exit (1); X } X if (dflag) printf ("select(...) -> %d\n", nfound); X } while (nfound); X} X Xusage () X{ X fprintf (stderr, X"usage: xrload [-cols <columns>] [-delay <delay>] [-same] [-rv] [-all] [-X]\n"); X fprintf (stderr, X" [-fn <font>] [-bw <border-width>] [-spacing <spacing>]\n"); X fprintf (stderr, X" [=<geometry>] [<host>:<display>]\n"); X exit (1); X} END_OF_xrload.c if test 13881 -ne `wc -c <xrload.c`; then echo shar: \"xrload.c\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of shell archive. exit 0
spa@hara.DEC.COM (Salvador Pinto Abreu) (08/13/87)
This is xrload, an X to{ol,y} to display the load average of the various machines on a LAN. To check it out, unshar and type "make" followed by "xrload -X". Note: I had to split this up because of mailer problems. ---------------------------------------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 5)." # Contents: MANIFEST Makefile README back.bitmap down.bitmap # draw-hand.c dump-stats.c xrload.c # Wrapped by root@mak on Thu Aug 13 11:17:35 1987 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f MANIFEST -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MANIFEST\" else echo shar: Extracting \"MANIFEST\" \(624 characters\) sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST' X File Name Archive # Description X----------------------------------------------------------- X MANIFEST 1 This shipping list X Makefile 1 X README 1 X back.bitmap 1 X down.bitmap 1 X draw-hand.c 1 X dump-stats.c 1 X event-loop.c 2 X get-stats.c 3 X globals.c 2 X hostname.c 2 X init.c 4 X recalc-windows.c 1 X show-stats.c 2 X update-sys.c 2 X xrload.1x 3 X xrload.c 1 END_OF_MANIFEST if test 624 -ne `wc -c <MANIFEST`; then echo shar: \"MANIFEST\" unpacked with wrong size! fi # end of overwriting check fi if test -f Makefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Makefile\" else echo shar: Extracting \"Makefile\" \(834 characters\) sed "s/^X//" >Makefile <<'END_OF_Makefile' XPROGRAM = xrload X XOBJECTS = draw-hand.o dump-stats.o event-loop.o get-stats.o hostname.o \ X init.o recalc-windows.o show-stats.o update-sys.o globals.o \ X xrload.o X XSHARFILES = \ X README Makefile \ X xrload.1x \ X back.bitmap down.bitmap \ X draw-hand.c dump-stats.c event-loop.c get-stats.c hostname.c \ X init.c recalc-windows.c show-stats.c update-sys.c globals.c \ X xrload.c X XMAN = /usr/man/man1 XBIN = /usr/local/bin X XCFLAGS = -O XSIZE = 8k X Xall: $(PROGRAM) X Xshar: MANIFEST X makekit -s$(SIZE) -nxrload.shar. -h2 -iMANIFEST X XMANIFEST: $(SHARFILES) X makekit -m -s$(SIZE) -x $(SHARFILES) X Xinstall: all X install xrload $(BIN) X Xman: xrload.1x X cp xrload.1x $(MAN)/xrload.1 X chmod a=r $(MAN)/xrload.1 X X$(PROGRAM): $(OBJECTS) X cc $(CFLAGS) -o xrload $(OBJECTS) -lX -lm X Xxrload.h: back.bitmap down.bitmap X X$(OBJECTS): xrload.h END_OF_Makefile if test 834 -ne `wc -c <Makefile`; then echo shar: \"Makefile\" unpacked with wrong size! fi # end of overwriting check fi if test -f README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"README\" else echo shar: Extracting \"README\" \(664 characters\) sed "s/^X//" >README <<'END_OF_README' XThis is xrload(1), a tool that serves a function similar to that of Xxload(1) but monitors (part of) a TCP/IP network using a single Xwindow. This avoids having a bunch of xload windows, each with a local Xand a remote associated process, and all the resource waste this would Ximply. X XTo try it, just type: X % make X % xrload -X X XNote: I had to split this up because I'm having problems with the mailer. X--- XUUCP: ...{mcvax,inria}!inesc!hara.unl.psi!spa PSI/VMS: PSI%+26805010310::SPA XARPA: lisvax.dec!unlai!spa@decwrl.dec.com Phone: + 351 1 295 31 56 X XSnail: Salvador Pinto Abreu X Dept. of Computer Science, Universidade Nova de Lisboa X 2825 Monte Caparica, Portugal END_OF_README if test 664 -ne `wc -c <README`; then echo shar: \"README\" unpacked with wrong size! fi # end of overwriting check fi if test -f back.bitmap -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"back.bitmap\" else echo shar: Extracting \"back.bitmap\" \(679 characters\) sed "s/^X//" >back.bitmap <<'END_OF_back.bitmap' X#define back_width 32 X#define back_height 32 X#define back_x_hot 16 X#define back_y_hot 15 Xstatic short back_bits[] = { X 0xffff, 0xffff, 0x1fff, 0xfff0, X 0xe3ff, 0xff8f, 0x1cff, 0xfe70, X 0x027f, 0xfc80, 0x01bf, 0xfb00, X 0x005f, 0xf400, 0x004f, 0xe400, X 0x002f, 0xe800, 0x0017, 0xd000, X 0x0017, 0xd000, 0x0017, 0xd000, X 0x000b, 0xa000, 0x000b, 0xa000, X 0x800b, 0xa003, 0x800b, 0xa003, X 0x800b, 0xa003, 0x000b, 0xa000, X 0x000b, 0xa000, 0x0017, 0xd000, X 0xc017, 0xd007, 0x2017, 0xd008, X 0xd02f, 0xe817, 0xe84f, 0xe42f, X 0xf45f, 0xf45f, 0xfbbf, 0xfbbf, X 0xfc7f, 0xfc7f, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff}; END_OF_back.bitmap if test 679 -ne `wc -c <back.bitmap`; then echo shar: \"back.bitmap\" unpacked with wrong size! fi # end of overwriting check fi if test -f down.bitmap -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"down.bitmap\" else echo shar: Extracting \"down.bitmap\" \(679 characters\) sed "s/^X//" >down.bitmap <<'END_OF_down.bitmap' X#define down_width 32 X#define down_height 32 X#define down_x_hot 16 X#define down_y_hot 15 Xstatic short down_bits[] = { X 0xffff, 0xffff, 0x1fff, 0xfff0, X 0xe3ff, 0xff8f, 0x1cff, 0xfe70, X 0x827f, 0xfc83, 0x81bf, 0xfb03, X 0x805f, 0xf403, 0x804f, 0xe403, X 0xf82f, 0xe83f, 0xf817, 0xd03f, X 0x8017, 0xd003, 0x8017, 0xd003, X 0x870b, 0xe0e2, 0x890b, 0xa123, X 0x890b, 0xa122, 0x870b, 0xa0e2, X 0x890b, 0xa022, 0xa90b, 0xa02a, X 0x890b, 0xa022, 0xc017, 0xd007, X 0xc017, 0xd007, 0x2017, 0xd008, X 0xd02f, 0xe817, 0xe84f, 0xe42f, X 0xf45f, 0xf45f, 0xfbbf, 0xfbbf, X 0xfc7f, 0xfc7f, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff}; END_OF_down.bitmap if test 679 -ne `wc -c <down.bitmap`; then echo shar: \"down.bitmap\" unpacked with wrong size! fi # end of overwriting check fi if test -f draw-hand.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"draw-hand.c\" else echo shar: Extracting \"draw-hand.c\" \(788 characters\) sed "s/^X//" >draw-hand.c <<'END_OF_draw-hand.c' X/**************************************************************************/ X/* */ X/* Draw a dial hand */ X/* */ X/**************************************************************************/ X X#include "xrload.h" X Xdraw_hand (w, value, scale, l0, l1, thick) X Window w; X float value, scale, l0, l1; X int thick; X{ X float theta = M_PI_4 * (5.0 - 6.0*value/scale); X int x0 = (int) (rr*l0*cos(theta)); X int x1 = (int) (rr*l1*cos(theta)); X int y0 = (int) (rr*l0*sin(-theta)); X int y1 = (int) (rr*l1*sin(-theta)); X X x0 += (ww-back.width)/2+back.x_hot; X x1 += (ww-back.width)/2+back.x_hot; X y0 += back.y_hot; X y1 += back.y_hot; X X XLine (w, x0, y0, x1, y1, thick, thick, blackPixel, GXcopy, AllPlanes); X} END_OF_draw-hand.c if test 788 -ne `wc -c <draw-hand.c`; then echo shar: \"draw-hand.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump-stats.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump-stats.c\" else echo shar: Extracting \"dump-stats.c\" \(741 characters\) sed "s/^X//" >dump-stats.c <<'END_OF_dump-stats.c' X/**************************************************************************/ X/* */ X/* Dump system stats (debugging) */ X/* */ X/**************************************************************************/ X X#include "xrload.h" X Xvoid dump_stats (stats, nsys) X sys_stat *stats; X int nsys; X{ X register int i; X X for (i=0; stats[i].sys_name[0]; i++) { X if (stats[i].state == UP) { X printf ("%s %s %d %f %f %f\n", X stats[i].sys_name, stats[i].how_long, X stats[i].users, X stats[i].load_average[0], X stats[i].load_average[1], X stats[i].load_average[2]); X } X else { X printf ("%s %s\n", X stats[i].sys_name, stats[i].how_long); X } X } X putchar ('\n'); X} END_OF_dump-stats.c if test 741 -ne `wc -c <dump-stats.c`; then echo shar: \"dump-stats.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f xrload.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"xrload.c\" else echo shar: Extracting \"xrload.c\" \(721 characters\) sed "s/^X//" >xrload.c <<'END_OF_xrload.c' X/**************************************************************************/ X/* */ X/* Main Program */ X/* */ X/**************************************************************************/ X X#include "xrload.h" X Xmain (argc, argv) X int argc; X char *argv[]; X{ X extern void initialize (); X extern void doit (); X X initialize (argc, argv); X doit (); X} X Xusage () X{ X fprintf (stderr, X"usage: xrload [-cols <columns>] [-delay <sec>] [-same] [-rv] [-all] [-X]\n"); X fprintf (stderr, X" [-fn <font>] [-bw <border-width>] [-spacing <spacing>]\n"); X fprintf (stderr, X" [=<geometry>] [<host>:<display>]\n"); X exit (1); X} END_OF_xrload.c if test 721 -ne `wc -c <xrload.c`; then echo shar: \"xrload.c\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 1 \(of 5\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 4 5 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 5 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 --- UUCP: ...{mcvax,inria}!inesc!hara.unl.psi!spa PSI/VMS: PSI%+26805010310::SPA ARPA: lisvax.dec!unlai!spa@decwrl.dec.com Phone: + 351 1 295 31 56 Snail: Salvador Pinto Abreu Dept. of Computer Science, Universidade Nova de Lisboa 2825 Monte Caparica, Portugal
spa@hara.DEC.COM (Salvador Pinto Abreu) (08/13/87)
This is xrload, an X to{ol,y} to display the load average of the various machines on a LAN. To check it out, unshar and type "make" followed by "xrload -X". Note: I had to split this up because of mailer problems. ---------------------------------------------------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 6)." # Contents: MANIFEST README back.bitmap down.bitmap dump-stats.c # xrload.c # Wrapped by root@mak on Thu Aug 13 11:36:17 1987 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f MANIFEST -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MANIFEST\" else echo shar: Extracting \"MANIFEST\" \(624 characters\) sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST' X File Name Archive # Description X----------------------------------------------------------- X MANIFEST 1 This shipping list X Makefile 2 X README 1 X back.bitmap 1 X down.bitmap 1 X draw-hand.c 1 X dump-stats.c 1 X event-loop.c 3 X get-stats.c 4 X globals.c 3 X hostname.c 3 X init.c 6 X recalc-windows.c 2 X show-stats.c 2 X update-sys.c 2 X xrload.1x 5 X xrload.c 1 END_OF_MANIFEST if test 624 -ne `wc -c <MANIFEST`; then echo shar: \"MANIFEST\" unpacked with wrong size! fi # end of overwriting check fi if test -f README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"README\" else echo shar: Extracting \"README\" \(664 characters\) sed "s/^X//" >README <<'END_OF_README' XThis is xrload(1), a tool that serves a function similar to that of Xxload(1) but monitors (part of) a TCP/IP network using a single Xwindow. This avoids having a bunch of xload windows, each with a local Xand a remote associated process, and all the resource waste this would Ximply. X XTo try it, just type: X % make X % xrload -X X XNote: I had to split this up because I'm having problems with the mailer. X--- XUUCP: ...{mcvax,inria}!inesc!hara.unl.psi!spa PSI/VMS: PSI%+26805010310::SPA XARPA: lisvax.dec!unlai!spa@decwrl.dec.com Phone: + 351 1 295 31 56 X XSnail: Salvador Pinto Abreu X Dept. of Computer Science, Universidade Nova de Lisboa X 2825 Monte Caparica, Portugal END_OF_README if test 664 -ne `wc -c <README`; then echo shar: \"README\" unpacked with wrong size! fi # end of overwriting check fi if test -f back.bitmap -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"back.bitmap\" else echo shar: Extracting \"back.bitmap\" \(679 characters\) sed "s/^X//" >back.bitmap <<'END_OF_back.bitmap' X#define back_width 32 X#define back_height 32 X#define back_x_hot 16 X#define back_y_hot 15 Xstatic short back_bits[] = { X 0xffff, 0xffff, 0x1fff, 0xfff0, X 0xe3ff, 0xff8f, 0x1cff, 0xfe70, X 0x027f, 0xfc80, 0x01bf, 0xfb00, X 0x005f, 0xf400, 0x004f, 0xe400, X 0x002f, 0xe800, 0x0017, 0xd000, X 0x0017, 0xd000, 0x0017, 0xd000, X 0x000b, 0xa000, 0x000b, 0xa000, X 0x800b, 0xa003, 0x800b, 0xa003, X 0x800b, 0xa003, 0x000b, 0xa000, X 0x000b, 0xa000, 0x0017, 0xd000, X 0xc017, 0xd007, 0x2017, 0xd008, X 0xd02f, 0xe817, 0xe84f, 0xe42f, X 0xf45f, 0xf45f, 0xfbbf, 0xfbbf, X 0xfc7f, 0xfc7f, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff}; END_OF_back.bitmap if test 679 -ne `wc -c <back.bitmap`; then echo shar: \"back.bitmap\" unpacked with wrong size! fi # end of overwriting check fi if test -f down.bitmap -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"down.bitmap\" else echo shar: Extracting \"down.bitmap\" \(679 characters\) sed "s/^X//" >down.bitmap <<'END_OF_down.bitmap' X#define down_width 32 X#define down_height 32 X#define down_x_hot 16 X#define down_y_hot 15 Xstatic short down_bits[] = { X 0xffff, 0xffff, 0x1fff, 0xfff0, X 0xe3ff, 0xff8f, 0x1cff, 0xfe70, X 0x827f, 0xfc83, 0x81bf, 0xfb03, X 0x805f, 0xf403, 0x804f, 0xe403, X 0xf82f, 0xe83f, 0xf817, 0xd03f, X 0x8017, 0xd003, 0x8017, 0xd003, X 0x870b, 0xe0e2, 0x890b, 0xa123, X 0x890b, 0xa122, 0x870b, 0xa0e2, X 0x890b, 0xa022, 0xa90b, 0xa02a, X 0x890b, 0xa022, 0xc017, 0xd007, X 0xc017, 0xd007, 0x2017, 0xd008, X 0xd02f, 0xe817, 0xe84f, 0xe42f, X 0xf45f, 0xf45f, 0xfbbf, 0xfbbf, X 0xfc7f, 0xfc7f, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff, X 0xffff, 0xffff, 0xffff, 0xffff}; END_OF_down.bitmap if test 679 -ne `wc -c <down.bitmap`; then echo shar: \"down.bitmap\" unpacked with wrong size! fi # end of overwriting check fi if test -f dump-stats.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"dump-stats.c\" else echo shar: Extracting \"dump-stats.c\" \(741 characters\) sed "s/^X//" >dump-stats.c <<'END_OF_dump-stats.c' X/**************************************************************************/ X/* */ X/* Dump system stats (debugging) */ X/* */ X/**************************************************************************/ X X#include "xrload.h" X Xvoid dump_stats (stats, nsys) X sys_stat *stats; X int nsys; X{ X register int i; X X for (i=0; stats[i].sys_name[0]; i++) { X if (stats[i].state == UP) { X printf ("%s %s %d %f %f %f\n", X stats[i].sys_name, stats[i].how_long, X stats[i].users, X stats[i].load_average[0], X stats[i].load_average[1], X stats[i].load_average[2]); X } X else { X printf ("%s %s\n", X stats[i].sys_name, stats[i].how_long); X } X } X putchar ('\n'); X} END_OF_dump-stats.c if test 741 -ne `wc -c <dump-stats.c`; then echo shar: \"dump-stats.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f xrload.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"xrload.c\" else echo shar: Extracting \"xrload.c\" \(721 characters\) sed "s/^X//" >xrload.c <<'END_OF_xrload.c' X/**************************************************************************/ X/* */ X/* Main Program */ X/* */ X/**************************************************************************/ X X#include "xrload.h" X Xmain (argc, argv) X int argc; X char *argv[]; X{ X extern void initialize (); X extern void doit (); X X initialize (argc, argv); X doit (); X} X Xusage () X{ X fprintf (stderr, X"usage: xrload [-cols <columns>] [-delay <sec>] [-same] [-rv] [-all] [-X]\n"); X fprintf (stderr, X" [-fn <font>] [-bw <border-width>] [-spacing <spacing>]\n"); X fprintf (stderr, X" [=<geometry>] [<host>:<display>]\n"); X exit (1); X} END_OF_xrload.c if test 721 -ne `wc -c <xrload.c`; then echo shar: \"xrload.c\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 1 \(of 6\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 4 5 6 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 6 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 --- UUCP: ...{mcvax,inria}!inesc!hara.unl.psi!spa PSI/VMS: PSI%+26805010310::SPA ARPA: lisvax.dec!unlai!spa@decwrl.dec.com Phone: + 351 1 295 31 56 Snail: Salvador Pinto Abreu Dept. of Computer Science, Universidade Nova de Lisboa 2825 Monte Caparica, PortugBut
kurt@hi.UUCP (Kurt Zeilenga) (08/13/87)
In article <8708122138.AA15939@decwrl.dec.com> spa@hara.DEC.COM (Salvador Pinto Abreu) writes: > >This is xrload, an X to{ol,y} to display the load average of the >various machines on a LAN. To check it out, unshar and type "make" >followed by "xrload -X". > [shar file deleted] on a SUN (3.X) running X, add: #include <sys/socket.h> to the long list of include files in xrload.c so it will compile. Runs fine (expect I modify the code to limit the window width to that of the display device unless user specified otherwise).