Xmon - graphically monitor a list Part01/03

George Ferguson ferguson at cs.rochester.edu
Wed Aug 29 06:46:52 AEST 1990


Those of you who lived through the xse fiasco a few weeks ago may not be
looking forward to another of my source postings, but here goes anyway.

This time it's XMON - a program for monitoring a list (like the output of
a command) and displaying it in a window. It is a fully-customizable
Athena widget program, with lots of code that might be useful for other
applications. The README file has more complete descriptions, as well as
installation notes, so check it out. You'll probably have to adjust some of
the filenames in the resource file and various scripts. I've tried to
mention most of them in the README.

Please see the README for my disclaimer. Comments are welcome.

George Ferguson			ARPA: ferguson at cs.rochester.edu
University of Rochester		UUCP: {decvax,rutgers}!rochester!ferguson
Rochester  NY  14627		VOX:  (716) 275-2527

#! /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 3)."
# Contents:  CONTENTS Imakefile MANIFEST README app-resources.h images
#   images/CONTENTS images/icon-c.xbm images/icon-dir.xbm
#   images/icon-file.xbm images/icon-h.xbm images/icon-x.xbm
#   images/nobody.xbm translate.c util util/CONTENTS util/ad2c
#   util/ad2c.sed util/name2icon util/rf-awk util/ru-awk util/xls-cmd
#   xmon.h
# Wrapped by ferguson at cyan.cs.rochester.edu on Tue Aug 28 16:40:48 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'CONTENTS' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'CONTENTS'\"
else
echo shar: Extracting \"'CONTENTS'\" \(549 characters\)
sed "s/^X//" >'CONTENTS' <<'END_OF_FILE'
XCONTENTS of xmon:
XImakefile			Imakefile for xmon distribution
XMakefile			Derived Makefile
XREADME				Installation notes
XXmon.ad				Application defaults file
XXmon.ad.h			C header file created from Xmon.ad by ad2c
Xapp-resources.h			External definitions of the appResources
Ximages				bitmap directory
Xtranslate.c			maps class names to Widget classes
Xupdate.c			runs updateCommand, memory management
Xutil				utility programs directory
Xxmon.c				main, initialization, widget creation
Xxmon.h				shared variables and declarations
Xxmon.man			man page source
END_OF_FILE
if test 549 -ne `wc -c <'CONTENTS'`; then
    echo shar: \"'CONTENTS'\" unpacked with wrong size!
fi
# end of 'CONTENTS'
fi
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(2053 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
X/**/#
X/**/#	Imakefile for xmon : Graphically monitor a list
X/**/#
X/**/#   George Ferguson, ferguson at cs.rochester.edu, 15 Jul 1990.
X/**/#
X/**/#	$Id: Imakefile,v 1.3 90/08/07 19:20:25 ferguson Exp $
X/**/#
X
X/**/#
X/**/# Here's what to change to customize the installation...
X/**/#
X/**/# where do you want this stuff?
X/**/#
XBINDIR = /scratch/ferguson/xmon/Bin
XLIBDIR = /scratch/ferguson/xmon/Lib
XMANDIR = /scratch/ferguson/xmon/Man
X
X/**/#
X/**/# where do the faces live?
X/**/#
XFACEDIR = $(LIBDIR)/images
X
X/**/#
X/**/# where do the support programs go?
X/**/#
XXMONDIR = $(LIBDIR)/xmon
X
X/**/#
X/**/# which support programs do you want?
X/**/#
XUTIL = name2icon xls-cmd
X
X/**/#
X/**/# where is the app-defaults to C converter?
X/**/#
XAD2C = util/ad2c
X
X/**/#
X/**/# Nothing to change below here (except maybe CDEBUGFLAGS).
X/**/#
XDEPLIBS =		XawClientDepLibs
XLOCAL_LIBRARIES =	XawClientLibs
X/**/#CDEBUGFLAGS = 		-g
X
XSRCS = xmon.c translate.c update.c
XOBJS = xmon.o translate.o update.o
XINCS = app-resources.h
X
XComplexProgramTarget(xmon)
XInstallAppDefaults(Xmon)
X
X/**/# 
X/**/# Replace the four ln commands below with these five lines (uncommented)
X/**/# to install shell scripts for the derived tools rather than using
X/**/# symbolic links.
X/**/# 
X/**/# echo "$(BINDIR)/xmon -name xru" > $(BINDIR)/xru
X/**/# echo "$(BINDIR)/xmon -name xrf" > $(BINDIR)/xrf
X/**/# echo "$(BINDIR)/xmon -name xls" > $(BINDIR)/xls
X/**/# echo "$(BINDIR)/xmon -name xfrom" > $(BINDIR)/xfrom
X/**/# chmod a+x $(BINDIR)/xru $(BINDIR)/xrf $(BINDIR)/xls $(BINDIR)/xfrom
X
Xinstall::
X	ln -s $(BINDIR)/xmon $(BINDIR)/xru
X	ln -s $(BINDIR)/xmon $(BINDIR)/xrf
X	ln -s $(BINDIR)/xmon $(BINDIR)/xls
X	ln -s $(BINDIR)/xmon $(BINDIR)/xfrom
X	test -d $(FACEDIR) || mkdir $(FACEDIR)
X	chmod 1757 $(FACEDIR)
X	cd images; for icon in `ls *.xbm` ; \
X	do \
X		cp $$icon $(FACEDIR)/`(echo $$icon | sed s/.xbm//)` ; \
X	done
X	test -d $(XMONDIR) || mkdir $(XMONDIR)
X	cd util ; cp $(UTIL) $(XMONDIR)
X
X/**/#
X/**/#	generate C code for fallback resources
X/**/#
XXmon.ad.h: Xmon.ad
X	$(AD2C) Xmon.ad >Xmon.ad.h
X
Xclean::
X	$(RM) Xmon.ad.h
END_OF_FILE
if test 2053 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
# end of 'Imakefile'
fi
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(1750 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X CONTENTS                   1	List of files and directories
X Imakefile                  1	Imakefile for xmon distribution
X MANIFEST                   1	This file
X Makefile                   2	Derived Makefile
X README                     1	Disclaimer, overview and installation notes
X Xmon.ad                    2	Application defaults file
X app-resources.h            1	External definitions of the appResources
X images                     1	bitmap directory
X images/CONTENTS            1	contents of images directory
X images/icon-c.xbm          1	icon for .c files in xls
X images/icon-dir.xbm        1	icon for directories in xls
X images/icon-file.xbm       1	icon for generic files in xls
X images/icon-h.xbm          1	icon for .h files in xls
X images/icon-x.xbm          1	icon for executable files in xls
X images/nobody.xbm          1	default icon for xmon
X translate.c                1	maps class names to Widget classes
X update.c                   2	runs updateCommand, memory management
X util                       1	utility programs directory
X util/CONTENTS              1	contents of util directory
X util/ad2c                  1	convert app-defaults file to C decls
X util/ad2c.sed              1	sed program for ad2c
X util/name2icon             1	map file names to icon names for xls
X util/rf-awk                1	list "free" machines (like rf(1))
X util/ru-awk                1	list users on the network (like ru(1))
X util/xls-cmd               1	launch a file for xls
X xmon.c                     3	main, initialization, widget creation
X xmon.h                     1	shared variables and declarations
X xmon.man                   3	man page source
END_OF_FILE
if test 1750 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(6499 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X		README for XMON - Graphically monitor a list
X
X		 George Ferguson, ferguson at cs.rochester.edu
X
X			      7 Aug 1990
X
XDISCLAIMER:
X
X     This is an ALPHA release. While it has been in use for some time
X     at our site, there are certainly many bugs left to find.
X
X     This software is provided as is with no warranty expressed or implied.
X     I hope you find it useful, but I won't be held responsable for
X     any damage that may occur from reading, compiling, installing or
X     using it.
X
X     You are free to use any part of this code for other purposes. It
X     would be nice if you could keep my name on some part of whatever the
X     final product is.
X
X     Note: This program is similar in functionality to the Faceserver
X     program posted to the net previously. (Actually I don't know that
X     since I never saw it run, only read the documentation.) Xmon is
X     a much less ambitious program whose purpose was to (a) provide some
X     useful tools, and (b) produce code that could by used to simplify
X     future X projects. No infringement on the Faceserver code is
X     intended, and I hope none is perceived.
X
XOVERVIEW:
X
X     Xmon is a program which monitors a list and displays its contents
X     graphically in an X window. The list is usually generated by a
X     command and the updates performed at regular intervals. Xmon is
X     built using the Athena widgets. The icons to be displayed are
X     standard X bitmap files (32x32 size normally) which can be created
X     with the "bitmap" program as documented in the man page.
X
X     Xmon by itself is not very interesting, but using xmon as a core we
X     have built more useful tools including: xru (monitor users), xrf
X     (monitor machines), xls (directory browser), and xfrom (monitor
X     mailbox). These specializations are performed using Athena widget
X     resources.
X
X     This distribution includes code that can easily be used for other
X     X applications. In particular, translate.c implements a mapping
X     between class names and Widget classes which, together with the function
X     initWidgets() in xmon.c, implements dynamic creation of all the widgets
X     in an application for complete "customizability".
X
X     Many utility programs are included in this distribution, including
X     ad2c (convert app-defaults files to C declarations), ru-awk and rf-awk
X     (filters for rwho and ruptime), and some other stuff in the util
X     directory.
X
XPRINCIPLES OF OPERATION:
X
X     This is my feeble attempt to explain how the code works so that those
X     who want to customize it at either the C code or resource levels can
X     do so.
X
X     The basic principle is that xmon (or whatever derived program in class
X     Xmon) runs the command specified by the updateCommand resource at a
X     rate given by the updateInterval resource. The output is gathered and
X     if the nameCommand resourec is non-NULL it is piped through that command.
X     The first word of each line of the result used as the name of an icon
X     to look for in the directory given by the faceDirectory resource. If
X     it is not found then a default icon is used. The icons are displayed
X     in a Box widget (by default, and I don't see why you'd change it).
X
X     In order to speed things up, xmon caches both Widgets and Bitmaps,
X     the former to prevent extra calls to XtCreateManagedWidget() and the
X     latter to avoid extra XReadBitmapFromFile() calls. There is a
X     translation action (xmon-reinit()) which clears the cache.
X
X     The anticipated most common usage is to click on a "face". By default
X     this puts the entire line of text from the updateCommand into the
X     infoLabel widget. Xmon allows you complete control over what widgets you
X     want. In particular, you can create buttons which use information from
X     the currently selected "face" to create a command to execute. This is
X     provided by the xmon-cmd() translation action which is fully documented
X     in the man page. Some other actions are also provided, see the man page.
X
XINSTALLATION:
X
X     1. Edit the Imakefile to reflect any changes for your site. These
X	include setting BINDIR, LIBDIR, and MANDIR if needed, and
X	checking CDEBUGFLAGS if debugging or optimization is desired.
X
X	The variable FACEDIR should be where the face icons will live
X	and should be the same as the entry for Xmon.faceDirectory in
X	Xmon.ad. The directory will be created if necessary.
X
X	The variable XMONDIR should be where any utility programs will
X	live, and will also be created if necessary.
X
X	If you want to use any of the utility programs like ru-awk, rf-awk,
X	name2icon or xls-cmd, make sure that the definition of UTIL includes
X	the ones you want so they will be installed correctly.
X
X	If you've installed "ad2c" you may want to change the declaration
X	of AD2C.
X
X	See the comment concerning the derived tools under (4) below.
X
X     2. Edit Xmon.ad as well, checking especially the entries for
X		Xmon.faceDirectory
X		*.updateCommand
X		*.nameCommand
X	You may also want to change other defaults; consult the man page for
X	details. Note that the application-defaults file contains the defaults
X	for the entire Xmon _class_ of programs, which includes xru, xrf, xls
X	and xfrom, so be sure to check the whole file for necessary changes.
X
X	If you use the utility program "xls-cmd" (in the util directory),
X	edit it so that the xmon executable is properly found. You may not
X	need a full path if xmon lives in a standard directory. The utility
X	program "name2icon" is used in the xls.nameCommand resource; it
X	should be edited to reflect your installation (use XMONDIR).
X
X	The FILES section of the man page xmon.man should be edited to reflect
X	the locations of the various files.
X
X     2. Execute
X		% xmkmf
X	to create the Makefile.
X
X     3. Execute
X		% make depend
X	to add the dependencies to the Makefile. This is necessary to
X	ensure that Xmon.ad.h is created when needed.
X	IMPORTANT: Ignore the error message from makedepend when Xmon.ad.h
X		   is not found; it will be created automatically.
X
X     4. Make the package using
X		% make
X	or install it directly with
X		% make install install.man
X	The default installation will create symbolic links for xru, xrf,
X	xls and xfrom in BINDIR. Alternatively you can achieve this effect by
X	invoking xmon with the "-name" option, either from an alias or a
X	shell script, as described in the man page. You can install shell
X	scripts automatically by editing the Imakefile; see the comments
X	above the "install::" target.
X
X
END_OF_FILE
if test 6499 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'app-resources.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'app-resources.h'\"
else
echo shar: Extracting \"'app-resources.h'\" \(775 characters\)
sed "s/^X//" >'app-resources.h' <<'END_OF_FILE'
X/*
X *	app-resources.h : External definitions for access to the application
X *		      resources.
X *
X *	George Ferguson, ferguson at cs.rochester.edu,  4 May 1990.
X *
X *	$Id: app-resources.h,v 1.2 90/08/07 10:01:52 ferguson Exp $
X *
X */
X#include <X11/cursorfont.h>
X
X#define SMALLFONT "-adobe-courier-medium-r-normal--8-80-75-75-m-50-iso8859-1"
X#define FACEDIR "/u/ferguson/lib/images"
X#define UPDATECOMMAND "/usr/grads/bin/ru -b0"
X#define UPDATECURSOR "watch"
X
Xtypedef struct {
X    Boolean addNames;
X    Boolean opaqueNames;
X    Font smallFont;
X    int updateInterval;
X    String faceDirectory;
X    String updateCommand;
X    Cursor updateCursor;
X    String nameCommand;
X    Boolean debug;
X    String revision;
X    String widgets;
X} AppResources;
Xextern AppResources appResources;
END_OF_FILE
if test 775 -ne `wc -c <'app-resources.h'`; then
    echo shar: \"'app-resources.h'\" unpacked with wrong size!
fi
# end of 'app-resources.h'
fi
if test ! -d 'images' ; then
    echo shar: Creating directory \"'images'\"
    mkdir 'images'
fi
if test -f 'images/CONTENTS' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'images/CONTENTS'\"
else
echo shar: Extracting \"'images/CONTENTS'\" \(283 characters\)
sed "s/^X//" >'images/CONTENTS' <<'END_OF_FILE'
XCONTENTS of xmon/images:
Xicon-c.xbm			- icon for .c files in xls
Xicon-dir.xbm			- icon for directories in xls
Xicon-file.xbm			- icon for generic files in xls
Xicon-h.xbm			- icon for .h files in xls
Xicon-x.xbm			- icon for executable files in xls
Xnobody.xbm			- default icon for xmon
END_OF_FILE
if test 283 -ne `wc -c <'images/CONTENTS'`; then
    echo shar: \"'images/CONTENTS'\" unpacked with wrong size!
fi
# end of 'images/CONTENTS'
fi
if test -f 'images/icon-c.xbm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'images/icon-c.xbm'\"
else
echo shar: Extracting \"'images/icon-c.xbm'\" \(866 characters\)
sed "s/^X//" >'images/icon-c.xbm' <<'END_OF_FILE'
X#define c_width 32
X#define c_height 32
Xstatic char c_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x80, 0x00, 0xa0, 0x00,
X   0x80, 0x1e, 0x20, 0x01, 0x80, 0x00, 0xe0, 0x01, 0x80, 0x1e, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x0e, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0xf8, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0xf8, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0xe0, 0x03, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0xe0, 0x0f, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x38, 0x00, 0x01, 0x80, 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 866 -ne `wc -c <'images/icon-c.xbm'`; then
    echo shar: \"'images/icon-c.xbm'\" unpacked with wrong size!
fi
# end of 'images/icon-c.xbm'
fi
if test -f 'images/icon-dir.xbm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'images/icon-dir.xbm'\"
else
echo shar: Extracting \"'images/icon-dir.xbm'\" \(872 characters\)
sed "s/^X//" >'images/icon-dir.xbm' <<'END_OF_FILE'
X#define dir_width 32
X#define dir_height 32
Xstatic char dir_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00,
X   0x10, 0x08, 0x00, 0x00, 0x10, 0xf8, 0xff, 0x07, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
X   0xe0, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 872 -ne `wc -c <'images/icon-dir.xbm'`; then
    echo shar: \"'images/icon-dir.xbm'\" unpacked with wrong size!
fi
# end of 'images/icon-dir.xbm'
fi
if test -f 'images/icon-file.xbm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'images/icon-file.xbm'\"
else
echo shar: Extracting \"'images/icon-file.xbm'\" \(890 characters\)
sed "s/^X//" >'images/icon-file.xbm' <<'END_OF_FILE'
X#define icon_file_width 32
X#define icon_file_height 32
Xstatic char icon_file_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x80, 0x00, 0xa0, 0x00,
X   0x80, 0x00, 0x20, 0x01, 0x80, 0x00, 0xe0, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 890 -ne `wc -c <'images/icon-file.xbm'`; then
    echo shar: \"'images/icon-file.xbm'\" unpacked with wrong size!
fi
# end of 'images/icon-file.xbm'
fi
if test -f 'images/icon-h.xbm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'images/icon-h.xbm'\"
else
echo shar: Extracting \"'images/icon-h.xbm'\" \(866 characters\)
sed "s/^X//" >'images/icon-h.xbm' <<'END_OF_FILE'
X#define h_width 32
X#define h_height 32
Xstatic char h_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x80, 0x00, 0xa0, 0x00,
X   0x80, 0x1e, 0x20, 0x01, 0x80, 0x00, 0xe0, 0x01, 0x80, 0x1e, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x1e, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x1a, 0x0b, 0x01, 0x80, 0xaa, 0x08, 0x01, 0x80, 0x2a, 0x1b, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x1e, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x1e, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x1e, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 866 -ne `wc -c <'images/icon-h.xbm'`; then
    echo shar: \"'images/icon-h.xbm'\" unpacked with wrong size!
fi
# end of 'images/icon-h.xbm'
fi
if test -f 'images/icon-x.xbm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'images/icon-x.xbm'\"
else
echo shar: Extracting \"'images/icon-x.xbm'\" \(866 characters\)
sed "s/^X//" >'images/icon-x.xbm' <<'END_OF_FILE'
X#define x_width 32
X#define x_height 32
Xstatic char x_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x4c, 0x25, 0x01, 0x80, 0x54, 0x2d, 0x01,
X   0x80, 0x4c, 0x35, 0x01, 0x80, 0xd4, 0x25, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x88, 0x0e, 0x01, 0x80, 0xd8, 0x02, 0x01, 0x80, 0xa8, 0x06, 0x01,
X   0x80, 0x88, 0x0e, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01,
X   0x80, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 866 -ne `wc -c <'images/icon-x.xbm'`; then
    echo shar: \"'images/icon-x.xbm'\" unpacked with wrong size!
fi
# end of 'images/icon-x.xbm'
fi
if test -f 'images/nobody.xbm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'images/nobody.xbm'\"
else
echo shar: Extracting \"'images/nobody.xbm'\" \(881 characters\)
sed "s/^X//" >'images/nobody.xbm' <<'END_OF_FILE'
X#define nobody_width 32
X#define nobody_height 32
Xstatic char nobody_bits[] = {
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x1b, 0x00,
X   0x00, 0x40, 0x12, 0x00, 0x00, 0x20, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x20, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00,
X   0x00, 0x20, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0xc8, 0x26, 0x00,
X   0x00, 0xc8, 0x26, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00,
X   0x00, 0x88, 0x23, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00,
X   0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
END_OF_FILE
if test 881 -ne `wc -c <'images/nobody.xbm'`; then
    echo shar: \"'images/nobody.xbm'\" unpacked with wrong size!
fi
# end of 'images/nobody.xbm'
fi
if test -f 'translate.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'translate.c'\"
else
echo shar: Extracting \"'translate.c'\" \(2126 characters\)
sed "s/^X//" >'translate.c' <<'END_OF_FILE'
X/*
X *	translate.c : Map class names to classes. This code is
X *		      totally self-contained. A smaller executable
X *		      might result from only including the classes
X *		      an application needs.
X *
X *      George Ferguson, ferguson at cs.rochester.edu, 15 Jul 1990.
X *
X *	$Id: translate.c,v 1.2 90/08/07 10:01:49 ferguson Exp $
X */
X#include <X11/Intrinsic.h>
X#include <X11/StringDefs.h>
X#include <X11/Xaw/Command.h>
X#include <X11/Xaw/Grip.h>
X#include <X11/Xaw/Label.h>
X#include <X11/Xaw/List.h>
X#include <X11/Xaw/Scrollbar.h>
X#include <X11/Xaw/StripChart.h>
X#include <X11/Xaw/Toggle.h>
X#include <X11/Xaw/SimpleMenu.h>
X#include <X11/Xaw/SmeBSB.h>
X#include <X11/Xaw/SmeLine.h>
X#include <X11/Xaw/MenuButton.h>
X#include <X11/Xaw/AsciiText.h>
X#include <X11/Xaw/Box.h>
X#include <X11/Xaw/Dialog.h>
X#include <X11/Xaw/Form.h>
X#include <X11/Xaw/Paned.h>
X#include <X11/Xaw/Viewport.h>
X#include <X11/Shell.h>
X
Xstatic struct tableRec {
X	char *name;
X	WidgetClass *class;
X	Boolean isShell;
X} table[] = {
X	{ "Command",	&commandWidgetClass,	False },
X	{ "Grip",	&gripWidgetClass,	False },
X	{ "Label",	&labelWidgetClass,	False },
X	{ "List",	&listWidgetClass,	False },
X	{ "Scrollbar",	&scrollbarWidgetClass,	False },
X	{ "StripChart",	&stripChartWidgetClass,	False },
X	{ "Toggle",	&toggleWidgetClass,	False },
X	{ "SimpleMenu",	&simpleMenuWidgetClass,	True },
X	{ "SmeBSB",	&smeBSBObjectClass,	False },
X	{ "SmeLine",	&smeLineObjectClass,	False },
X	{ "MenuButton",	&menuButtonWidgetClass,	False },
X	{ "AsciiText",	&asciiTextWidgetClass,	False },
X	{ "Box",	&boxWidgetClass,	False },
X	{ "Dialog",	&dialogWidgetClass,	False },
X	{ "Form",	&formWidgetClass,	False },
X	{ "Paned",	&panedWidgetClass,	False },
X	{ "Viewport",	&viewportWidgetClass,	False },
X	{ "TransientShell", &transientShellWidgetClass, True },
X	{ "ApplicationShell", &applicationShellWidgetClass, True },
X};
X
XWidgetClass
XclassNameToWidgetClass(name,isShell)
Xchar *name;
XBoolean *isShell;
X{
X    int i;
X
X    for (i=0; i < XtNumber(table); i++)
X	if (strcmp(name,table[i].name) == 0) {
X	    *isShell = table[i].isShell;
X	    return(*(table[i].class));
X	}
X    return((WidgetClass)NULL);
X}
END_OF_FILE
if test 2126 -ne `wc -c <'translate.c'`; then
    echo shar: \"'translate.c'\" unpacked with wrong size!
fi
# end of 'translate.c'
fi
if test ! -d 'util' ; then
    echo shar: Creating directory \"'util'\"
    mkdir 'util'
fi
if test -f 'util/CONTENTS' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'util/CONTENTS'\"
else
echo shar: Extracting \"'util/CONTENTS'\" \(336 characters\)
sed "s/^X//" >'util/CONTENTS' <<'END_OF_FILE'
XCONTENTS of xmon/util:
Xad2c		Convert app-defaults file to C string declarations.
Xad2c.sed	Sed program for ad2c.
Xname2icon	Map file names to icon names for xls.
Xrf-awk		List "free" machines (for sites without rf(1)).
Xru-awk		List users on the network (for sites without ru(1)).
Xxls-cmd		Launch a file (ie. cd, exec, or page it) for xls.
END_OF_FILE
if test 336 -ne `wc -c <'util/CONTENTS'`; then
    echo shar: \"'util/CONTENTS'\" unpacked with wrong size!
fi
# end of 'util/CONTENTS'
fi
if test -f 'util/ad2c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'util/ad2c'\"
else
echo shar: Extracting \"'util/ad2c'\" \(186 characters\)
sed "s/^X//" >'util/ad2c' <<'END_OF_FILE'
X#!/bin/csh
X#
X#	ad2c : convert app-defaults file to C strings decls.
X#
X#	If you install this be sure to change the filename of the sed
X#	program (ad2c.sed).
X#
X
Xsed -n -f util/ad2c.sed $*
END_OF_FILE
if test 186 -ne `wc -c <'util/ad2c'`; then
    echo shar: \"'util/ad2c'\" unpacked with wrong size!
fi
chmod +x 'util/ad2c'
# end of 'util/ad2c'
fi
if test -f 'util/ad2c.sed' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'util/ad2c.sed'\"
else
echo shar: Extracting \"'util/ad2c.sed'\" \(470 characters\)
sed "s/^X//" >'util/ad2c.sed' <<'END_OF_FILE'
X#
X#	Convert app-defaults file to C strings decls.
X#
X#	Invoke by: sed -n -f ad2c.sed
X#
X: read
X# remove comments
X/^!/d
X# remove blanks
X/^$/d
X# escape quotes
Xs/"/\\"/g
X# escape backslash
Xs/\\/\\\\/g
X# except the line continuation ones
Xs/\\$//g
X# add leading quote
Xs/^/"/
X#
X: test
X/\\$/b slash
Xs/$/",/
Xp
Xn
Xb read
X#
X: slash
Xp
Xn
X# just like "read" only doesn't add leading quote
X/^!/d
X/^$/d
Xs/"/\\"/g
Xs/\\\\/\\/g
Xs/\\n/\\\\n/g
Xs/\\t/\\\\t/g
Xs/\\f/\\\\f/g
Xs/\\b/\\\\b/g
Xb test
END_OF_FILE
if test 470 -ne `wc -c <'util/ad2c.sed'`; then
    echo shar: \"'util/ad2c.sed'\" unpacked with wrong size!
fi
# end of 'util/ad2c.sed'
fi
if test -f 'util/name2icon' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'util/name2icon'\"
else
echo shar: Extracting \"'util/name2icon'\" \(370 characters\)
sed "s/^X//" >'util/name2icon' <<'END_OF_FILE'
X#!/bin/sh
X#
X#	name2icon : Convert filenames to icon names for xls.
X#
X#	George Ferguson, ferguson at cs.rcohester.edu, 8 Aug 1990.
X#
X
Xwhile read name
Xdo
X    case "$name" in
X	*.c) echo "icon-c" ;;
X	*.h) echo "icon-h" ;;
X	*) if test -d "$name" ; then
X	        echo "icon-dir"
X	   elif test -x "$name" ; then
X		echo "icon-x"
X	   else
X		echo "icon-file"
X	   fi ;;
X    esac
Xdone
END_OF_FILE
if test 370 -ne `wc -c <'util/name2icon'`; then
    echo shar: \"'util/name2icon'\" unpacked with wrong size!
fi
chmod +x 'util/name2icon'
# end of 'util/name2icon'
fi
if test -f 'util/rf-awk' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'util/rf-awk'\"
else
echo shar: Extracting \"'util/rf-awk'\" \(363 characters\)
sed "s/^X//" >'util/rf-awk' <<'END_OF_FILE'
X#!/bin/sh
X#
X#	rf-awk : Use awk to approximate rf output.
X#		 That is, it prints the output of ruptime(1) for
X#		 any machine with no non-idle users logged in.
X#		 This program works with "ruptime.c 1.10 88/02/08 SMI"
X#		 as reported by what(1) under SunOS4.0.3c.
X#
X#	George Ferguson, ferguson at cs.rochester.edu, 7 Aug 1990.
X#
X
Xruptime | awk '$4 == "0" {print $0}'
END_OF_FILE
if test 363 -ne `wc -c <'util/rf-awk'`; then
    echo shar: \"'util/rf-awk'\" unpacked with wrong size!
fi
chmod +x 'util/rf-awk'
# end of 'util/rf-awk'
fi
if test -f 'util/ru-awk' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'util/ru-awk'\"
else
echo shar: Extracting \"'util/ru-awk'\" \(882 characters\)
sed "s/^X//" >'util/ru-awk' <<'END_OF_FILE'
X#!/bin/sh
X#
X#	ru-awk : Use awk to approximate ru output.
X#		 That is, it prints one line per user listing the
X#		 user name, shortest idle time of any login, and
X#		 all machines which the user is logged into.
X#		 This program works with "rwho.c 1.10 88/02/08 SMI"
X#		 as reported by what(1) under SunOS4.0.3c.
X#
X#	George Ferguson, ferguson at cs.rochester.edu, 7 Aug 1990.
X#
X
Xrwho | awk '
X
XBEGIN		{ lastu = lastm = list = ""
X		}
X$1 != lastu	{ if (lastu != "")
X		      printf "%-10s 0%s %s\n",lastu,idle,list
X		  lastu = $1
X		  lastm = list = ""
X		  if (NF < 6)
X		      idle = ":00"
X		  else
X		      idle = $6
X		}
X$1 == lastu	{ split($2,m,":")
X		  if (m[1] != lastm) {
X		      list = list " " m[1]
X		      lastm = m[1]
X		  }
X		  if (NF < 6)
X		      idle = ":00"
X		  else if ($6 < idle)
X		      idle = $6
X		}
XEND		{ if (lastu != "")
X		      printf "%-10s 0%s %s\n",lastu,idle,list
X		}'
END_OF_FILE
if test 882 -ne `wc -c <'util/ru-awk'`; then
    echo shar: \"'util/ru-awk'\" unpacked with wrong size!
fi
chmod +x 'util/ru-awk'
# end of 'util/ru-awk'
fi
if test -f 'util/xls-cmd' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'util/xls-cmd'\"
else
echo shar: Extracting \"'util/xls-cmd'\" \(505 characters\)
sed "s/^X//" >'util/xls-cmd' <<'END_OF_FILE'
X#!/bin/sh
X#
X#	xls-cmd : Do the right thing to "launch" from xls.
X#		  That is, if it's a directory launch a new xls,
X#		  if it's executable run it, otherwise page it in
X#		  an xterm.
X#
X#	George Ferguson, ferguson at cs.rochester.edu, 8 Aug 1990.
X#
X
X# where does xmon live (full path may not be needed)
Xxmon=/u/ferguson/bin/sparc/xmon
X
Xif test -d "$1" ; then
X    cd "$1" ; $xmon -title `pwd` -name xls
Xelif test -x "$1" ; then
X    exec "$1"
Xelse
X    xterm -title "${PAGER:-more} $1" -e ${PAGER:-more} $1
Xfi
END_OF_FILE
if test 505 -ne `wc -c <'util/xls-cmd'`; then
    echo shar: \"'util/xls-cmd'\" unpacked with wrong size!
fi
chmod +x 'util/xls-cmd'
# end of 'util/xls-cmd'
fi
if test -f 'xmon.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xmon.h'\"
else
echo shar: Extracting \"'xmon.h'\" \(277 characters\)
sed "s/^X//" >'xmon.h' <<'END_OF_FILE'
X/*
X *	xmon.h : Global definitions
X *
X *      George Ferguson, ferguson at cs.rochester.edu, 15 Jul 1990.
X *
X *	$Id: xmon.h,v 1.2 90/08/07 19:20:52 ferguson Exp $
X */
X
Xextern void fail(/* fmt,arg */);
X
Xextern Widget toplevel,faceBox,radioGroup;
Xextern GC gc;
Xextern char *program;
END_OF_FILE
if test 277 -ne `wc -c <'xmon.h'`; then
    echo shar: \"'xmon.h'\" unpacked with wrong size!
fi
# end of 'xmon.h'
fi
echo shar: End of archive 1 \(of 3\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 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
-- 
George Ferguson			ARPA: ferguson at cs.rochester.edu
University of Rochester		UUCP: {decvax,rutgers}!rochester!ferguson
Rochester  NY  14627		VOX:  (716) 275-2527



More information about the Alt.sources mailing list