[net.sources] MON - added screendump

long@ittvax.UUCP (12/21/84)

MON is a great help in system tuning.  Just added 2 commands :

	'l'	-	 screendump to line printer
	's'	-	 appends screendump to file 'screendump'

	Use 'patch' on this file.

				H. Morrow Long
				ITT-ATC Systems Center, Shelton, CT
	
path = {allegra bunker dcdvaxb dcdwest ucbvax!decvax duke eosp1 ittral
	lbl-csam mit-eddie psuvax1 purdue qubix qumix research sii
	tmmnet twg uf-cgrl wxlvax yale}!ittvax!long

diff -c src5/Makefile src/Makefile
*** src5/Makefile	Thu Dec 20 19:50:19 1984
--- src/Makefile	Thu Dec 20 20:20:04 1984
***************
*** 3,9
  #
  #  Beware dependencies on mon.h are not properly stated.
  #
! OBJS = mon.o io.o vm.o netif.o display.o readnames.o user_count.o
  
  all: mon
  

--- 3,10 -----
  #
  #  Beware dependencies on mon.h are not properly stated.
  #
! OBJS = mon.o io.o vm.o netif.o display.o readnames.o user_count.o \
! 	dumpit.o
  
  all: mon
  
***************
*** 14,17
  	rm -f core *.o mon a.out
  
  print:
! 	qpr mon.h mon.c io.c vm.c netif.c readnames.c display.c user_count.c

--- 15,19 -----
  	rm -f core *.o mon a.out
  
  print:
! 	qpr mon.h mon.c io.c vm.c netif.c readnames.c display.c user_count.c \
! 	dumpit.c
Only in src: dumpit.c
diff -c src5/mon.8b src/mon.8b
*** src5/mon.8b	Thu Dec 20 19:49:55 1984
--- src/mon.8b	Thu Dec 20 20:57:43 1984
***************
*** 117,122
  .s1
  Commands:
     ^L   repaints the screen.
      q   exits the program.
      Any other character will cause the screen to be updated (thus
          you can for example run "mon 100" and type single characters

--- 117,124 -----
  .s1
  Commands:
     ^L   repaints the screen.
+     l   dumps a copy of the screen to the lineprinter
+     s   saves (appends) a copy of the screen to file "screendump"
      q   exits the program.
      Any other character will cause the screen to be updated (thus
          you can for example run "mon 100" and type single characters
diff -c src5/mon.c src/mon.c
*** src5/mon.c	Thu Dec 20 19:50:26 1984
--- src/mon.c	Thu Dec 20 20:40:08 1984
***************
*** 131,140
          	i = select(2, &tin, (int *)0, (int *)0, &tintv);
          	if (i && tin) {
          		i = getchar();
!         		if (i == 12)
! 				dispinit();
!         		else if (i == 'q')
!         			done();
          	}
          }
  }

--- 131,162 -----
          	i = select(2, &tin, (int *)0, (int *)0, &tintv);
          	if (i && tin) {
          		i = getchar();
! 			switch(i)
! 				{
! 				FILE	*Outfile,*popen();
! 
! 				case 12:	/* ctl-L */
! 					dispinit();
! 					break;
!         			case 'l':
! 					Outfile = popen("lpr -Pip2","w");
! 					if (Outfile > 0 )
! 						{
! 						dumpit(Outfile);
! 						fclose(Outfile);
! 						}
! 					break;
!         			case 's':
! 					Outfile = fopen("screendump","a");
! 					if (Outfile > 0 )
! 						{
! 						dumpit(Outfile);
! 						fclose(Outfile);
! 						}
! 					break;
!         			case 'q':
!         				done();
! 				}
          	}
          }
  }
Only in src: screendump

long@ittvax.UUCP (12/21/84)

	Use '/bin/sh' on this file.

				H. Morrow Long
				ITT-ATC Systems Center, Shelton, CT
	
path = {allegra bunker dcdvaxb dcdwest ucbvax!decvax duke eosp1 ittral
	lbl-csam mit-eddie psuvax1 purdue qubix qumix research sii
	tmmnet twg uf-cgrl wxlvax yale}!ittvax!long

: --------------- cut here -----------------------------
: This is a shar archive.  Extract with sh, not csh.
: The rest of this file will extract:
: dumpit.c screendump
mkdir src
cd src
echo extracting - dumpit.c
sed 's/^X//' > dumpit.c << '/*EOF'
X#include <stdio.h>
X#include <curses.h>
X
X/*
X#define	winch(win)	 (win->_y[win->_cury][win->_curx] & 0177)
X */
X
Xint dumpit(Outfile)
XFILE	*Outfile;
X{
Xint	x,y;
Xchar	buffer[82];
X
X	for (y = 0; y < LINES - 1; y++)
X		{
X		strncpy(buffer,curscr->_y[y],80);
X		buffer[80] = '\n';
X		buffer[81] = '\0';
X		fputs(buffer,Outfile);
X		}
X}
/*EOF
echo extracting - screendump
sed 's/^X//' > screendump << '/*EOF'
Xittvax       0.00 2.32 2.29 2.18        Thu Dec 20 20:35:33 1984      3 users   
X                                                                                
XProcs: r d p s sl  Mem: real  ract  virt  vact  free   Disks: Kbps tps msps     
X       2 0 0 0  6       1625   879  5124  1164  1101   hp0       0   0  0.0     
X                                                       hp1       0   0  0.0     
XCpu: ints  scall  csw                Char: in   out    hp2       0   0  0.0     
X       36    301   25                     228   299    hp3       0   0  0.0     
X                                                       --------------------     
XTime: user nice  sys idle                              Total:    0   0          
X        27   38   35    0                                                       
X                                                                                
XPaging: re  at pin pout  oprs  fr  def   sr                                     
X         0   0   0    0     0   0    0    0                                     
X                                                                                
X       nxf  xf  nzf  zf  nrf  rf  prf  swi swo                                  
X         0   1    7   3    0   0    0    0   0                                  
X                                                                                
XName   Ipkts  Ierrs  Opkts  Oerrs Collis Oqueue                                 
Xlo0        0      0      0      0      0      0                                 
X                                                                                
X                                                                                
X                                                                                
X                                                                                
Xittvax       0.00 2.30 2.28 2.18        Thu Dec 20 20:35:37 1984      3 users   
X                                                                                
XProcs: r d p s sl  Mem: real  ract  virt  vact  free   Disks: Kbps tps msps     
X       2 0 0 0  6       1627   881  5132  1172  1089   hp0       0   0  0.0     
X                                                       hp1       0   0  0.0     
XCpu: ints  scall  csw                Char: in   out    hp2       0   0  0.0     
X       30    276   22                     231   296    hp3       0   0  0.0     
X                                                       --------------------     
XTime: user nice  sys idle                              Total:    0   0          
X        23   41   36    0                                                       
X                                                                                
XPaging: re  at pin pout  oprs  fr  def   sr                                     
X         0   0   0    0     0   0    0    0                                     
X                                                                                
X       nxf  xf  nzf  zf  nrf  rf  prf  swi swo                                  
X         0   0    3   0    0   0    0    0   0                                  
X                                                                                
XName   Ipkts  Ierrs  Opkts  Oerrs Collis Oqueue                                 
Xlo0        0      0      0      0      0      0                                 
X                                                                                
X                                                                                
X                                                                                
X                                                                                
Xittvax       0.00 2.27 2.28 2.18        Thu Dec 20 20:35:42 1984      3 users   
X                                                                                
XProcs: r d p s sl  Mem: real  ract  virt  vact  free   Disks: Kbps tps msps     
X       2 0 0 0  5       1627   878  5132  1150  1084   hp0       0   0  0.0     
X                                                       hp1       0   0  0.0     
XCpu: ints  scall  csw                Char: in   out    hp2       0   0  0.0     
X       34    269   21                     226   310    hp3       0   0  0.0     
X                                                       --------------------     
XTime: user nice  sys idle                              Total:    0   0          
X        31   38   32    0                                                       
X                                                                                
XPaging: re  at pin pout  oprs  fr  def   sr                                     
X         0   0   0    0     0   0    0    0                                     
X                                                                                
X       nxf  xf  nzf  zf  nrf  rf  prf  swi swo                                  
X         0   0    0   0    0   0    0    0   0                                  
X                                                                                
XName   Ipkts  Ierrs  Opkts  Oerrs Collis Oqueue                                 
Xlo0        0      0      0      0      0      0                                 
X                                                                                
X                                                                                
X                                                                                
X                                                                                
/*EOF
cd ..
exit 0