rsalz@bbn.com (Rich Salz) (11/27/90)
Submitted-by: Robert Ward <olsen!robert@uunet.uu.net> Posting-number: Volume 23, Issue 50 Archive-name: sps2/part04 #! /bin/sh # This is a shell archive. Remove anything before this line, then feed it # into a shell via "sh file" or similar. To overwrite existing files, # type "sh file -c". # The tool that generated this appeared in the comp.sources.unix newsgroup; # send mail to comp-sources-unix@uunet.uu.net if you want that tool. # Contents: Make.4.1 Make.4.2 Make.4.3 prcmd.c prheader.c printall.c # prsummary.c selecttty.c # Wrapped by rsalz@papaya.bbn.com on Mon Nov 26 14:03:25 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH echo If this archive is complete, you will see the following message: echo ' "shar: End of archive 4 (of 4)."' if test -f 'Make.4.1' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Make.4.1'\" else echo shar: Extracting \"'Make.4.1'\" \(882 characters\) sed "s/^X//" >'Make.4.1' <<'END_OF_FILE' X# Makefile for SPS (4.1BSD UNIX Version) X XPROG = sps XOBJS = filecount.o findtty.o flagdecode.o flagsetup.o \ X getcmd.o getupage.o globals1.o globals2.o hashuid.o \ X initialise.o initsymbols.o inittty.o main.o mktree.o \ X needed.o openfiles.o percentmem.o prcmd.o prcpu.o \ X prheader.o printall.o printproc.o prsummary.o readstatus.o \ X selectproc.o selecttty.o termwidth.o ttystatus.o waitingfor.o X XINCS = sps.h XLIBS = -ltermlib XCFLAGS = -I/usr/src/sys -DCHAOS X Xall: $(PROG) X.c.o: X cc $(CFLAGS) -c -O -R $< Xglobals1.o waitingfor.o: X cc $(CFLAGS) -c -O $< X X$(OBJS): $(INCS) X X$(PROG): $(OBJS) X cc -o $@ $(OBJS) $(LIBS) X Xinstall: $(PROG) X strip $(PROG) X mv $(PROG) /bin/$(PROG) X /etc/chown root /bin/$(PROG) X chmod 4711 /bin/$(PROG) X Xlint: X lint -x -b $(CFLAGS) *.c Xclean: X rm -f $(OBJS) $(PROG) END_OF_FILE if test 882 -ne `wc -c <'Make.4.1'`; then echo shar: \"'Make.4.1'\" unpacked with wrong size! fi # end of 'Make.4.1' fi if test -f 'Make.4.2' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Make.4.2'\" else echo shar: Extracting \"'Make.4.2'\" \(977 characters\) sed "s/^X//" >'Make.4.2' <<'END_OF_FILE' X# Makefile for SPS (Vax 4.2BSD and Ultrix1.2 UNIX Version) X XPROG = sps XOBJS = filecount.o findtty.o flagdecode.o flagsetup.o \ X getcmd.o getupage.o globals1.o globals2.o hashuid.o \ X initialise.o initsymbols.o inittty.o main.o mktree.o \ X needed.o openfiles.o percentmem.o prcmd.o prcpu.o \ X prheader.o printall.o printproc.o prsummary.o readstatus.o \ X selectproc.o selecttty.o termwidth.o ttystatus.o waitingfor.o XINCS = sps.h XCC = cc XCFLAGS = -DBSD42 -I/sys XLIBS = -ltermlib XDIRINSTALL = /bin X Xall: $(PROG) X.c.o: X $(CC) $(CFLAGS) -c -O -R $< X Xglobals1.o waitingfor.o: X $(CC) $(CFLAGS) -c -O $< X X$(OBJS): $(INCS) X X$(PROG): $(OBJS) X $(CC) -o $@ $(OBJS) $(LIBS) X Xinstall: $(PROG) X strip $(PROG) X mv $(PROG) $(DIRINSTALL)/$(PROG) X /etc/chown root $(DIRINSTALL)/$(PROG) X chgrp kmem $(DIRINSTALL)/$(PROG) X chmod 2755 $(DIRINSTALL)/$(PROG) X Xlint: X lint -x -b $(CFLAGS) *.c Xclean: X rm -f $(OBJS) $(PROG) END_OF_FILE if test 977 -ne `wc -c <'Make.4.2'`; then echo shar: \"'Make.4.2'\" unpacked with wrong size! fi # end of 'Make.4.2' fi if test -f 'Make.4.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Make.4.3'\" else echo shar: Extracting \"'Make.4.3'\" \(966 characters\) sed "s/^X//" >'Make.4.3' <<'END_OF_FILE' X# Makefile for SPS (Vax 4.3BSD Version) X XPROG = sps XOBJS = filecount.o findtty.o flagdecode.o flagsetup.o \ X getcmd.o getupage.o globals1.o globals2.o hashuid.o \ X initialise.o initsymbols.o inittty.o main.o mktree.o \ X needed.o openfiles.o percentmem.o prcmd.o prcpu.o \ X prheader.o printall.o printproc.o prsummary.o readstatus.o \ X selectproc.o selecttty.o termwidth.o ttystatus.o waitingfor.o XINCS = sps.h XCC = cc XCFLAGS = -DBSD42 -DBSD43 -I/sys XLIBS = -ltermlib XDIRINSTALL = /bin X Xall: $(PROG) X.c.o: X $(CC) $(CFLAGS) -c -O -R $< X Xglobals1.o waitingfor.o: X $(CC) $(CFLAGS) -c -O $< X X$(OBJS): $(INCS) X X$(PROG): $(OBJS) X $(CC) -o $@ $(OBJS) $(LIBS) X Xinstall: $(PROG) X strip $(PROG) X mv $(PROG) $(DIRINSTALL)/$(PROG) X /etc/chown root $(DIRINSTALL)/$(PROG) X chgrp kmem $(DIRINSTALL)/$(PROG) X chmod 2755 $(DIRINSTALL)/$(PROG) X Xlint: X lint -x -b $(CFLAGS) *.c Xclean: X rm -f $(OBJS) $(PROG) END_OF_FILE if test 966 -ne `wc -c <'Make.4.3'`; then echo shar: \"'Make.4.3'\" unpacked with wrong size! fi # end of 'Make.4.3' fi if test -f 'prcmd.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'prcmd.c'\" else echo shar: Extracting \"'prcmd.c'\" \(785 characters\) sed "s/^X//" >'prcmd.c' <<'END_OF_FILE' X# ifndef lint Xstatic char SccsId[] = "@(#)prcmd.c 1.1\t10/1/88" ; X# endif X X# include "sps.h" X# include "flags.h" X X/* PRCMD - Prints the command arguments according to the switches */ Xprcmd ( p, lpad, width ) X Xregister struct process *p ; Xint lpad ; Xint width ; X X{ X extern struct flags Flg ; X extern unsigned Termwidth ; X X printf( "%*d ", lpad, p->pr_p.p_pid ) ; X if ( Flg.flg_f ) X { X printf( "%5d ", p->pr_p.p_ppid ) ; X width -= 6 ; X } X if ( Flg.flg_g ) X { X printf( "%5d ", p->pr_p.p_pgrp ) ; X width -= 6 ; X } X width += Termwidth ; X if ( Flg.flg_w ) X printf( "%s\n", p->pr_cmd ) ; X else if ( width > 0 ) X printf( "%-.*s\n", width, p->pr_cmd ) ; X if ( p->pr_csaved ) X free( p->pr_cmd ) ; X} END_OF_FILE if test 785 -ne `wc -c <'prcmd.c'`; then echo shar: \"'prcmd.c'\" unpacked with wrong size! fi # end of 'prcmd.c' fi if test -f 'prheader.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'prheader.c'\" else echo shar: Extracting \"'prheader.c'\" \(683 characters\) sed "s/^X//" >'prheader.c' <<'END_OF_FILE' X# ifndef lint Xstatic char SccsId[] = "@(#)prheader.c 1.1\t10/1/88" ; X# endif X X# include "sps.h" X# include "flags.h" X X/* PRHEADER - Print a header according to the switches */ Xprheader () X{ X extern struct flags Flg ; X X printf( "Ty User %s Proc#", Flg.flg_v ? X# ifdef SUNOS40 X# ifdef OLDSTATS X " Status Fl Nice Virt Res %M Time Child %C" : X# else X " Status Fl Nice Prv Shr Res %M Time Child %C" : X# endif X# else X " Status Fl Nice Virtual Resident %M Time Child %C" : X# endif X Flg.flg_d ? X " Files PageFaults Swap BlockI/O Kbytsecs" : "" ) ; X if ( Flg.flg_f ) X printf( " Ppid#" ) ; X if ( Flg.flg_g ) X printf( " Pgrp#" ) ; X printf( " Command\n" ) ; X} END_OF_FILE if test 683 -ne `wc -c <'prheader.c'`; then echo shar: \"'prheader.c'\" unpacked with wrong size! fi # end of 'prheader.c' fi if test -f 'printall.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'printall.c'\" else echo shar: Extracting \"'printall.c'\" \(509 characters\) sed "s/^X//" >'printall.c' <<'END_OF_FILE' X# ifndef lint Xstatic char SccsId[] = "@(#)printall.c 1.1\t10/1/88" ; X# endif X X# include <stdio.h> X# include "sps.h" X X/* PRINTALL - Recursively print the process tree. */ Xprintall ( p, md ) X Xregister struct process *p ; Xregister int md ; X X{ X while ( p ) X { /* Print this process */ X printproc( p, md ) ; X (void)fflush( stdout ) ; X /* Print child processes */ X printall( p->pr_child, md+1 ) ; X /* Print brother processes */ X p = p->pr_sibling ; X } X} END_OF_FILE if test 509 -ne `wc -c <'printall.c'`; then echo shar: \"'printall.c'\" unpacked with wrong size! fi # end of 'printall.c' fi if test -f 'prsummary.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'prsummary.c'\" else echo shar: Extracting \"'prsummary.c'\" \(712 characters\) sed "s/^X//" >'prsummary.c' <<'END_OF_FILE' X# ifndef lint Xstatic char SccsId[] = "@(#)prsummary.c 1.1\t10/1/88" ; X# endif X X# include "sps.h" X X/* PRSUMMARY - Print the summarising information */ Xprsummary () X{ X extern struct summary Summary ; X X printf( X"%D (%Dk) processes, %D (%Dk) busy, %D (%Dk) loaded, %D (%Dk) swapped\n", X Summary.sm_ntotal, KBYTES( Summary.sm_ktotal ), X Summary.sm_nbusy, KBYTES( Summary.sm_kbusy ), X Summary.sm_nloaded, KBYTES( Summary.sm_kloaded ), X Summary.sm_nswapped, KBYTES( Summary.sm_kswapped ) ) ; X Summary.sm_ntotal = 0L ; X Summary.sm_ktotal = 0L ; X Summary.sm_nbusy = 0L ; X Summary.sm_kbusy = 0L ; X Summary.sm_nloaded = 0L ; X Summary.sm_kloaded = 0L ; X Summary.sm_nswapped = 0L ; X Summary.sm_kswapped = 0L ; X} END_OF_FILE if test 712 -ne `wc -c <'prsummary.c'`; then echo shar: \"'prsummary.c'\" unpacked with wrong size! fi # end of 'prsummary.c' fi if test -f 'selecttty.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'selecttty.c'\" else echo shar: Extracting \"'selecttty.c'\" \(448 characters\) sed "s/^X//" >'selecttty.c' <<'END_OF_FILE' X# ifndef lint Xstatic char SccsId[] = "@(#)selecttty.c 1.1\t10/1/88" ; X# endif X X# include "sps.h" X# include "flags.h" X X/* SELECTTTY - Decides whether this process is interesting for its tty */ Xselecttty ( p ) X Xregister struct process *p ; X X{ X register union flaglist *fp ; X extern struct flags Flg ; X X for ( fp = Flg.flg_Tlist ; fp->f_ttyline ; fp++ ) X if ( fp->f_ttyline == p->pr_tty ) X return ( 1 ) ; X return ( 0 ) ; X} END_OF_FILE if test 448 -ne `wc -c <'selecttty.c'`; then echo shar: \"'selecttty.c'\" unpacked with wrong size! fi # end of 'selecttty.c' fi echo shar: End of archive 4 \(of 4\). cp /dev/null ark4isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 archives. rm -f ark[1-9]isdone else echo You still must unpack the following archives: echo " " ${MISSING} fi exit 0 exit 0 # Just in case... -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.