From ba8a7d500ab375b4484dccfd72adcc38e8013594 Mon Sep 17 00:00:00 2001 From: Jim Bloom Date: Thu, 10 Oct 1985 01:10:31 -0800 Subject: [PATCH] still more fixes from rick@seismo SCCS-vsn: usr.bin/uucp/uux/uux.c 5.5 SCCS-vsn: usr.bin/uucp/uuxqt/uuxqt.c 5.7 SCCS-vsn: usr.bin/uucp/libuu/versys.c 5.5 --- usr/src/usr.bin/uucp/libuu/versys.c | 14 +++--- usr/src/usr.bin/uucp/uux/uux.c | 69 ++++++++++++++++++++++++----- usr/src/usr.bin/uucp/uuxqt/uuxqt.c | 11 +++-- 3 files changed, 74 insertions(+), 20 deletions(-) diff --git a/usr/src/usr.bin/uucp/libuu/versys.c b/usr/src/usr.bin/uucp/libuu/versys.c index 6ed4ec9444..c0c44c1fba 100644 --- a/usr/src/usr.bin/uucp/libuu/versys.c +++ b/usr/src/usr.bin/uucp/libuu/versys.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)versys.c 5.4 (Berkeley) %G%"; +static char sccsid[] = "@(#)versys.c 5.5 (Berkeley) %G%"; #endif #include "uucp.h" @@ -8,6 +8,8 @@ static char sccsid[] = "@(#)versys.c 5.4 (Berkeley) %G%"; /*LINTLIBRARY*/ +char PhoneNumber[MAXPH]; + /* * verify system names n1 and n2 * return codes: SUCCESS | FAIL @@ -35,12 +37,14 @@ register char **nameptr; fp = fopen(SYSFILE, "r"); ASSERT(fp != NULL, CANTOPEN, SYSFILE, 0); + PhoneNumber[0] = '\0'; while (cfgets(line, sizeof(line), fp) != NULL) { char *targs[100]; getargs(line, targs, 100); if (strncmp(name, targs[0], MAXBASENAME) == SAME) { fclose(fp); + strncpy(PhoneNumber, targs[F_PHONE], MAXPH); return SUCCESS; } } @@ -61,10 +65,10 @@ register char **nameptr; * SUCCESS Anything else */ -uualias (hostptr) +uualias(hostptr) char **hostptr; /* we change it */ { - FILE * Aliases; /* list of aliases */ + FILE *Aliases; /* list of aliases */ char buf[BUFSIZ]; int atend; char *p, *q; @@ -76,9 +80,7 @@ char **hostptr; /* we change it */ } DEBUG (11, "Alias expansion for %s\n", *hostptr); - while (fgets(buf, sizeof (buf), Aliases)) { - if (buf[0] == '#') /* comment line */ - continue; + while (cfgets(buf, sizeof (buf), Aliases)) { p = &buf[0]; atend = 0; DEBUG(11, "Alias line: %s\n", buf); diff --git a/usr/src/usr.bin/uucp/uux/uux.c b/usr/src/usr.bin/uucp/uux/uux.c index 1d82f0fc9b..aab134c0c0 100644 --- a/usr/src/usr.bin/uucp/uux/uux.c +++ b/usr/src/usr.bin/uucp/uux/uux.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)uux.c 5.4 (Berkeley) %G%"; +static char sccsid[] = "@(#)uux.c 5.5 (Berkeley) %G%"; #endif #include "uucp.h" @@ -7,6 +7,9 @@ static char sccsid[] = "@(#)uux.c 5.4 (Berkeley) %G%"; #define NOSYSPART 0 #define HASSYSPART 1 +#define LQUOTE '(' +#define RQUOTE ')' + #define APPCMD(d) {\ char *p; for (p = d; *p != '\0';) *cmdp++ = *p++; *cmdp++ = ' '; *cmdp = '\0';} @@ -14,6 +17,8 @@ char *p; for (p = d; *p != '\0';) *cmdp++ = *p++; *cmdp++ = ' '; *cmdp = '\0';} fprintf(f, "S %s %s %s -%s %s 0666\n", a, b, c, d, e); } #define GENRCV(f, a, b, c) {fprintf(f, "R %s %s %s - \n", a, b, c);} +struct timeb Now; + main(argc, argv) char *argv[]; { @@ -112,12 +117,10 @@ char *argv[]; } --argc; argv++; } - if (argc > 2) { - ap = getwd(Wrkdir); - if (ap == 0) { - fprintf(stderr, "can't get working directory; will try to continue\n"); - strcpy(Wrkdir, "/UNKNOWN"); - } + ap = getwd(Wrkdir); + if (ap == 0) { + fprintf(stderr, "can't get working directory; will try to continue\n"); + strcpy(Wrkdir, "/UNKNOWN"); } DEBUG(4, "\n\n** %s **\n", "START"); @@ -161,14 +164,11 @@ char *argv[]; continue; } - split(prm, xsys, rest); break; } if (xsys[0] == '\0') strcpy(xsys, local); - strncpy(Rmtname, xsys, MAXBASENAME); - DEBUG(4, "xsys %s\n", xsys); if (versys(&xsys) != 0) { /* bad system name */ fprintf(stderr, "bad system name: %s\n", xsys); @@ -177,6 +177,9 @@ char *argv[]; cleanup(EX_NOHOST); } + strncpy(Rmtname, xsys, MAXBASENAME); + DEBUG(4, "xsys %s\n", xsys); + if (pipein) { gename(DATAPRE, local, 'B', dfile); fpd = ufopen(dfile, "w"); @@ -188,7 +191,10 @@ char *argv[]; fclose(fpd); strcpy(tfile, dfile); if (strcmp(local, xsys) != SAME) { - tfile[strlen(local) + 2] = 'S'; + register int Len = strlen(local); + if (Len > SYSNSIZE) + Len = SYSNSIZE; + tfile[Len + 2] = 'S'; GENSEND(fpc, dfile, tfile, User, "", dfile); cflag++; } @@ -478,3 +484,44 @@ char **argv; } } #endif VMS + +/* + * split into system and file part + * + * return codes: + * NOSYSPART + * HASSYSPART + */ + +split(name, sys, rest) +register char *name, *rest; +char *sys; +{ + register char *c; + register int i; + + if (*name == LQUOTE) { + if ((c = index(name + 1, RQUOTE)) != NULL) { + /* strip off quotes */ + name++; + while (c != name) + *rest++ = *name++; + *rest = '\0'; + *sys = '\0'; + return NOSYSPART; + } + } + + if ((c = index(name, '!')) == NULL) { + strcpy(rest, name); + *sys = '\0'; + return NOSYSPART; + } + + *c++ = '\0'; + strncpy(sys, name, MAXBASENAME); + sys[MAXBASENAME] = '\0'; + + strcpy(rest, c); + return HASSYSPART; +} diff --git a/usr/src/usr.bin/uucp/uuxqt/uuxqt.c b/usr/src/usr.bin/uucp/uuxqt/uuxqt.c index 9e7465127c..82ed80c382 100644 --- a/usr/src/usr.bin/uucp/uuxqt/uuxqt.c +++ b/usr/src/usr.bin/uucp/uuxqt/uuxqt.c @@ -1,5 +1,5 @@ #ifndef lint -static char sccsid[] = "@(#)uuxqt.c 5.6 (Berkeley) %G%"; +static char sccsid[] = "@(#)uuxqt.c 5.7 (Berkeley) %G%"; #endif #include "uucp.h" @@ -36,6 +36,8 @@ int TransferSucceeded = 1; int notiok = 1; int nonzero = 0; +struct timeb Now; + char PATH[MAXFULLNAME] = "PATH=/bin:/usr/bin:/usr/ucb"; char Shell[MAXFULLNAME]; char HOME[MAXFULLNAME]; @@ -177,9 +179,13 @@ doprocess: DEBUG(4, "process %s\n", CNULL); time(&xstart); while (gtxfile(xfile) > 0) { - ultouch(); /* if /etc/nologin exists, exit cleanly */ +#if defined(BSD4_2) || defined(USG) + if (access(NOLOGIN) == 0) { +#else !BSD4_2 && ! USG + ultouch(); if (nologinflag) { +#endif !BSD4_2 && !USG logent(NOLOGIN, "UUXQT SHUTDOWN"); if (Debug) logent("debugging", "continuing anyway"); @@ -681,7 +687,6 @@ char *cmd, *fi, *fo; signal(SIGINT, SIG_IGN); signal(SIGHUP, SIG_IGN); signal(SIGQUIT, SIG_IGN); - signal(SIGKILL, SIG_IGN); close(Ifn); close(Ofn); close(0); -- 2.20.1