From 44c9962fd4a9ef4676afc06968b2c11d8740a4bc Mon Sep 17 00:00:00 2001 From: Jim Bloom Date: Thu, 20 Jun 1985 16:57:31 -0800 Subject: [PATCH] fixes from rick adams 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 | 5 ++-- usr/src/usr.bin/uucp/libuu/gnxseq.c | 16 ++++++------ usr/src/usr.bin/uucp/libuu/lastpart.c | 17 +++++++------ usr/src/usr.bin/uucp/libuu/logent.c | 8 +++--- usr/src/usr.bin/uucp/uucico/gio.c | 11 ++++++--- usr/src/usr.bin/uucp/uucico/gnsys.c | 35 +++++++++++++++++++++++---- 6 files changed, 61 insertions(+), 31 deletions(-) diff --git a/usr/src/usr.bin/uucp/gnamef.c b/usr/src/usr.bin/uucp/gnamef.c index cebe07df51..5ac1e4dbf2 100644 --- a/usr/src/usr.bin/uucp/gnamef.c +++ b/usr/src/usr.bin/uucp/gnamef.c @@ -1,15 +1,16 @@ #ifndef lint -static char sccsid[] = "@(#)gnamef.c 5.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)gnamef.c 5.4 (Berkeley) %G%"; #endif #include "uucp.h" -#include #ifdef NDIR #include "ndir.h" #else #include #endif +/*LINTLIBRARY*/ + /* * get next file name from directory * diff --git a/usr/src/usr.bin/uucp/libuu/gnxseq.c b/usr/src/usr.bin/uucp/libuu/gnxseq.c index c5cd4be941..bbe02f63ef 100644 --- a/usr/src/usr.bin/uucp/libuu/gnxseq.c +++ b/usr/src/usr.bin/uucp/libuu/gnxseq.c @@ -1,22 +1,20 @@ #ifndef lint -static char sccsid[] = "@(#)gnxseq.c 5.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)gnxseq.c 5.4 (Berkeley) %G%"; #endif #include "uucp.h" -#include #ifdef BSD4_2 #include #else sane #include #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 */ @@ -56,10 +54,10 @@ char *rmtname; ret = sscanf(buf, "%s%d", name, &ct); if (ret < 2) ct = 0; - name[7] = '\0'; + name[MAXBASENAME] = '\0'; if (ct > 9998) ct = 0; - if (strcmp(rmtname, name) != SAME) { + if (strncmp(rmtname, name, MAXBASENAME) != SAME) { fputs(buf, fp1); continue; } diff --git a/usr/src/usr.bin/uucp/libuu/lastpart.c b/usr/src/usr.bin/uucp/libuu/lastpart.c index 4d06b66d61..ab45e77062 100644 --- a/usr/src/usr.bin/uucp/libuu/lastpart.c +++ b/usr/src/usr.bin/uucp/libuu/lastpart.c @@ -1,11 +1,13 @@ #ifndef lint -static char sccsid[] = "@(#)lastpart.c 5.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)lastpart.c 5.4 (Berkeley) %G%"; #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 */ @@ -15,11 +17,10 @@ lastpart(file) register char *file; { register char *c; - char *rindex(); c = rindex(file, '/'); - if (c) - return c + 1; + if (c++) + return c; else return file; } diff --git a/usr/src/usr.bin/uucp/libuu/logent.c b/usr/src/usr.bin/uucp/libuu/logent.c index 241c8e0d95..fb29473f51 100644 --- a/usr/src/usr.bin/uucp/libuu/logent.c +++ b/usr/src/usr.bin/uucp/libuu/logent.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)logent.c 5.4 (Berkeley) %G%"; +static char sccsid[] = "@(#)logent.c 5.5 (Berkeley) %G%"; #endif #include "uucp.h" @@ -12,13 +12,13 @@ static char sccsid[] = "@(#)logent.c 5.4 (Berkeley) %G%"; #include #endif -extern time_t time(); - static FILE *Lp = NULL; static FILE *Sp = NULL; static Ltried = 0; static Stried = 0; +/*LINTLIBRARY*/ + /* * 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); - 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 */ diff --git a/usr/src/usr.bin/uucp/uucico/gio.c b/usr/src/usr.bin/uucp/uucico/gio.c index 8890a08bb7..84d1887169 100644 --- a/usr/src/usr.bin/uucp/uucico/gio.c +++ b/usr/src/usr.bin/uucp/uucico/gio.c @@ -1,15 +1,14 @@ #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 -extern time_t time(); - jmp_buf Failbuf; +int Retries = 0; struct pack *Pk; pkfail() @@ -97,6 +96,7 @@ FILE *fp1; if(setjmp(Failbuf)) return FAIL; bytes = 0L; + Retries = 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); + if (Retries > 0) + sprintf((char *)text+strlen(text)," %d retries", Retries); DEBUG(1, "%s\n", text); syslog(text); return SUCCESS; @@ -147,6 +149,7 @@ FILE *fp2; if(setjmp(Failbuf)) return FAIL; bytes = 0L; + Retries = 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); + if (Retries > 0) + sprintf((char *)text+strlen(text)," %d retries", Retries); DEBUG(1, "%s\n", text); syslog(text); return SUCCESS; diff --git a/usr/src/usr.bin/uucp/uucico/gnsys.c b/usr/src/usr.bin/uucp/uucico/gnsys.c index e8ec4af954..b478845e67 100644 --- a/usr/src/usr.bin/uucp/uucico/gnsys.c +++ b/usr/src/usr.bin/uucp/uucico/gnsys.c @@ -1,18 +1,19 @@ #ifndef lint -static char sccsid[] = "@(#)gnsys.c 5.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)gnsys.c 5.4 (Berkeley) %G%"; #endif #include "uucp.h" -#include #ifdef NDIR #include "ndir.h" #else #include #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 */ +/*LINTLIBRARY*/ + /* * 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: - * 0 - no more names * 1 - name returned in sname + * SUCCESS - no more names * FAIL - bad directory */ @@ -68,10 +69,34 @@ retry: for (n = 0; n < nitem; n++) if (list[n] != NULL) free(list[n]); - return 0; + return SUCCESS; } 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++]); + 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; } -- 2.20.1