More UUCP, but better by FARRRRRRRR! - (nf)

Spencer W. Thomas thomas at utah-gr.UUCP
Sun Nov 27 13:43:30 AEST 1983


I, too, noticed the "extra" field in the SYSLOG file.  But, two of our
systems are still running 4.1a, and the other two are running 4.2.  The
4.2 sites have the extra field (still don't know what it is...). 
Anyway, I decided to parametrize the whole thing.  Also fixed the bug
which deleted the last character of commands.  Contrary to the "warning"
in the original message, I haven't found it necessary to "clean up" the
files.   Here's my diff listing:

*** /tmp/,RCSt1020959	Sat Nov 26 22:39:20 1983 (ORIGINAL)
--- uucpanz.c	Tue Nov 22 11:25:01 1983
***************
*** 14,15
  
  #define	SYSLOG	"/usr/spool/uucp/SYSLOG"

--- 14,21 -----
  
+ /* The new uucp has another field in the SYSLOG file */
+ #ifndef NEWUUCP
+ #define NEWUUCP 0
+ #else
+ #define NEWUUCP 1
+ #endif
  #define	SYSLOG	"/usr/spool/uucp/SYSLOG"
***************
*** 15,16
  #define	SYSLOG	"/usr/spool/uucp/SYSLOG"
  #define	LOGFILE	"/usr/spool/uucp/LOGFILE"

--- 21,28 -----
  #define	SYSLOG	"/usr/spool/uucp/SYSLOG"
+ #define SYSUSER 0			/* user name */
+ #define SYSNAME 1			/* System name */
+ #define SYSDATE 2			/* Date called */
+ #define SYSDIR	3+NEWUUCP		/* Direction (sent/received) */
+ #define SYSBYTE	5+NEWUUCP		/* Number of bytes */
+ #define	SYSTIME	7+NEWUUCP		/* time it took */
  #define	LOGFILE	"/usr/spool/uucp/LOGFILE"
***************
*** 16,18
  #define	LOGFILE	"/usr/spool/uucp/LOGFILE"
! #define	MAXSYS	5	/* maxuim number of systems you talk to
  				 * should be made to use malloc but I didn't

--- 28,35 -----
  #define	LOGFILE	"/usr/spool/uucp/LOGFILE"
! #define LOGXQT	4			/* If XQT, this is where it says */
! #define	LOGCMD	2	 /* if XQT, what is command (used with ; delimiter) */
! #define LOGSTAT 3   			/* SUCCEEDED, FAILED, OK, etc. */
! #define LOGSYS	1			/* system name field */
! 
! #define	MAXSYS	10	/* maxuim number of systems you talk to
  				 * should be made to use malloc but I didn't
***************
*** 95,98
  		 */
! 		strcpy(cx,getfield(2,line,' '));
! 		cp = &cx;
  		cp++;	/* puts at first number */

--- 112,115 -----
  		 */
! 		strcpy(cx,getfield(SYSDATE,line,' '));
! 		cp = cx;
  		cp++;	/* puts at first number */
***************
*** 111,117
  		d = atoi(c);
! 		strcpy(sysname, getfield(1,line,' '));
! 		byt = atol(getfield(6,line,' '));
! 		tim = atol(getfield(8,line,' '));
! 		strcpy(username, getfield(0,line,' '));
! 		strcpy(field,getfield(4,line,' '));
  

--- 128,134 -----
  		d = atoi(c);
! 		strcpy(sysname, getfield(SYSNAME,line,' '));
! 		byt = atol(getfield(SYSBYTE,line,' '));
! 		tim = atol(getfield(SYSTIME,line,' '));
! 		strcpy(username, getfield(SYSUSER,line,' '));
! 		strcpy(field,getfield(SYSDIR,line,' '));
  
***************
*** 161,163
  	while(fgets(line,512,fpin) != NULL) {
! 		c = getfield(4,line,' ');
  		if(strcmp(c,"XQT") == 0) {

--- 178,180 -----
  	while(fgets(line,512,fpin) != NULL) {
! 		c = getfield(LOGXQT,line,' ');
  		if(strcmp(c,"XQT") == 0) {
***************
*** 163,166
  		if(strcmp(c,"XQT") == 0) {
! 			strcpy(field,getfield(1,line,';'));
! 			field[strlen(field)-4] = '\0';
  			cmd = tcall(cmd,field);

--- 180,183 -----
  		if(strcmp(c,"XQT") == 0) {
! 			strcpy(field,getfield(LOGCMD,line,';'));
! 			field[strlen(field)-3] = '\0';
  			cmd = tcall(cmd,field);
***************
*** 169,171
  			
! 			cp = getfield(3,line,' ');
  			if(strcmp(cp,"SUCCEEDED") == 0) {

--- 186,188 -----
  			
! 			cp = getfield(LOGSTAT,line,' ');
  			if(strcmp(cp,"SUCCEEDED") == 0) {
***************
*** 172,174
  				for(i=0;i< MAXSYS;i++)
! 				  if(strcmp(sysacc[i].sname,getfield(1,line,' ')) == 0)
  					sysacc[i].suc++;

--- 189,191 -----
  				for(i=0;i< MAXSYS;i++)
! 				  if(strcmp(sysacc[i].sname,getfield(LOGSYS,line,' ')) == 0)
  					sysacc[i].suc++;
***************
*** 177,179
  				for(i=0;i< MAXSYS;i++)
! 				  if(strcmp(sysacc[i].sname,getfield(1,line,' ')) == 0)
  					sysacc[i].fail++;

--- 194,196 -----
  				for(i=0;i< MAXSYS;i++)
! 				  if(strcmp(sysacc[i].sname,getfield(LOGSYS,line,' ')) == 0)
  					sysacc[i].fail++;
***************
*** 182,184
  				for(i=0;i< MAXSYS;i++)
! 				  if(strcmp(sysacc[i].sname,getfield(1,line,' ')) == 0)
  					sysacc[i].lock++;

--- 199,201 -----
  				for(i=0;i< MAXSYS;i++)
! 				  if(strcmp(sysacc[i].sname,getfield(LOGSYS,line,' ')) == 0)
  					sysacc[i].lock++;
***************
*** 186,188
  		}
! 		cp = getfield(3,line,' ');
  		if(strcmp(cp,"REQUEST") == 0) {

--- 203,205 -----
  		}
! 		cp = getfield(LOGSTAT,line,' ');
  		if(strcmp(cp,"REQUEST") == 0) {
***************
*** 189,191
  			for(i=0;i< MAXSYS;i++)
! 			  if(strcmp(sysacc[i].sname,getfield(1,line,' ')) == 0)
  				sysacc[i].usent++;

--- 206,208 -----
  			for(i=0;i< MAXSYS;i++)
! 			  if(strcmp(sysacc[i].sname,getfield(LOGSYS,line,' ')) == 0)
  				sysacc[i].usent++;
***************
*** 194,196
  			for(i=0;i< MAXSYS;i++) {
! 			  if(strcmp(sysacc[i].sname,getfield(1,line,' ')) == 0)
  				sysacc[i].ugot++;

--- 211,213 -----
  			for(i=0;i< MAXSYS;i++) {
! 			  if(strcmp(sysacc[i].sname,getfield(LOGSYS,line,' ')) == 0)
  				sysacc[i].ugot++;



More information about the Comp.sources.unix mailing list