ferguson@cs.rochester.edu (George Ferguson) (08/29/90)
#! /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 2 (of 3)." # Contents: Makefile Xmon.ad update.c # Wrapped by ferguson@cyan.cs.rochester.edu on Tue Aug 28 16:40:50 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(10641 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# Makefile generated by imake - do not edit! X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $ X# X# The cpp used on this machine replaces all newlines and multiple tabs and X# spaces in a macro expansion with a single space. Imake tries to compensate X# for this, but is not always successful. X# X X########################################################################### X# Makefile generated from "Imake.tmpl" and <Imakefile> X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $ X# X# Platform-specific parameters may be set in the appropriate .cf X# configuration files. Site-wide parameters may be set in the file X# site.def. Full rebuilds are recommended if any parameters are changed. X# X# If your C preprocessor doesn't define any unique symbols, you'll need X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing X# "make Makefile", "make Makefiles", or "make World"). X# X# If you absolutely can't get imake to work, you'll need to set the X# variables at the top of each Makefile as well as the dependencies at the X# bottom (makedepend will do this automatically). X# X X########################################################################### X# platform-specific configuration parameters - edit sun.cf to change X X# platform: $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $ X# operating system: SunOS 4.0.3 X X########################################################################### X# site-specific configuration parameters - edit site.def to change X X# site: $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $ X X SHELL = /bin/sh X X TOP = . X CURRENT_DIR = . X X AR = ar cq X BOOTSTRAPCFLAGS = X CC = cc X X COMPRESS = compress X CPP = /lib/cpp $(STD_CPP_DEFINES) X PREPROCESSCMD = cc -E $(STD_CPP_DEFINES) X INSTALL = install X LD = ld X LINT = lint X LINTLIBFLAG = -C X LINTOPTS = -axz X LN = ln -s X MAKE = make X MV = mv X CP = cp X RANLIB = ranlib X RANLIBINSTFLAGS = X RM = rm -f X STD_INCLUDES = X STD_CPP_DEFINES = X STD_DEFINES = X EXTRA_LOAD_FLAGS = X EXTRA_LIBRARIES = X TAGS = ctags X X SHAREDCODEDEF = -DSHAREDCODE X SHLIBDEF = -DSUNSHLIB X X PROTO_DEFINES = X X INSTPGMFLAGS = X X INSTBINFLAGS = -m 0755 X INSTUIDFLAGS = -m 4755 X INSTLIBFLAGS = -m 0664 X INSTINCFLAGS = -m 0444 X INSTMANFLAGS = -m 0444 X INSTDATFLAGS = -m 0444 X INSTKMEMFLAGS = -g kmem -m 2755 X X DESTDIR = X X TOP_INCLUDES = -I$(INCROOT) X X CDEBUGFLAGS = -O X CCOPTIONS = X COMPATFLAGS = X X ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES) X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS) X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES) X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) X LDCOMBINEFLAGS = -X -r X X MACROFILE = sun.cf X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut X X IMAKE_DEFINES = X X IRULESRC = $(CONFIGDIR) X IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) X X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \ X $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \ X $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) X X########################################################################### X# X Window System Build Parameters X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ X X########################################################################### X# X Window System make variables; this need to be coordinated with rules X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $ X X PATHSEP = / X USRLIBDIR = /usr/staff/lib X BINDIR = /usr/staff/bin X INCROOT = /usr/staff/include X BUILDINCROOT = $(TOP) X BUILDINCDIR = $(BUILDINCROOT)/X11 X BUILDINCTOP = .. X INCDIR = $(INCROOT)/X11 X ADMDIR = /tmp X LIBDIR = $(USRLIBDIR)/X11 X CONFIGDIR = $(LIBDIR)/config X LINTLIBDIR = $(USRLIBDIR)/lint X X FONTDIR = $(LIBDIR)/fonts X XINITDIR = $(LIBDIR)/xinit X XDMDIR = $(LIBDIR)/xdm X AWMDIR = $(LIBDIR)/awm X TWMDIR = $(LIBDIR)/twm X GWMDIR = $(LIBDIR)/gwm X MANPATH = $(DESTDIR)/usr/staff/man X MANSOURCEPATH = $(MANPATH)/man X MANDIR = $(MANSOURCEPATH)1 X LIBMANDIR = $(MANSOURCEPATH)3 X XAPPLOADDIR = $(LIBDIR)/app-defaults XXFILESEARCHPATHDEFAULT = $(LIBDIR)/%L/%T/%N%S:$(LIBDIR)/%l/%T/%N%S:$(LIBDIR)/%T/%N%S X ERRORDB = $(LIBDIR)/XtErrorDB X X SOXLIBREV = 4.2 X SOXTREV = 4.0 X SOXAWREV = 4.0 X SOOLDXREV = 4.0 X SOXMUREV = 4.0 X SOXEXTREV = 4.0 X X FONTCFLAGS = -t X X INSTAPPFLAGS = $(INSTDATFLAGS) X X IMAKE = imake X DEPEND = makedepend X RGB = rgb X FONTC = bdftosnf X MKFONTDIR = mkfontdir X MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh X X CONFIGSRC = $(TOP)/config X CLIENTSRC = $(TOP)/clients X DEMOSRC = $(TOP)/demos X LIBSRC = $(TOP)/lib X FONTSRC = $(TOP)/fonts X INCLUDESRC = $(TOP)/X11 X SERVERSRC = $(TOP)/server X UTILSRC = $(TOP)/util X SCRIPTSRC = $(UTILSRC)/scripts X EXAMPLESRC = $(TOP)/examples X CONTRIBSRC = $(TOP)/../contrib X DOCSRC = $(TOP)/doc X RGBSRC = $(TOP)/rgb X DEPENDSRC = $(UTILSRC)/makedepend X IMAKESRC = $(CONFIGSRC) X XAUTHSRC = $(LIBSRC)/Xau X XLIBSRC = $(LIBSRC)/X X XMUSRC = $(LIBSRC)/Xmu X TOOLKITSRC = $(LIBSRC)/Xt X AWIDGETSRC = $(LIBSRC)/Xaw X OLDXLIBSRC = $(LIBSRC)/oldX X XDMCPLIBSRC = $(LIBSRC)/Xdmcp X BDFTOSNFSRC = $(FONTSRC)/bdftosnf X MKFONTDIRSRC = $(FONTSRC)/mkfontdir X EXTENSIONSRC = $(TOP)/extensions X X DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a X EXTENSIONLIB = -lXext X X DEPXLIB = $(DEPEXTENSIONLIB) X XLIB = $(EXTENSIONLIB) -lX11 X X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a X XAUTHLIB = -lXau X X DEPXMULIB = X XMULIB = -lXmu X X DEPOLDXLIB = X OLDXLIB = -loldX X X DEPXTOOLLIB = X XTOOLLIB = -lXt X X DEPXAWLIB = X XAWLIB = -lXaw X X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln X LINTXLIB = $(USRLIBDIR)/llib-lX11.ln X LINTXMU = $(USRLIBDIR)/llib-lXmu.ln X LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln X LINTXAW = $(USRLIBDIR)/llib-lXaw.ln X X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) X X DEPLIBS1 = $(DEPLIBS) X DEPLIBS2 = $(DEPLIBS) X DEPLIBS3 = $(DEPLIBS) X X########################################################################### X# Imake rules for building libraries, programs, scripts, and data files X# rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ X X########################################################################### X# start of Imakefile X X# X# Imakefile for xmon : Graphically monitor a list X# X# George Ferguson, ferguson@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 = /u/ferguson/bin/sparc XLIBDIR = /u/ferguson/lib XMANDIR = /u/ferguson/man/man1 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 = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) X#CDEBUGFLAGS = -g X XSRCS = xmon.c translate.c update.c XOBJS = xmon.o translate.o update.o XINCS = app-resources.h X X PROGRAM = xmon X Xall:: xmon X Xxmon: $(OBJS) $(DEPLIBS) X $(RM) $@ X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) X Xsaber_xmon: X #load $(ALLDEFINES) $(SRCS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) X Xosaber_xmon: X #load $(ALLDEFINES) $(OBJS) $(LOCAL_LIBRARIES) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) X Xinstall:: xmon X $(INSTALL) -c $(INSTPGMFLAGS) xmon $(BINDIR) X Xinstall.man:: xmon.man X $(INSTALL) -c $(INSTMANFLAGS) xmon.man $(MANDIR)/xmon.1 X Xdepend:: X $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) X Xlint: X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) Xlint1: X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) X Xclean:: X $(RM) $(PROGRAM) X Xinstall:: Xmon.ad X $(INSTALL) -c $(INSTAPPFLAGS) Xmon.ad $(XAPPLOADDIR)/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 for icon in `ls images 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 X X########################################################################### X# common rules for all Makefiles - do not edit X Xemptyrule:: X Xclean:: X $(RM_CMD) \#* X XMakefile:: X -@if [ -f Makefile ]; then \ X echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ X else exit 0; fi X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) X Xtags:: X $(TAGS) -w *.[ch] X $(TAGS) -xw *.[ch] > TAGS X Xsaber: X #load $(ALLDEFINES) $(SRCS) X Xosaber: X #load $(ALLDEFINES) $(OBJS) X X########################################################################### X# empty rules for directories that do not have SUBDIRS - do not edit X Xinstall:: X @echo "install in $(CURRENT_DIR) done" X Xinstall.man:: X @echo "install.man in $(CURRENT_DIR) done" X XMakefiles:: X Xincludes:: X X########################################################################### X# dependencies generated by makedepend X END_OF_FILE if test 10641 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'Xmon.ad' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Xmon.ad'\" else echo shar: Extracting \"'Xmon.ad'\" \(7699 characters\) sed "s/^X//" >'Xmon.ad' <<'END_OF_FILE' X! X! Xmon - Graphically monitor a list X! X! Includes defaults for xru and xrf. X! X! George Ferguson (ferguson@cs.rochester.edu), 6 May 1990. X! Improvements by: Cesar Quiroz (quiroz@cs.rochester.edu), 8 May 1990. X! Massive changes by: gf, 20 Jul 1990. X! X! $Id: Xmon.ad,v 1.5 90/08/21 11:11:21 ferguson Exp $ X! X X! This has must be the first line in the "official" app-defaults file. XXmon.revision: $Revision: 1.5 $ X X! X! Application defaults X! XXmon.addNames: False XXmon.opaqueNames: True XXmon.updateInterval: 60 XXmon.smallFont: -adobe-courier-medium-r-normal--8-80-75-75-m-50-iso8859-1 XXmon.faceDirectory: /u/ferguson/lib/images XXmon.updateCommand: whoami XXmon.debug: False X X! X! widgets to create (must include at least infoLabel and faceBox) X! XXmon.widgets: \ X Form form toplevel \n\ X Command quitButton form \n\ X Label infoLabel form \n\ X Viewport view form \n\ X Box faceBox form.view X X! X! Defaults for classes of widgets X! XXmon*Command*top: chainTop XXmon*Command*bottom: chainTop XXmon*Command*left: chainLeft XXmon*Command*right: chainLeft X X! X! Defaults for specific widgets X! XXmon*form.defaultDistance: 2 XXmon*form.borderWidth: 0 X XXmon*quitButton.label: Quit XXmon*quitButton.translations:#override\n\ X <Btn1Up>: xmon-quit() notify() unset()\n X XXmon*updateButton.label: Update XXmon*updateButton.fromHoriz: quitButton XXmon*updateButton.translations:#override\n\ X <Btn1Up>: xmon-update() notify() unset()\n X XXmon*reinitButton.label: Re-init XXmon*reinitButton.fromHoriz: updateButton XXmon*reinitButton.translations:#override\n\ X <Btn1Up>: xmon-reinit() notify() unset()\n X XXmon*infoLabel.label: -- Info shown here -- XXmon*infoLabel.width: 270 XXmon*infoLabel.fromVert: quitButton XXmon*infoLabel.top: chainTop XXmon*infoLabel.bottom: chainTop XXmon*infoLabel.left: chainLeft X X! X! Here's where the "faces" are displayed X! XXmon*view.allowVert: True XXmon*view.allowHoriz: False XXmon*view.width: 270 XXmon*view.height: 150 XXmon*view.fromVert: infoLabel XXmon*view.top: chainTop XXmon*view.left: chainLeft X XXmon*faceBox.orientation: orientVertical XXmon*faceBox.hSpace: 2 XXmon*faceBox.vSpace: 2 X X! X! All the "face" buttons X! XXmon*face.width: 34 XXmon*face.height: 34 XXmon*face.internalWidth: 1 XXmon*face.internalHeight: 1 XXmon*face.borderWidth: 0 XXmon*face.translations:#override\n\ X <Btn1Down>,<Btn1Up>: toggle() xmon-info() \n X X! - - - - - - - - - X! X! xru - Graphically display who's on the system X! X Xxru.updateCommand: /usr/grads/bin/ru -b0 X Xxru.widgets: \ X Form form toplevel \n\ X Command quitButton form \n\ X Command updateButton form \n\ X Command reinitButton form \n\ X Command talkButton form \n\ X Command fingerButton form \n\ X Command wButton form \n\ X Label infoLabel form \n\ X Viewport view form \n\ X Box faceBox form.view X X! quitButton, updateButton, and reinitButton use Xmon default X Xxru*talkButton.label: Talk Xxru*talkButton.fromHoriz: reinitButton Xxru*talkButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'talk $1@$3' -e talk $1@$3 &") unset()\n X Xxru*fingerButton.label: Finger Xxru*fingerButton.fromHoriz: talkButton Xxru*fingerButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'finger $1@$3' -e sh -c 'finger $1@$3|tr -d \\\\015 | less' &") unset()\n X Xxru*wButton.label: W Xxru*wButton.fromHoriz: fingerButton Xxru*wButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'w $3' -e sh -c 'rsh $3 w | less' &") unset()\n X Xxru*face.translations:#override\n\ X <Btn1Down>,<Btn1Up>: toggle() xmon-info() \n\ X <Key>T: set() xmon-info() \ X xmon-cmd("xterm -title 'talk $1@$3' -e talk $1@$3 &") \n\ X <Key>F: set() xmon-info() \ X xmon-cmd("xterm -title 'finger $1@$3' -e sh -c 'finger $1@$3|tr -d \\\\015 | less' &") \n\ X <Key>W: set() xmon-info() \ X xmon-cmd("xterm -title 'w $3' -e sh -c 'rsh $3 w | less' &")\n X X! - - - - - - - - - X! X! xrf - Graphically display free machines on the network X! X Xxrf.addNames: True Xxrf.updateInterval: 0 Xxrf.updateCommand: /usr/grads/bin/rf -m X Xxrf.widgets: \ X Form form toplevel \n\ X Command quitButton form \n\ X Command updateButton form \n\ X Command reinitButton form \n\ X Command rloginButton form \n\ X Command fingerButton form \n\ X Command wButton form \n\ X Label infoLabel form \n\ X Viewport view form \n\ X Box faceBox form.view X X! quitButton, updateButton, and reinitButton use Xmon default X Xxrf*rloginButton.label: Rlogin Xxrf*rloginButton.fromHoriz: reinitButton Xxrf*rloginButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title $1 -e rlogin $1 &") unset()\n X Xxrf*fingerButton.label: Finger Xxrf*fingerButton.fromHoriz: rloginButton Xxrf*fingerButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'finger @$1' -e sh -c 'finger @$1|tr -d \\\\015 | less' &") unset()\n X Xxrf*wButton.label: W Xxrf*wButton.fromHoriz: fingerButton Xxrf*wButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'w $1' -e sh -c 'rsh $1 w | less' &") unset()\n X Xxrf*face.translations:#override\n\ X <Btn1Down>,<Btn1Up>: toggle() xmon-info() \n\ X <Key>R: set() xmon-info() \ X xmon-cmd("xterm -title rlogin $1 -e rlogin $1 &") \n\ X <Key>F: set() xmon-info() \ X xmon-cmd("xterm -title 'finger @$1' -e sh -c 'finger @$1|tr -d \\\\015 | less' &") \n\ X <Key>W: set() xmon-info() \ X xmon-cmd("xterm -title 'w $1' -e sh -c 'rsh $1 w | less' &")\n X X! - - - - - - - - - X! X! xls - Graphically display files and directories X! X Xxls.addNames: True Xxls.updateInterval: 0 Xxls.updateCommand: /bin/ls -a Xxls.nameCommand: /u/ferguson/lib/xmon/name2icon X Xxls.widgets: \ X Form form toplevel \n\ X Command quitButton form \n\ X Command updateButton form \n\ X Command reinitButton form \n\ X Command cdButton form \n\ X Command lslButton form \n\ X Command fileButton form \n\ X Label infoLabel form \n\ X Viewport view form \n\ X Box faceBox form.view X X! quitButton, updateButton, and reinitButton use Xmon default X Xxls*cdButton.label: Cd Xxls*cdButton.fromHoriz: reinitButton Xxls*cdButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: xmon-cd() xmon-update() unset()\n X Xxls*lslButton.label: Ls-lg Xxls*lslButton.fromHoriz: cdButton Xxls*lslButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'ls -lg $1' -geometry 80x3 -e sh -c 'ls -lg $1 | less' &") unset()\n X Xxls*fileButton.label: File Xxls*fileButton.fromHoriz: lslButton Xxls*fileButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'file $1' -geometry 80x3 -e sh -c 'file $1 | less' &") unset()\n X Xxls*face.translations:#override\n\ X <Btn1Down>,<Btn1Up>: toggle() xmon-info() \n\ X <Btn2Down>,<Btn2Up>: \ X set() xmon-cmd("/u/ferguson/lib/xmon/xls-cmd $1 &") \n X X! - - - - - - - - - X! X! xfrom - Graphically display whom mail is from X! X Xxfrom.addNames: False Xxfrom.updateInterval: 120 Xxfrom.updateCommand: sed -n 's/^From \\([^ ]*\\)/\\1/p' /usr/spool/mail/$USER X Xxfrom.widgets: \ X Form form toplevel \n\ X Command quitButton form \n\ X Command updateButton form \n\ X Command reinitButton form \n\ X Command mailButton form \n\ X Command mailtoButton form \n\ X Label infoLabel form \n\ X Viewport view form \n\ X Box faceBox form.view X X! quitButton, updateButton, and reinitButton use Xmon default X Xxfrom*mailButton.label: Mail Xxfrom*mailButton.fromHoriz: reinitButton Xxfrom*mailButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'Mail' -e Mail &") unset()\n X Xxfrom*mailtoButton.label: Mail To Xxfrom*mailtoButton.fromHoriz: mailButton Xxfrom*mailtoButton.translations:#override\n\ X <Btn1Down>,<Btn1Up>: \ X xmon-cmd("xterm -title 'Mail $1' -e Mail $1 &") unset()\n END_OF_FILE if test 7699 -ne `wc -c <'Xmon.ad'`; then echo shar: \"'Xmon.ad'\" unpacked with wrong size! fi # end of 'Xmon.ad' fi if test -f 'update.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'update.c'\" else echo shar: Extracting \"'update.c'\" \(7966 characters\) sed "s/^X//" >'update.c' <<'END_OF_FILE' X/* X * update.c : Handles the bitmaps and runs the update command. X * This maintains caches of bitmaps and widgets to X * avoid calls to XReadBitmapFromFile() and X * XtCreateManagedWidget() on every update. X * X * George Ferguson, ferguson@cs.rochester.edu, 15 Jul 1990. X * X * $Id: update.c,v 1.5 90/08/21 11:36:56 ferguson Exp $ X */ X#include <stdio.h> X#include <ctype.h> X#include <sys/param.h> X#include <X11/Intrinsic.h> X#include <X11/StringDefs.h> X#include <X11/Xaw/Toggle.h> X#include <X11/Xaw/Cardinals.h> X#include "app-resources.h" X#include "xmon.h" X X/* X * Functions defined X */ Xvoid initMemory(),clearBitmapCache(),updateFaces(); Xchar *getTextFromWidget(); Xstatic void openNameCommand(),convertNameToFile(),closeNameCommand(); Xstatic Pixmap lookupBitmap(); X X/* X * The widget cache: X */ Xtypedef struct _CachedWidgetRec { X char *text; X Widget widget; X struct _CachedWidgetRec *next; X} CachedWidgetRec; Xstatic CachedWidgetRec *widgetRecs; X X/* X * The pixmap cache: X */ Xtypedef struct _CachedBitmapRec { X char *user; X Pixmap pixmap; X struct _CachedBitmapRec *next; X} CachedBitmapRec; Xstatic CachedBitmapRec *bitmapRecs; X X/* - - - - - - - - */ X Xvoid XinitMemory() X{ X widgetRecs = NULL; X radioGroup = NULL; X bitmapRecs = NULL; X} X Xvoid XclearBitmapCache() X{ X CachedBitmapRec *p,*q; X X p = bitmapRecs; X while (p != NULL) { X q = p->next; X XFreePixmap(XtDisplay(toplevel),p->pixmap); X XtFree(p->user); X XtFree(p); X p = q; X } X bitmapRecs = NULL; X} X X/* - - - - - - - - */ X/* X * updateFaces() : Redraw the face widgets. X */ Xvoid XupdateFaces() X{ X Arg args[2]; X FILE *fp; X CachedWidgetRec *p,*q; X char buf[256],user[256]; X int i; X X XDefineCursor(XtDisplay(toplevel),XtWindow(toplevel), X appResources.updateCursor); X XFlush(XtDisplay(toplevel)); X if (appResources.debug) X printf("updateCommand: \"%s\"\n",appResources.updateCommand); X fp = popen(appResources.updateCommand,"r"); X if (fp == NULL) { X fprintf(stderr,"%s: couldn't execute updateCommand \"%s\"\n", X program,appResources.updateCommand); X XUndefineCursor(XtDisplay(toplevel),XtWindow(toplevel)); X return; X } X p = widgetRecs; X q = NULL; X if (radioGroup != NULL) X XawToggleUnsetCurrent(radioGroup); X openNameCommand(); X while (!feof(fp)) { X if (fgets(buf,256,fp) == 0) X break; X if (buf[strlen(buf)-1] == '\n') X buf[strlen(buf)-1] = '\0'; X else { X fprintf(stderr,"%s: line too long: %s...\n",program,buf); X while (!feof(fp) && fgetc(fp) != '\n') ; X } X i = 0; X for (i=0; i < 255 && buf[i] && !isspace(buf[i]); i++) X user[i] = buf[i]; X user[i] = '\0'; X if (p == NULL) { X if (q == NULL) X p = widgetRecs = XtNew(CachedWidgetRec); X else X p = q->next = XtNew(CachedWidgetRec); X p->next = NULL; X p->text = NULL; X XtSetArg(args[0],XtNmappedWhenManaged,False); X p->widget = XtCreateManagedWidget("face",toggleWidgetClass, X faceBox,args,ONE); X if (radioGroup == NULL) X radioGroup = p->widget; X XtSetArg(args[0],XtNradioData,p->widget); X XtSetValues(p->widget,args,ONE); /* set XawToggleGetCurrent info*/ X XawToggleChangeRadioGroup(p->widget,radioGroup); X } X XtSetArg(args[0],XtNbitmap,lookupBitmap(user)); X XtSetValues(p->widget,args,ONE); /* set bitmap */ X XtFree(p->text); X p->text = XtNewString(buf); X XtMapWidget(p->widget); X q = p; X p = p->next; X } X closeNameCommand(); X pclose(fp); X while (p != NULL) { /* unmap leftover widgets */ X XtUnmapWidget(p->widget); X p = p->next; X } X XUndefineCursor(XtDisplay(toplevel),XtWindow(toplevel)); X XFlush(XtDisplay(toplevel)); X} X X/* - - - - - - - - */ X/* These functions map "user" names from the updateCommand into icon X * names using the nameCommand. We ignore the potential deadlock if 4K X * get into the pipes; it shouldn't happen with newline buffering. X */ X Xstatic FILE *writeFp,*readFp; X Xstatic void XopenNameCommand() X{ X int fd[4],pid; X X if (appResources.nameCommand == NULL) { X writeFp = readFp = NULL; X return; X } X if (appResources.debug) X printf("nameCommand: \"%s\"\n",appResources.nameCommand); X if (pipe(fd) < 0 || pipe(fd+2) < 0) { X fprintf(stderr,"%s: couldn't create pipes for nameCommand \"%s\"\n", X program,appResources.nameCommand); X writeFp = readFp = NULL; X return; X } X if ((pid=fork()) < 0) { /* error */ X fprintf(stderr,"%s: couldn't fork nameCommand \"%s\"\n",program, X appResources.nameCommand); X writeFp = readFp = NULL; X return; X } else if (pid == 0) { /* child */ X dup2(fd[0],0); X close(fd[1]); X close(fd[2]); X dup2(fd[3],1); X execlp(appResources.nameCommand,appResources.nameCommand,NULL); X fprintf(stderr,"%s: couldn't exec nameCommand \"%s\"\n",program, X appResources.nameCommand); X exit(-1); X } else { /* parent */ X close(fd[0]); X writeFp = fdopen(fd[1],"w"); X readFp = fdopen(fd[2],"r"); X close(fd[3]); X if (writeFp == NULL || readFp == NULL) { X fprintf(stderr,"%s: couldn't open pipes for nameCommand \"%s\"\n", X program,appResources.nameCommand); X writeFp = readFp = NULL; X } X } X} X Xstatic void XconvertNameToFile(user,icon,len) Xchar user[],icon[]; Xint len; X{ X char *strrchr(); X X if (writeFp == NULL) { X strncpy(icon,user,len); X return; X } X fputs(user,writeFp); X fputs("\n",writeFp); X fflush(writeFp); X fgets(icon,len,readFp); X if (strrchr(icon,'\n') != NULL) X *(strrchr(icon,'\n')) = '\0'; /* eat \n */ X} X Xstatic void XcloseNameCommand() X{ X if (writeFp == NULL) X return; X fclose(writeFp); X fclose(readFp); X wait(NULL); X} X X/* - - - - - - - - */ X/* Bitmap cache to avoid doing "XReadBitmapFromFile" on every update. X * Have to read file into a bitmap then copy to pixmap. Blech. X */ X Xstatic filename[MAXPATHLEN]; X Xstatic Pixmap XlookupBitmap(user) Xchar user[]; X{ X CachedBitmapRec *p,*q; X char icon[256]; X unsigned int w,h,d; X int x,y,flag; X Pixmap bitmap; X XCharStruct ch; X X for (p=bitmapRecs, q=NULL; p != NULL; q=p, p=p->next)/* check the cache */ X if (strcmp(p->user,user) == 0) /* hit */ X return(p->pixmap); /* so return it */ X if (q == NULL) { /* else new one */ X bitmapRecs = XtNew(CachedBitmapRec); /* this is first */ X q = bitmapRecs; X } else { X q->next = XtNew(CachedBitmapRec); /* else add to end */ X q = q->next; X } X q->next = NULL; X q->user = XtNewString(user); X flag = appResources.addNames; /* definitely add name? */ X convertNameToFile(user,icon,255); /* map to icon name */ X strcpy(filename,appResources.faceDirectory); X strcat(filename,"/"); X strncat(filename,icon,255-strlen(filename)); X if (XReadBitmapFile(XtDisplay(toplevel),XtWindow(toplevel),filename, X &w,&h,&bitmap,&x,&y) != BitmapSuccess) { X strcpy(filename,appResources.faceDirectory); X strcat(filename,"/nobody"); X if (XReadBitmapFile(XtDisplay(toplevel),XtWindow(toplevel),filename, X &w,&h,&bitmap,&x,&y) != BitmapSuccess) X fail("couldn't open default bitmap \"%s\"\n",filename); X flag = 1; /* always add name to default icon */ X } X q->pixmap = XCreatePixmap(XtDisplay(toplevel),XtWindow(toplevel),w,h, X PlanesOfScreen(XtScreen(toplevel))); X XCopyPlane(XtDisplay(toplevel),bitmap,q->pixmap,gc,0,0,w,h,0,0,1); X XFreePixmap(XtDisplay(toplevel),bitmap); X if (flag) { X XTextExtents(XQueryFont(XtDisplay(toplevel),appResources.smallFont), X user,strlen(user),&d,&x,&y,&ch); X x = ((int)w - ch.width)/2; X if (x < 1) x = 1; X y = h - 2; X if (appResources.opaqueNames) X XDrawImageString(XtDisplay(toplevel),q->pixmap,gc,x,y,user, X strlen(user)); X else X XDrawString(XtDisplay(toplevel),q->pixmap,gc,x,y,user,strlen(user)); X } X return(q->pixmap); X} X X/* - - - - - - - - */ X/* X * getTextFromWidget() : Return the text stored with the widget. X */ Xchar * XgetTextFromWidget(w) XWidget w; X{ X CachedWidgetRec *p; X X if (w == NULL) X return(NULL); X p = widgetRecs; X while (p != NULL) { X if (p->widget == w) X return(p->text); X else X p = p->next; X } X return(NULL); X} END_OF_FILE if test 7966 -ne `wc -c <'update.c'`; then echo shar: \"'update.c'\" unpacked with wrong size! fi # end of 'update.c' fi echo shar: End of archive 2 \(of 3\). cp /dev/null ark2isdone 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@cs.rochester.edu University of Rochester UUCP: {decvax,rutgers}!rochester!ferguson Rochester NY 14627 VOX: (716) 275-2527