fixes from rick adams
authorJim Bloom <bloom@ucbvax.Berkeley.EDU>
Fri, 21 Jun 1985 00:57:31 +0000 (16:57 -0800)
committerJim Bloom <bloom@ucbvax.Berkeley.EDU>
Fri, 21 Jun 1985 00:57:31 +0000 (16:57 -0800)
SCCS-vsn: usr.bin/uucp/uucico/gio.c 5.4
SCCS-vsn: usr.bin/uucp/gnamef.c 5.4
SCCS-vsn: usr.bin/uucp/uucico/gnsys.c 5.4
SCCS-vsn: usr.bin/uucp/libuu/gnxseq.c 5.4
SCCS-vsn: usr.bin/uucp/libuu/lastpart.c 5.4
SCCS-vsn: usr.bin/uucp/libuu/logent.c 5.5

usr/src/usr.bin/uucp/gnamef.c
usr/src/usr.bin/uucp/libuu/gnxseq.c
usr/src/usr.bin/uucp/libuu/lastpart.c
usr/src/usr.bin/uucp/libuu/logent.c
usr/src/usr.bin/uucp/uucico/gio.c
usr/src/usr.bin/uucp/uucico/gnsys.c

index cebe07d..5ac1e4d 100644 (file)
@@ -1,15 +1,16 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)gnamef.c   5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)gnamef.c   5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #ifdef NDIR
 #include "ndir.h"
 #else
 #include <sys/dir.h>
 #endif
 
 #ifdef NDIR
 #include "ndir.h"
 #else
 #include <sys/dir.h>
 #endif
 
+/*LINTLIBRARY*/
+
 /*
  *     get next file name from directory
  *
 /*
  *     get next file name from directory
  *
index c5cd4be..bbe02f6 100644 (file)
@@ -1,22 +1,20 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)gnxseq.c   5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)gnxseq.c   5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #ifdef BSD4_2
 #include <sys/time.h>
 #else sane
 #include <time.h>
 #endif sane
 
 #ifdef BSD4_2
 #include <sys/time.h>
 #else sane
 #include <time.h>
 #endif sane
 
-#ifdef GNXSEQ
+/*LINTLIBRARY*/
 
 
-extern time_t  time();
+#ifdef GNXSEQ
 
 
-/*******
- *     gnxseq(rmtname)         get next conversation sequence number
- *     char *rmtname;
+/*
+ *     get next conversation sequence number
  *
  *     return - 0 no entry | >0 sequence number
  */
  *
  *     return - 0 no entry | >0 sequence number
  */
@@ -56,10 +54,10 @@ char *rmtname;
                ret = sscanf(buf, "%s%d", name, &ct);
                if (ret < 2)
                        ct = 0;
                ret = sscanf(buf, "%s%d", name, &ct);
                if (ret < 2)
                        ct = 0;
-               name[7] = '\0';
+               name[MAXBASENAME] = '\0';
                if (ct > 9998)
                        ct = 0;
                if (ct > 9998)
                        ct = 0;
-               if (strcmp(rmtname, name) != SAME) {
+               if (strncmp(rmtname, name, MAXBASENAME) != SAME) {
                        fputs(buf, fp1);
                        continue;
                }
                        fputs(buf, fp1);
                        continue;
                }
index 4d06b66..ab45e77 100644 (file)
@@ -1,11 +1,13 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)lastpart.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)lastpart.c 5.4 (Berkeley) %G%";
 #endif
 
 #endif
 
-/*******
- *     char *
- *     lastpart(file)  find last part of file name
- *     char *file;
+#include "uucp.h"
+
+/*LINTLIBRARY*/
+
+/*
+ *     find last part of file name
  *
  *     return - pointer to last part
  */
  *
  *     return - pointer to last part
  */
@@ -15,11 +17,10 @@ lastpart(file)
 register char *file;
 {
        register char *c;
 register char *file;
 {
        register char *c;
-       char *rindex();
 
        c = rindex(file, '/');
 
        c = rindex(file, '/');
-       if (c)
-               return c + 1;
+       if (c++)
+               return c;
        else
                return file;
 }
        else
                return file;
 }
index 241c8e0..fb29473 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)logent.c   5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)logent.c   5.5 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
@@ -12,13 +12,13 @@ static char sccsid[] = "@(#)logent.c        5.4 (Berkeley) %G%";
 #include <fcntl.h>
 #endif
 
 #include <fcntl.h>
 #endif
 
-extern time_t  time();
-
 static FILE *Lp = NULL;
 static FILE *Sp = NULL;
 static Ltried = 0;
 static Stried = 0;
 
 static FILE *Lp = NULL;
 static FILE *Sp = NULL;
 static Ltried = 0;
 static Stried = 0;
 
+/*LINTLIBRARY*/
+
 /*
  *     make log entry
  */
 /*
  *     make log entry
  */
@@ -199,7 +199,7 @@ char *text;
 #else !USG
        fprintf(Sp, "(%d/%d-%02d:%02d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min);
 #else !USG
        fprintf(Sp, "(%d/%d-%02d:%02d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min);
-       fprintf(Sp, "(%ld.%02d) %s\n", clock.time, clock.millitm/10, text);
+       fprintf(Sp, "(%ld.%02u) %s\n", clock.time, clock.millitm/10, text);
 #endif !USG
 
        /* Position at end and flush */
 #endif !USG
 
        /* Position at end and flush */
index 8890a08..84d1887 100644 (file)
@@ -1,15 +1,14 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)gio.c      5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)gio.c      5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #include "pk.h"
 #include <setjmp.h>
 
 #endif
 
 #include "uucp.h"
 #include "pk.h"
 #include <setjmp.h>
 
-extern time_t  time();
-
 jmp_buf Failbuf;
 
 jmp_buf Failbuf;
 
+int Retries = 0;
 struct pack *Pk;
 
 pkfail()
 struct pack *Pk;
 
 pkfail()
@@ -97,6 +96,7 @@ FILE *fp1;
        if(setjmp(Failbuf))
                return FAIL;
        bytes = 0L;
        if(setjmp(Failbuf))
                return FAIL;
        bytes = 0L;
+       Retries = 0;
 #ifdef USG
        time(&t1.time);
        t1.millitm = 0;
 #ifdef USG
        time(&t1.time);
        t1.millitm = 0;
@@ -129,6 +129,8 @@ FILE *fp1;
        sprintf(text, "sent data %ld bytes %ld.%02d secs",
                                bytes, (long)t2.time, mil/10);
        sysacct(bytes, t2.time - t1.time);
        sprintf(text, "sent data %ld bytes %ld.%02d secs",
                                bytes, (long)t2.time, mil/10);
        sysacct(bytes, t2.time - t1.time);
+       if (Retries > 0) 
+               sprintf((char *)text+strlen(text)," %d retries", Retries);
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
@@ -147,6 +149,7 @@ FILE *fp2;
        if(setjmp(Failbuf))
                return FAIL;
        bytes = 0L;
        if(setjmp(Failbuf))
                return FAIL;
        bytes = 0L;
+       Retries = 0;
 #ifdef USG
        time(&t1.time);
        t1.millitm = 0;
 #ifdef USG
        time(&t1.time);
        t1.millitm = 0;
@@ -180,6 +183,8 @@ FILE *fp2;
        sprintf(text, "received data %ld bytes %ld.%02d secs",
                                bytes, (long)t2.time, mil/10);
        sysacct(bytes, t2.time - t1.time);
        sprintf(text, "received data %ld bytes %ld.%02d secs",
                                bytes, (long)t2.time, mil/10);
        sysacct(bytes, t2.time - t1.time);
+       if (Retries > 0) 
+               sprintf((char *)text+strlen(text)," %d retries", Retries);
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
index e8ec4af..b478845 100644 (file)
@@ -1,18 +1,19 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)gnsys.c    5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)gnsys.c    5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #ifdef NDIR
 #include "ndir.h"
 #else
 #include <sys/dir.h>
 #endif
 
 #ifdef NDIR
 #include "ndir.h"
 #else
 #include <sys/dir.h>
 #endif
 
-#define LSIZE 100      /* number of systems to store */
+#define LSIZE 128      /* number of systems to store */
 #define WSUFSIZE 6     /* work file name suffix size */
 
 #define WSUFSIZE 6     /* work file name suffix size */
 
+/*LINTLIBRARY*/
+
 /*
  *     this routine will return the next system name which has work to be done.
  *     "sname" is a string of size DIRSIZ - WSUFSIZE.
 /*
  *     this routine will return the next system name which has work to be done.
  *     "sname" is a string of size DIRSIZ - WSUFSIZE.
@@ -20,8 +21,8 @@ static char sccsid[] = "@(#)gnsys.c   5.3 (Berkeley) %G%";
  *     "dir" is the directory to search.
  *
  *     return codes:
  *     "dir" is the directory to search.
  *
  *     return codes:
- *             0  -  no more names
  *             1  -  name returned in sname
  *             1  -  name returned in sname
+ *             SUCCESS  -  no more names
  *             FAIL  -  bad directory
  */
 
  *             FAIL  -  bad directory
  */
 
@@ -68,10 +69,34 @@ retry:
                for (n = 0; n < nitem; n++)
                        if (list[n] != NULL)
                                free(list[n]);
                for (n = 0; n < nitem; n++)
                        if (list[n] != NULL)
                                free(list[n]);
-               return 0;
+               return SUCCESS;
        }
        while(nitem > n) {
        }
        while(nitem > n) {
+               /* We only have at most a SYSNSIZE character site name encoded
+                * in the file. However, we would like to use the full sitename
+                * if possible. If the number of chars in list[n] is < SYSNSIZE
+                * then the sitename could not have been truncated and
+                * we don't bother to check. Otherwise, we scan SYSFILE
+                * looking for the fullname and return it if we find it
+                */
                strcpy(sname, list[n++]);
                strcpy(sname, list[n++]);
+               if (strlen(sname) >= SYSNSIZE) {
+                       register FILE *fp;
+                       register char *p;
+                       char line[MAXFULLNAME];
+                       fp = fopen(SYSFILE, "r");
+                       ASSERT(fp != NULL, CANTOPEN, SYSFILE, 0);
+                       while (cfgets(line, sizeof(line), fp) != NULL) {
+                               p = index(line, ' ');
+                               if (p)
+                                       *p = '\0';
+                               if (strncmp(sname, line, SYSNSIZE) == SAME) {
+                                       strncpy(sname, line, MAXBASENAME);
+                                       break;
+                               }
+                       }
+                       fclose(fp);
+               }
                if (callok(sname) == 0)
                        return 1;
        }
                if (callok(sname) == 0)
                        return 1;
        }