diff --git a/src/cmd/uucp/Makefile b/src/cmd/uucp/Makefile index 3e5364b..7b1ba11 100644 --- a/src/cmd/uucp/Makefile +++ b/src/cmd/uucp/Makefile @@ -17,7 +17,7 @@ LIBOBJ = logent.o ulockf.o uucpdefs.o subdir.o gename.o assert.o expfile.o \ mailst.o systat.o cntrl.o imsg.o gio.o sysacct.o pk0.o pk1.o \ conn.o condevs.o chksum.o setline.o gnsys.o -CC = $(GCCPREFIX)gcc -EL -msoft-float -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) +#CC = $(GCCPREFIX)gcc -EL -msoft-float -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) #CC += -mips16 diff --git a/src/cmd/uucp/acucntrl.c b/src/cmd/uucp/acucntrl.c index b76d332..a55a733 100644 --- a/src/cmd/uucp/acucntrl.c +++ b/src/cmd/uucp/acucntrl.c @@ -1,9 +1,5 @@ -#if defined(DOSCCS) && !defined(lint) -static char sccsid[] = "@(#)acucntrl.c 5.8.2 (2.11BSD GTE) 1996/3/22"; -#endif - /* acucntrl - turn around tty line between dialin and dialout - * + * * Usage: acucntrl {enable,disable} /dev/ttydX * * History: @@ -354,7 +350,7 @@ char *device, *name; fprintf(stderr, "on write in %s: %s", Etcutmp, strerror(errno)); } - + /* poke process 1 and wait for it to do its thing */ pokeinit(device, uname, enable) char *uname, *device; int enable; @@ -395,7 +391,7 @@ char *uname, *device; int enable; opnttys(device) char *device; { - register int ndevice; + register int ndevice; register char *p; char *index(); char linebuf[BUFSIZ]; @@ -438,7 +434,7 @@ char *device; Etcttys, strerror(errno)); exit(1); } - + } fprintf(stderr, "%s not found in %s\n", device, Etcttys); exit(1); @@ -508,7 +504,7 @@ int enable; exit(1); } } - + if (enable^resettty) (void) unlink(NEtcttys); else { @@ -531,7 +527,7 @@ opnttys(device) char *device; { register FILE *ttysfile; - register int ndevice, lnsiz; + register int ndevice, lnsiz; register char *p; char *index(); char linebuf[BUFSIZ]; diff --git a/src/cmd/uucp/aculib/hys.c b/src/cmd/uucp/aculib/hys.c index bc00ecc..cc4b8d0 100644 --- a/src/cmd/uucp/aculib/hys.c +++ b/src/cmd/uucp/aculib/hys.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)hys.c 4.6 (Berkeley) 2/12/86"; -#endif - #include "../condevs.h" #ifdef HAYES @@ -15,38 +11,13 @@ static char sccsid[] = "@(#)hys.c 4.6 (Berkeley) 2/12/86"; */ #endif -/* - * hyspopn(telno, flds, dev) connect to hayes smartmodem (pulse call) - * hystopn(telno, flds, dev) connect to hayes smartmodem (tone call) - * char *flds[], *dev[]; - * - * return codes: - * >0 - file number - ok - * CF_DIAL,CF_DEVICE - failed - */ - -hyspopn(telno, flds, dev) -char *telno, *flds[]; -struct Devices *dev; -{ - return hysopn(telno, flds, dev, 0); -} - -hystopn(telno, flds, dev) -char *telno, *flds[]; -struct Devices *dev; -{ - return hysopn(telno, flds, dev, 1); -} - /* ARGSUSED */ -hysopn(telno, flds, dev, toneflag) +int hysopn(telno, flds, dev, toneflag) char *telno; char *flds[]; struct Devices *dev; int toneflag; { - extern errno; char dcname[20]; char cbuf[MAXPH]; register char *cp; @@ -130,7 +101,7 @@ int toneflag; return CF_DIAL; } i = atoi(&cbuf[8]); - if (i > 0 && i != dev->D_speed) { + if (i > 0 && i != dev->D_speed) { DEBUG(4,"Baudrate reset to %d\n", i); fixline(dh, i); } @@ -144,14 +115,37 @@ int toneflag; return dh; } -hyscls(fd) +/* + * hyspopn(telno, flds, dev) connect to hayes smartmodem (pulse call) + * hystopn(telno, flds, dev) connect to hayes smartmodem (tone call) + * char *flds[], *dev[]; + * + * return codes: + * >0 - file number - ok + * CF_DIAL,CF_DEVICE - failed + */ + +int hyspopn(telno, flds, dev) +char *telno, *flds[]; +struct Devices *dev; +{ + return hysopn(telno, flds, dev, 0); +} + +int hystopn(telno, flds, dev) +char *telno, *flds[]; +struct Devices *dev; +{ + return hysopn(telno, flds, dev, 1); +} + +int hyscls(fd) int fd; { char dcname[20]; #ifdef DROPDTR struct sgttyb hup, sav; #endif - if (fd > 0) { sprintf(dcname, "/dev/%s", devSel); DEBUG(4, "Hanging up fd = %d\n", fd); @@ -187,5 +181,6 @@ int fd; close(fd); delock(devSel); } + return 0; } #endif diff --git a/src/cmd/uucp/anlwrk.c b/src/cmd/uucp/anlwrk.c index 1f3452d..f226fb5 100644 --- a/src/cmd/uucp/anlwrk.c +++ b/src/cmd/uucp/anlwrk.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)anlwrk.c 5.5.1 (2.11BSD) 1997/10/2"; -#endif - #include "uucp.h" #include #include @@ -20,6 +16,10 @@ int Nfiles = 0; char Filent[LLEN][NAMESIZE]; extern int TransferSucceeded; +static void entflst(char *file); +static int pcompar(char *p1, char *p2); +static int newspool(time_t limit); + /*LINTLIBRARY*/ /* @@ -50,7 +50,7 @@ register char *file, **wvec; return 0; } if (fp == NULL) { - if (strncmp(file, lastfile, MAXFULLNAME) == 0) { + if (strncmp(file, lastfile, MAXFULLNAME) == 0) { DEBUG(5,"Workfilename repeated: %s\n", file); return 0; } @@ -113,7 +113,7 @@ char *reqst; register char *dir, *pre; { static DIR *dirp = NULL; - register nfound; + register int nfound; char filename[NAMESIZE]; int plen = strlen (pre); int flen; @@ -160,7 +160,7 @@ register char *dir, *pre; */ /* LOCAL only */ -int +void entflst(file) register char *file; { @@ -183,7 +183,7 @@ register char *file; } /* - Compare priority of filenames p1 and p2. Return: + * Compare priority of filenames p1 and p2. Return: * < 0 if p1 "has lower priority than" p2. * = 0 if p1 "has priority equal to" p2. * > 0 if p1 "has greater priority than" p2. @@ -202,15 +202,20 @@ register char *p1, *p2; /* assert: strlen(p1) and strlen(p2) are >= 5 */ p1 += strlen(p1)-5; p2 += strlen(p2)-5; + /* check 'grade' */ - if (rc = *p2++ - *p1++) + if ((rc = *p2++ - *p1++)) return rc; + /* check for sequence wrap-around */ - if (rc = *p2++ - *p1++) - if (rc < -10 || rc > 10) + if ((rc = *p2++ - *p1++)) { + if (rc < -10 || rc > 10) { return -rc; - else + } else { return rc; + } + } + /* check remaining digits */ return strcmp(p2, p1); } @@ -226,7 +231,7 @@ register char *p1, *p2; */ /* LOCAL only */ -gtwrkf(dir, file) +int gtwrkf(dir, file) char *file, *dir; { register int i; @@ -284,7 +289,7 @@ iswrk(file, reqst, dir, pre) register char *file, *reqst, *dir, *pre; { static char *lastpre = 0; - register ret; + register int ret; /* Starting new system; re-init */ if (lastpre == 0 || strcmp(lastpre,pre) != 0) { diff --git a/src/cmd/uucp/anyread.c b/src/cmd/uucp/anyread.c index 18db726..06b435a 100644 --- a/src/cmd/uucp/anyread.c +++ b/src/cmd/uucp/anyread.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)anyread.c 5.4 (Berkeley) 6/19/85"; -#endif - #include "uucp.h" #include @@ -11,7 +7,7 @@ static char sccsid[] = "@(#)anyread.c 5.4 (Berkeley) 6/19/85"; * anyread check if anybody can read * return SUCCESS ok: FAIL not ok */ -anyread(file) +int anyread(file) char *file; { struct stat s; diff --git a/src/cmd/uucp/assert.c b/src/cmd/uucp/assert.c index 986a58d..3e2231a 100644 --- a/src/cmd/uucp/assert.c +++ b/src/cmd/uucp/assert.c @@ -1,9 +1,6 @@ -#ifndef lint -static char sccsid[] = "@(#)assert.c 5.5 (Berkeley) 6/19/85"; -#endif - #include "uucp.h" #include +#include #include /*LINTLIBRARY*/ @@ -11,8 +8,7 @@ static char sccsid[] = "@(#)assert.c 5.5 (Berkeley) 6/19/85"; /* * print out assetion error */ - -assert(s1, s2, i1) +void assert(s1, s2, i1) char *s1, *s2; { register FILE *errlog; diff --git a/src/cmd/uucp/cfgets.c b/src/cmd/uucp/cfgets.c index a8f399e..b36f80e 100644 --- a/src/cmd/uucp/cfgets.c +++ b/src/cmd/uucp/cfgets.c @@ -1,9 +1,5 @@ -#ifndef lint -static char sccsid[] = "@(#)cfgets.c 5.3 (Berkeley) 6/19/85"; -#endif - /* - * get nonblank, non-comment, (possibly continued) line. Alan S. Watt + * get nonblank, non-comment, (possibly continued) line. Alan S. Watt */ #include @@ -22,10 +18,10 @@ int siz; FILE *fil; { register char *s; - register i, c, len; + register int i, c, len; char *fgets(); - for (i=0,s=buf; i = (fgets(s, siz-i, fil) != NULL); i = s - buf) { + for (i = 0, s = buf; (i = (fgets(s, siz-i, fil) != NULL)); i = s - buf) { /* get last character of line */ c = s[len = (strlen(s) - 1)]; @@ -46,7 +42,7 @@ FILE *fil; break; } } - + return i ? buf : NULL; } diff --git a/src/cmd/uucp/chkpth.c b/src/cmd/uucp/chkpth.c index 3113041..8597d8d 100644 --- a/src/cmd/uucp/chkpth.c +++ b/src/cmd/uucp/chkpth.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)chkpth.c 5.4.1 (2.11BSD) 1997/10/2"; -#endif - #include "uucp.h" #include #include @@ -13,10 +9,13 @@ struct userpath { char **us_path; struct userpath *unext; }; + struct userpath *Uhead = NULL; struct userpath *Mchdef = NULL, *Logdef = NULL; int Uptfirst = 1; +static void rdpth(void); + /*LINTLIBRARY*/ /* @@ -26,12 +25,10 @@ int Uptfirst = 1; * * return codes: 0 | FAIL */ - -chkpth(logname, mchname, path) +int chkpth(logname, mchname, path) char *path, *logname, *mchname; { register struct userpath *u; - extern char *lastpart(); register char **p, *s; /* Allow only rooted pathnames. Security wish. rti!trt */ @@ -79,7 +76,6 @@ char *path, *logname, *mchname; return FAIL; } - /*** * rdpth() * @@ -87,8 +83,7 @@ char *path, *logname, *mchname; * construct the userpath structure pointed to by (u); * */ - -rdpth() +void rdpth() { char buf[100 + 1], *pbuf[50 + 1]; register struct userpath *u; @@ -167,8 +162,7 @@ rdpth() * 0 - no call back * 1 - call back */ - -callback(name) +int callback(name) register char *name; { register struct userpath *u; @@ -190,7 +184,6 @@ register char *name; return 0; } - /*** * chkperm(file, mopt) check write permission of file * char *mopt; none NULL - create directories @@ -202,14 +195,12 @@ register char *name; * * return SUCCESS | FAIL */ - -chkperm(file, mopt) +int chkperm(file, mopt) char *file, *mopt; { struct stat s; int ret; char dir[MAXFULLNAME]; - extern char *lastpart(); if (stat(subfile(file), &s) == 0) { if ((s.st_mode & ANYWRITE) == 0) { @@ -240,7 +231,7 @@ char *file, *mopt; /* * Check for sufficient privilege to request debugging. */ -chkdebug() +void chkdebug() { if (access(SYSFILE, 04) < 0) { fprintf(stderr, "Sorry, you must be able to read L.sys for debugging\n"); diff --git a/src/cmd/uucp/chksum.c b/src/cmd/uucp/chksum.c index dd0b25e..f9738d4 100644 --- a/src/cmd/uucp/chksum.c +++ b/src/cmd/uucp/chksum.c @@ -1,11 +1,7 @@ -#ifndef lint -static char sccsid[] = "@(#)chksum.c 4.2 (Berkeley) 6/19/85"; -#endif - #ifndef pdp11 -chksum (s, n) +int chksum(s, n) register char *s; -register n; +register int n; { register long sum, x, t; @@ -26,12 +22,12 @@ register n; return (long) (short) sum; } #else -chksum(s,n) +int chksum(s, n) register char *s; -register n; +register int n; { register unsigned sum, t; - register x; + register int x; sum = -1; x = 0; diff --git a/src/cmd/uucp/cico.c b/src/cmd/uucp/cico.c index c99c73d..082c7ca 100644 --- a/src/cmd/uucp/cico.c +++ b/src/cmd/uucp/cico.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)cico.c 5.14.1 (2.11BSD) 1997/10/2"; -#endif - #include #include "uucp.h" #include @@ -78,11 +74,17 @@ struct termio Savettyb; struct sgttyb Savettyb; #endif +static void onintr(int inter); +static void dbg_signal(int inter); +static void setdebug(int parm); +static void timeout(int); +static char *pskip(char *p); + /* * this program is used to place a call to a * remote machine, login, and copy files between the two machines. */ -main(argc, argv) +int main(argc, argv) int argc; register char *argv[]; { @@ -91,8 +93,6 @@ register char *argv[]; char wkpre[NAMESIZE], file[NAMESIZE]; char msg[MAXFULLNAME], *q; register char *p; - extern onintr(), timeout(), dbg_signal(); - extern char *pskip(); char rflags[MAXFULLNAME]; #ifdef NOGETPEER u_long Hostnumber = 0; @@ -187,11 +187,9 @@ register char *argv[]; close(ret); } #endif -#ifdef BSD4_2 if (getpgrp(0) == 0) { /* We have no controlling terminal */ - setpgrp(0, getpid()); + setpgrp(); } -#endif ret = subchdir(Spool); ASSERT(ret >= 0, "CHDIR FAILED", Spool, ret); @@ -597,7 +595,7 @@ loop: ttyn = ttyname(Ifn); alarm(MAXMSGTIME); - if (ret=setjmp(Sjbuf)) + if ((ret = setjmp(Sjbuf))) goto Failure; ret = startup(Role); alarm(0); @@ -612,7 +610,7 @@ Failure: if (ttyn != NULL) { char startupmsg[BUFSIZ]; extern int linebaudrate; - sprintf(startupmsg, "startup %s %d baud", &ttyn[5], + sprintf(startupmsg, "startup %s %d baud", &ttyn[5], linebaudrate); logent(startupmsg, "OK"); } else @@ -664,7 +662,7 @@ struct sgttyb Hupvec; /* * cleanup and exit with "code" status */ -cleanup(code) +void cleanup(code) register int code; { signal(SIGINT, SIG_IGN); @@ -720,8 +718,7 @@ register int code; /* * on interrupt - remove locks and exit */ - -onintr(inter) +void onintr(inter) register int inter; { char str[30]; @@ -741,7 +738,7 @@ register int inter; * (SIGFPE, ugh), and toggle debugging between 0 and 30. * Handy for looking in on long running uucicos. */ -dbg_signal() +void dbg_signal() { Debug = (Debug == 0) ? 30 : 0; setdebug(DBG_PERM); @@ -749,7 +746,6 @@ dbg_signal() logent("Signal Enabled", "DEBUG"); } - /* * Check debugging requests, and open RMTDEBUG audit file if necessary. If an * audit file is needed, the parm argument indicates how to create the file: @@ -763,7 +759,7 @@ dbg_signal() * Each call creates a new file; if an old one of the same name exists it will * be overwritten. */ -setdebug(parm) +void setdebug(parm) int parm; { char buf[BUFSIZ]; /* Buffer for building filenames */ @@ -833,7 +829,7 @@ int parm; /* * We need RMTDEBUG directory to do auditing. If the file doesn't exist, * then we forget about debugging; if it exists but has improper owner- - * ship or modes, we gripe about it in ERRLOG. + * ship or modes, we gripe about it in ERRLOG. */ if (stat(RMTDEBUG, &stbuf) != SUCCESS) { Debug = 0; @@ -871,7 +867,7 @@ int parm; /* * catch SIGALRM routine */ -timeout() +void timeout() { extern int HaveSentHup; if (!HaveSentHup) { @@ -884,7 +880,7 @@ timeout() longjmp(Sjbuf, 1); } -char * +static char * pskip(p) register char *p; { diff --git a/src/cmd/uucp/cntrl.c b/src/cmd/uucp/cntrl.c index 1b426c8..9beb10e 100644 --- a/src/cmd/uucp/cntrl.c +++ b/src/cmd/uucp/cntrl.c @@ -1,42 +1,27 @@ -#ifndef lint -static char sccsid[] = "@(#)cntrl.c 5.8 (Berkeley) 1/24/86"; -#endif - #include "uucp.h" #include #include +#include +#include #include "uust.h" -extern int errno; extern int turntime; int willturn; int HaveSentHup = 0; +static int nullf(void); + struct Proto { char P_id; - int (*P_turnon)(); - int (*P_rdmsg)(); - int (*P_wrmsg)(); - int (*P_rddata)(); - int (*P_wrdata)(); - int (*P_turnoff)(); + int (*P_turnon)(void); + int (*P_rdmsg)(char *amsg, int fn); + int (*P_wrmsg)(char type, char *msg, int fn); + int (*P_rddata)(int fn, FILE *fp); + int (*P_wrdata)(FILE *fp, int fn); + int (*P_turnoff)(void); }; -extern int gturnon(), gturnoff(); -extern int grdmsg(), grddata(); -extern int gwrmsg(), gwrdata(); -extern int imsg(), omsg(), nullf(); -#ifdef TCPIP -extern int twrmsg(), trdmsg(); -extern int twrdata(), trddata(); -#endif -#ifdef PAD -extern int fturnon(), fturnoff(); -extern int frdmsg(), frddata(); -extern int fwrmsg(), fwrdata(); -#endif - -struct Proto Ptbl[]={ +struct Proto Ptbl[] = { #ifdef TCPIP 't', nullf, trdmsg, twrmsg, trddata, twrdata, nullf, #endif @@ -47,13 +32,17 @@ struct Proto Ptbl[]={ '\0' }; -int (*Imsg)() = imsg, (*Omsg)() = omsg; +int (*Imsg)(char *amsg, int fn) = imsg; +int (*Omsg)(char type, char *msg, int fn) = omsg; -int (*Rdmsg)()=imsg, (*Rddata)(); -int (*Wrmsg)()=omsg, (*Wrdata)(); -int (*Turnon)()=nullf, (*Turnoff)() = nullf; +int (*Rdmsg)(char *amsg, int fn) = imsg; +int (*Rddata)(int fn, FILE *fp); +int (*Wrmsg)(char type, char *msg, int fn) = omsg; +int (*Wrdata)(FILE *fp, int fn); +int (*Turnon)(void) = nullf; +int (*Turnoff)(void) = nullf; -struct timeb Now, LastTurned, LastCheckedNoLogin; +struct timeval Now, LastTurned, LastCheckedNoLogin; static char *YES = "Y"; static char *NO = "N"; @@ -79,7 +68,6 @@ char *Em_msg[] = { "can't copy to file/directory on local system - file left in PUBDIR/user/file" }; - #define XUUCP 'X' /* execute uucp (string) */ #define SLTPTCL 'P' /* select protocol (string) */ #define USEPTCL 'U' /* use protocol (character) */ @@ -113,6 +101,17 @@ static int nXfiles = 0; /* number of X files since last uuxqt start */ static char send_or_receive; struct stat stbuf; +static int wmesg(char m, char *s); +static int rmesg(char c, char *msg, int n); +static void unlinkdf(char *file); +static void lnotify(char *user, char *file, char *mesg); +static void notify(int mailopt, char *user, char *file, char *sys, char *msgcode); +static void arrived(int opt, char *file, char *nuser, char *rmtsys, char *rmtuser); +static int putinpub(char *file, char *tmp, char *user); +static char fptcl(char *str); +static int stptcl(char *c); +static char *blptcl(char *str); + /* * cntrl - this routine will execute the conversation * between the two machines after both programs are @@ -122,8 +121,7 @@ struct stat stbuf; * SUCCESS - ok * FAIL - failed */ - -cntrl(role, wkpre) +int cntrl(role, wkpre) int role; char *wkpre; { @@ -131,8 +129,6 @@ char *wkpre; register FILE *fp; int filemode; char filename[MAXFULLNAME], wrktype, *wrkvec[20]; - extern (*Rdmsg)(), (*Wrmsg)(); - extern char *index(), *lastpart(); int status = 1; register int i, narg; int mailopt, ntfyopt; @@ -144,12 +140,8 @@ char *wkpre; Wfile[0] = '\0'; willturn = turntime > 0; remaster: -#ifdef USG - time(&LastTurned.time); - LastTurned.millitm = 0; -#else - ftime(&LastTurned); -#endif + gettimeofday(&LastTurned, NULL); + send_or_receive = RESET; HaveSentHup = 0; top: @@ -157,7 +149,7 @@ top: wrkvec[i] = 0; DEBUG(4, "*** TOP *** - role=%s\n", role ? "MASTER" : "SLAVE"); setupline(RESET); - if (Now.time > (LastCheckedNoLogin.time+60)) { + if (Now.tv_sec > (LastCheckedNoLogin.tv_sec+60)) { LastCheckedNoLogin = Now; if (access(NOLOGIN, 0) == 0) { logent(NOLOGIN, "UUCICO SHUTDOWN"); @@ -281,7 +273,7 @@ sendmsg: RAMESG(msg, 1); if (willturn < 0) willturn = msg[0] == HUP; - + process: DEBUG(4, "PROCESS: msg - %s\n", msg); switch (msg[0]) { @@ -308,12 +300,7 @@ process: WMESG(HUP, ""); RMESG(HUP, msg, 1); logent(Rmtname, "TURNAROUND"); -#ifdef USG - time(&LastTurned.time); - LastTurned.millitm = 0; -#else - ftime(&LastTurned); -#endif + gettimeofday(&LastTurned, NULL); Nfiles = 0; /* force rescan of queue for work */ goto process; } @@ -323,8 +310,9 @@ process: DEBUG(4, "HUP:\n", CNULL); HaveSentHup = 1; if (msg[1] == 'Y') { - if (role == MASTER) + if (role == MASTER) { WMESG(HUP, YES); + } (*Turnoff)(); Rdmsg = Imsg; Wrmsg = Omsg; @@ -497,7 +485,7 @@ process: fflush(fp); if (ferror(fp) || fclose(fp)) ret = FAIL; - + if (ret != SUCCESS) { (void) unlinkdf(Dfile); (*Turnoff)(); @@ -507,7 +495,7 @@ process: ntfyopt = index(W_OPTNS, 'n') != NULL; status = xmv(Dfile, filename); - if (willturn && Now.time > (LastTurned.time+turntime) + if (willturn && Now.tv_sec > (LastTurned.tv_sec + turntime) && iswrk(Wfile, "chk", Spool, wkpre)) { WMESG(RQSTCMPT, status ? EM_RMTCP : "YM"); willturn = -1; @@ -571,7 +559,7 @@ process: strcat(filename, lastpart(W_FILE1)); } status = xmv(Dfile, filename); - if (willturn && Now.time > (LastTurned.time+turntime) + if (willturn && Now.tv_sec > (LastTurned.tv_sec + turntime) && iswrk(Wfile, "chk", Spool, wkpre)) { WMESG(RQSTCMPT, status ? EM_RMTCP : "YM"); willturn = -1; @@ -656,15 +644,12 @@ process: return FAIL; } - /* * read message 'c'. try 'n' times * * return code: SUCCESS | FAIL */ -rmesg(c, msg, n) -register char *msg, c; -register int n; +int rmesg(char c, char *msg, int n) { char str[MAXFULLNAME]; @@ -693,14 +678,12 @@ register int n; return SUCCESS; } - /* * write a message (type m) * * return codes: SUCCESS - ok | FAIL - ng */ -wmesg(m, s) -register char *s, m; +int wmesg(char m, char *s) { DEBUG(4, "wmesg '%c' ", m); DEBUG(4, "%s\n", s); @@ -712,7 +695,7 @@ register char *s, m; * * return codes: none */ -notify(mailopt, user, file, sys, msgcode) +void notify(mailopt, user, file, sys, msgcode) char *user, *file, *sys, *msgcode; { char str[BUFSIZ]; @@ -740,7 +723,7 @@ char *user, *file, *sys, *msgcode; * * return code - none */ -lnotify(user, file, mesg) +void lnotify(user, file, mesg) char *user, *file, *mesg; { char mbuf[200]; @@ -757,11 +740,9 @@ char *user, *file, *mesg; * SUCCESS - successful protocol selection * FAIL - can't find common or open failed */ -startup(role) +int startup(role) int role; { - extern (*Rdmsg)(), (*Wrmsg)(); - extern char *blptcl(), fptcl(); char msg[BUFSIZ], str[MAXFULLNAME]; Rdmsg = Imsg; @@ -828,7 +809,7 @@ register char *str; } /* - * build a string of the letters of the available protocols + * build a string of the letters of the available protocols */ char * blptcl(str) @@ -853,7 +834,7 @@ register char *str; * FAIL - no find or failed to open * */ -stptcl(c) +int stptcl(c) register char *c; { register struct Proto *p; @@ -882,12 +863,10 @@ register char *c; * * return code SUCCESS | FAIL */ - -putinpub(file, tmp, user) +int putinpub(file, tmp, user) register char *file, *tmp, *user; { char fullname[MAXFULLNAME]; - char *lastpart(); int status; sprintf(fullname, "%s/%s/", PUBDIR, user); @@ -910,8 +889,7 @@ register char *file, *tmp, *user; * * return code - none */ - -unlinkdf(file) +void unlinkdf(file) register char *file; { if (strlen(file) > 6) @@ -924,7 +902,7 @@ register char *file; * * return code - none */ -arrived(opt, file, nuser, rmtsys, rmtuser) +void arrived(opt, file, nuser, rmtsys, rmtuser) char *file, *nuser, *rmtsys, *rmtuser; { char mbuf[200]; @@ -936,7 +914,7 @@ char *file, *nuser, *rmtsys, *rmtuser; return; } -nullf() +static int nullf() { return SUCCESS; } diff --git a/src/cmd/uucp/condevs.c b/src/cmd/uucp/condevs.c index 446e6ed..966c94e 100644 --- a/src/cmd/uucp/condevs.c +++ b/src/cmd/uucp/condevs.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)condevs.c 5.15.2 (2.11BSD) 1997/10/2"; -#endif - /* * Here are various dialers to establish the machine-machine connection. * conn.c/condevs.c was glued together by Mike Mitchell. @@ -26,22 +22,26 @@ static char sccsid[] = "@(#)condevs.c 5.15.2 (2.11BSD) 1997/10/2"; #include "condevs.h" +static int dircls(int fd); +static int nullopn(char *telno, char *flds[], struct Devices *dev); +static int Acuopn(char *flds[]); + struct condev condevs[] = { - { "DIR", "direct", diropn, nulldev, dircls }, + { "DIR", "direct", diropn, nullopn, dircls }, #ifdef DATAKIT - { "DK", "datakit", dkopn, nulldev, nulldev }, + { "DK", "datakit", dkopn, nullopn, nulldev }, #endif #ifdef PNET - { "PNET", "pnet", pnetopn, nulldev, nulldev }, + { "PNET", "pnet", pnetopn, nullopn, nulldev }, #endif #ifdef UNETTCP - { "TCP", "TCP", unetopn, nulldev, unetcls }, + { "TCP", "TCP", unetopn, nullopn, unetcls }, #endif #ifdef BSDTCP - { "TCP", "TCP", bsdtcpopn, nulldev, bsdtcpcls }, + { "TCP", "TCP", bsdtcpopn, nullopn, bsdtcpcls }, #endif #ifdef MICOM - { "MICOM", "micom", micopn, nulldev, miccls }, + { "MICOM", "micom", micopn, nullopn, miccls }, #endif #ifdef DN11 { "ACU", "dn11", Acuopn, dnopn, dncls }, @@ -101,7 +101,7 @@ struct condev condevs[] = { { "ACU", "vmacs", Acuopn, vmacsopn, vmacscls }, #endif #ifdef SYTEK - { "SYTEK", "sytek", sykopn, nulldev, sykcls }, + { "SYTEK", "sytek", sykopn, nullopn, sykcls }, #endif #ifdef ATT2224 { "ACU", "att", Acuopn, attopn, attcls }, @@ -112,10 +112,18 @@ struct condev condevs[] = { { NULL, NULL, NULL, NULL, NULL } }; +/* + * nullopn a null device (returns CF_DIAL) + */ +int nullopn(char *telno, char *flds[], struct Devices *dev) +{ + return CF_DIAL; +} + /* * nulldev a null device (returns CF_DIAL) */ -nulldev() +int nulldev() { return CF_DIAL; } @@ -123,7 +131,7 @@ nulldev() /* * nodev a null device (returns CF_NODEV) */ -nodev() +int nodev() { return CF_NODEV; } @@ -142,7 +150,7 @@ nodev() * > 0 - file number - ok * FAIL - failed */ -diropn(flds) +int diropn(flds) register char *flds[]; { register int dcr, status; @@ -170,7 +178,7 @@ register char *flds[]; continue; /* * Modem control on vms(works dtr) Take anything in MOD class. - * It probably should work differently anyway so we can have + * It probably should work differently anyway so we can have * multiple hardwired lines. */ if (!modem_control&&strcmp(flds[F_PHONE], dev.D_line) != SAME) @@ -242,13 +250,14 @@ register char *flds[]; return dcr; } -dircls(fd) +int dircls(fd) register int fd; { if (fd > 0) { close(fd); delock(devSel); } + return 0; } /* @@ -260,7 +269,7 @@ register int fd; */ char devSel[20]; /* used for later unlock() */ -Acuopn(flds) +int Acuopn(flds) register char *flds[]; { char phone[MAXPH+1]; @@ -359,10 +368,10 @@ register char *flds[]; /* * intervaldelay: delay execution for numerator/denominator seconds. */ - #ifdef INTERVALTIMER #define uucpdelay(num,denom) intervaldelay(num,denom) -intervaldelay(num,denom) + +void intervaldelay(num,denom) int num, denom; { struct timeval tv; @@ -372,10 +381,13 @@ int num, denom; } #endif +/* + * Sleep in increments of 60ths of second. + */ #ifdef FASTTIMER #define uucpdelay(num,denom) nap(60*num/denom) -/* Sleep in increments of 60ths of second. */ -nap (time) + +void nap (time) register int time; { static int fd; @@ -389,9 +401,10 @@ register int time; #ifdef FTIME #define uucpdelay(num,denom) ftimedelay(1000*num/denom) -ftimedelay(n) + +void ftimedelay(n) { - static struct timeb loctime; + static struct timeval loctime; register i = loctime.millitm; ftime(&loctime); @@ -404,13 +417,14 @@ ftimedelay(n) #define uucpdelay(num,denom) busyloop(CPUSPEED*num/denom) #define CPUSPEED 1000000 /* VAX 780 is 1MIPS */ #define DELAY(n) { register long N = (n); while (--N > 0); } -busyloop(n) + +void busyloop(n) { DELAY(n); } #endif -slowrite(fd, str) +void slowrite(fd, str) register char *str; { DEBUG(6, "slowrite ", CNULL); @@ -428,32 +442,37 @@ register char *str; /* * send a break */ -genbrk(fn, bnulls) +void genbrk(fn, bnulls) register int fn, bnulls; { #ifdef USG - if (ioctl(fn, TCSBRK, STBNULL) < 0) + if (ioctl(fn, TCSBRK, STBNULL) < 0) { DEBUG(5, "break TCSBRK %s\n", strerror(errno)); + } #else # ifdef TIOCSBRK - if (ioctl(fn, TIOCSBRK, STBNULL) < 0) + if (ioctl(fn, TIOCSBRK, STBNULL) < 0) { DEBUG(5, "break TIOCSBRK %s\n", strerror(errno)); + } # ifdef TIOCCBRK uucpdelay(bnulls, 10); - if (ioctl(fn, TIOCCBRK, STBNULL) < 0) + if (ioctl(fn, TIOCCBRK, STBNULL) < 0) { DEBUG(5, "break TIOCCBRK %s\n", strerror(errno)); + } # endif DEBUG(4, "ioctl %f second break\n", (float) bnulls/10 ); # else struct sgttyb ttbuf; register int sospeed; - if (ioctl(fn, TIOCGETP, &ttbuf) < 0) + if (ioctl(fn, TIOCGETP, &ttbuf) < 0) { DEBUG(5, "break TIOCGETP %s\n", strerror(errno)); + } sospeed = ttbuf.sg_ospeed; ttbuf.sg_ospeed = BSPEED; - if (ioctl(fn, TIOCSETP, &ttbuf) < 0) + if (ioctl(fn, TIOCSETP, &ttbuf) < 0) { DEBUG(5, "break TIOCSETP %s\n", strerror(errno)); + } if (write(fn, "\0\0\0\0\0\0\0\0\0\0\0\0", bnulls) != bnulls) { badbreak: logent(strerror(errno), "BAD WRITE genbrk"); @@ -461,8 +480,9 @@ badbreak: longjmp(Sjbuf, 3); } ttbuf.sg_ospeed = sospeed; - if (ioctl(fn, TIOCSETP, &ttbuf) < 0) + if (ioctl(fn, TIOCSETP, &ttbuf) < 0) { DEBUG(5, "break ioctl %s\n", strerror(errno)); + } if (write(fn, "@", 1) != 1) goto badbreak; DEBUG(4, "sent BREAK nulls - %d\n", bnulls); @@ -477,10 +497,9 @@ badbreak: * disable and reenable: allow a single line to be use for dialin/dialout * */ - char enbdev[16]; -disable(dev) +int disable(dev) register char *dev; { register char *rdev; @@ -506,7 +525,7 @@ register char *dev; return SUCCESS; } -reenable() +void reenable() { if (enbdev[0] == '\0') return; @@ -515,7 +534,7 @@ reenable() enbdev[0] = '\0'; } -enbcall(type, dev) +int enbcall(type, dev) char *type, *dev; { int pid; diff --git a/src/cmd/uucp/condevs.h b/src/cmd/uucp/condevs.h index f6cd64f..a8e71fa 100644 --- a/src/cmd/uucp/condevs.h +++ b/src/cmd/uucp/condevs.h @@ -5,6 +5,7 @@ #include #include #include +#include #ifdef VMSDTR /* Modem control on vms(works dtr) */ #include #define TT$M_MODEM 0x00200000 /* These should be in a '.h' somewhere */ @@ -16,8 +17,6 @@ extern char devSel[]; /* name to pass to delock() in close */ extern int next_fd; extern jmp_buf Sjbuf; -extern int alarmtr(); -int nulldev(), nodev(), Acuopn(), diropn(), dircls(); #ifdef DATAKIT int dkopn(); @@ -28,7 +27,8 @@ int dnopn(), dncls(); #endif #ifdef HAYES -int hyspopn(), hystopn(), hyscls(); +int hyspopn(), hystopn(); +int hyscls(int fd); #endif #ifdef HAYES2400 @@ -111,4 +111,3 @@ int sykopn(), sykcls(); #ifdef ATT2224 int attopn(), attcls(); #endif - diff --git a/src/cmd/uucp/conn.c b/src/cmd/uucp/conn.c index 91bbbf3..0f7c25a 100644 --- a/src/cmd/uucp/conn.c +++ b/src/cmd/uucp/conn.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)conn.c 5.10.2 (2.11BSD) 1997/10/2"; -#endif - #include #include #include "uucp.h" @@ -37,10 +33,22 @@ int linebaudrate; /* used for the sleep test in pk1.c */ int next_fd = -1; /* predicted fd to close interrupted opens */ char *PCP = "PCP"; /* PC Pursuit device type */ + +static int finds(FILE *fsys, char *sysnam, char info[], char *flds[]); +static int getto(char *flds[]); +static int login(int nf, char *flds[], int fn); +static char *fdig(char *cp); +static int ifdate(char *p); +static void sendthem(char *str, int fn); +static int notin(char *sh, char *lg); +static void bld_partab(int type); +static void p_chwrite(int fd, char c); +static int ifadate(char *string); + /* * catch alarm routine for "expect". */ -alarmtr() +void alarmtr(int sig) { signal(SIGALRM, (sig_t)alarmtr); if (next_fd >= 0) { @@ -51,7 +59,7 @@ alarmtr() longjmp(Sjbuf, 1); } -/* This template is for seismo to call ihnp4 +/* This template is for seismo to call ihnp4 * the 3 lines marked ---> will be overwritten for the appropriate city */ #define PCP_BAUD 3 @@ -100,7 +108,7 @@ char *Flds[MAXC/10]; char LineType[10]; extern int LocalOnly; -conn(system) +int conn(system) char *system; { int nf; @@ -166,9 +174,9 @@ keeplooking: } Flds[F_CLASS] = dev.D_class; Flds[F_PHONE] = dev.D_line; - + } /* end PC Pursuit */ - if ((fcode = getto(Flds)) > 0) + if ((fcode = getto(Flds)) > 0) break; } @@ -213,12 +221,10 @@ keeplooking: * >0 - file number - ok * FAIL - failed */ - -getto(flds) +int getto(flds) register char *flds[]; { register struct condev *cd; - int nulldev(), diropn(); char *line; DEBUG(4, "getto: call no. %s ", flds[F_PHONE]); @@ -253,15 +259,14 @@ register char *flds[]; return diropn(flds); /* search failed, so use direct */ } +int (*CU_end)() = nulldev; + /* * close call unit * * return codes: none */ - -int nulldev(); -int (*CU_end)() = nulldev; -clsacu() +void clsacu() { /* make *sure* Dcf is no longer exclusive. * Otherwise dual call-in/call-out modems could get stuck. @@ -270,8 +275,9 @@ clsacu() * Hopefully everyone honors the LCK protocol, of course */ #ifdef TIOCNXCL - if (!IsTcpIp && Dcf >= 0 && ioctl(Dcf, TIOCNXCL, STBNULL) < 0) + if (!IsTcpIp && Dcf >= 0 && ioctl(Dcf, TIOCNXCL, STBNULL) < 0) { DEBUG(5, "clsacu ioctl %s\n", strerror(errno)); + } #endif if (setjmp(Sjbuf)) logent(Rmtname, "CLOSE TIMEOUT"); @@ -292,8 +298,7 @@ clsacu() /* * expand phone number for given prefix and number */ - -exphone(in, out) +void exphone(in, out) register char *in, *out; { FILE *fn; @@ -340,8 +345,7 @@ register char *in, *out; * * return code - FAIL at end-of file; 0 otherwise */ - -rddev(fp, dev) +int rddev(fp, dev) register struct Devices *dev; FILE *fp; { @@ -368,8 +372,7 @@ FILE *fp; * CF_SYSTEM - system name not found * CF_TIME - wrong time to call */ - -finds(fsys, sysnam, info, flds) +int finds(fsys, sysnam, info, flds) char *sysnam, info[], *flds[]; FILE *fsys; { @@ -401,8 +404,7 @@ FILE *fsys; * * return codes: SUCCESS | FAIL */ - -login(nf, flds, fn) +int login(nf, flds, fn) register char *flds[]; int nf, fn; { @@ -513,8 +515,7 @@ struct sg_spds {int sp_val, sp_name;} spds[] = { * * return codes: none */ - -fixline(tty, spwant) +int fixline(tty, spwant) int tty, spwant; { #ifdef USG @@ -570,8 +571,7 @@ int tty, spwant; * FAIL - lost line or too many characters read * some character - timed out */ - -expect(str, fn) +int expect(str, fn) register char *str; int fn; { @@ -651,7 +651,7 @@ int fn; * It is a UNIX kernel problem, but it has to be handled. * unc!smb (Steve Bellovin) probably first discovered it. */ -getnextfd() +void getnextfd() { close(next_fd = open("/", 0)); } @@ -661,7 +661,7 @@ getnextfd() * * return codes: none */ -sendthem(str, fn) +void sendthem(str, fn) register char *str; int fn; { @@ -801,9 +801,7 @@ int fn; return; } -p_chwrite(fd, c) -int fd; -char c; +void p_chwrite(int fd, char c) { c = par_tab[c&0177]; if (write(fd, &c, 1) != 1) { @@ -815,7 +813,7 @@ char c; /* * generate parity table for use by p_chwrite. */ -bld_partab(type) +void bld_partab(type) int type; { register int i, j, n; @@ -839,7 +837,7 @@ int type; * 0 - found the string * 1 - not in the string */ -notin(sh, lg) +int notin(sh, lg) register char *sh, *lg; { while (*lg != '\0') { @@ -854,7 +852,7 @@ register char *sh, *lg; /* * Allow multiple date specifications separated by ','. */ -ifdate(p) +int ifdate(p) register char *p; { register char *np; @@ -904,8 +902,7 @@ register char *p; * 0 - not within limits * 1 - within limits */ - -ifadate(string) +int ifadate(string) char *string; { static char *days[]={ @@ -962,13 +959,13 @@ char *string; if (dayok == 0 && s != string) return FAIL; i = sscanf(s, "%d-%d", &tl, &th); - if (i < 2) - return MGrade; + if (i < 2) + return MGrade; tn = tp->tm_hour * 100 + tp->tm_min; - if (th < tl) { /* crosses midnight */ - if (tl <= tn || tn < th) - return MGrade; - } else { + if (th < tl) { /* crosses midnight */ + if (tl <= tn || tn < th) + return MGrade; + } else { if (tl <= tn && tn < th) return MGrade; } @@ -996,7 +993,7 @@ register char *cp; * Compare strings: s1>s2: >0 s1==s2: 0 s1s2: >0 s1==s2: 0 s1= 0, "BAD SPEED", CNULL, speed); } - diff --git a/src/cmd/uucp/cpmv.c b/src/cmd/uucp/cpmv.c index 568920a..3bd555f 100644 --- a/src/cmd/uucp/cpmv.c +++ b/src/cmd/uucp/cpmv.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)cpmv.c 5.5 (Berkeley) 10/9/85"; -#endif - #include "uucp.h" #include @@ -12,13 +8,12 @@ static char sccsid[] = "@(#)cpmv.c 5.5 (Berkeley) 10/9/85"; * * return - SUCCESS | FAIL */ -xcp(f1, f2) +int xcp(f1, f2) char *f1, *f2; { char buf[BUFSIZ]; register int len; register int fp1, fp2; - char *lastpart(); char full[MAXFULLNAME]; struct stat s; @@ -48,13 +43,12 @@ char *f1, *f2; return len < 0 ? FAIL: SUCCESS; } - /* * move f1 to f2 * * return 0 ok | FAIL failed */ -xmv(f1, f2) +int xmv(f1, f2) register char *f1, *f2; { register int ret; diff --git a/src/cmd/uucp/expfile.c b/src/cmd/uucp/expfile.c index 333d379..12e7085 100644 --- a/src/cmd/uucp/expfile.c +++ b/src/cmd/uucp/expfile.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)expfile.c 5.5 (Berkeley) 6/19/85"; -#endif - #include "uucp.h" #include #include @@ -15,8 +11,7 @@ static char sccsid[] = "@(#)expfile.c 5.5 (Berkeley) 6/19/85"; * 1 - Other normal file * FAIL - no Wrkdir name available */ - -expfile(file) +int expfile(file) char *file; { register char *fpart, *p; @@ -35,7 +30,7 @@ char *file; if (!*user || gninfo(user, &uid, full) != 0) { strcpy(full, PUBDIR); } - + strcat(full, fpart); strcpy(file, full); return 1; @@ -59,8 +54,7 @@ char *file; * * return codes: 0 - not directory | 1 - is directory */ - -isdir(name) +int isdir(name) char *name; { register int ret; @@ -74,14 +68,12 @@ char *name; return 0; } - /* * make all necessary directories * * return SUCCESS | FAIL */ - -mkdirs(name) +int mkdirs(name) char *name; { int ret, mask; @@ -112,8 +104,7 @@ char *name; * * return code - SUCCESS - ok; FAIL if expfile failed */ - -ckexpf(file) +int ckexpf(file) register char *file; { diff --git a/src/cmd/uucp/fio.c b/src/cmd/uucp/fio.c index 10816cf..1880b15 100644 --- a/src/cmd/uucp/fio.c +++ b/src/cmd/uucp/fio.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)fio.c 5.3 (Berkeley) 10/9/85"; -#endif - /* * flow control protocol. * @@ -20,7 +16,7 @@ static char sccsid[] = "@(#)fio.c 5.3 (Berkeley) 10/9/85"; * PAD X.28 command mode, be sure to disable that access * (PAD par 1). Also make sure both flow control pars * (5 and 12) are set. The CR used in this proto is meant - * to trigger packet transmission, hence par 3 should be + * to trigger packet transmission, hence par 3 should be * set to 2; a good value for the Idle Timer (par 4) is 10. * All other pars should be set to 0. * @@ -58,7 +54,7 @@ static char sccsid[] = "@(#)fio.c 5.3 (Berkeley) 10/9/85"; #define FOBUFSIZ 256 /* for X.25 interfaces: set equal to packet size; * otherwise make as large as feasible to reduce - * number of write system calls + * number of write system calls */ #ifndef MAXMSGLEN @@ -83,7 +79,7 @@ static int (*fsig)(); #define termio sgttyb #endif USG -fturnon() +int fturnon() { int ret; struct termio ttbuf; @@ -109,7 +105,7 @@ fturnon() return SUCCESS; } -fturnoff() +int fturnoff() { (void) signal(SIGALRM, fsig); return SUCCESS; @@ -174,7 +170,7 @@ int fn; char ack, ibuf[MAXMSGLEN]; int flen, mil, retries = 0; long abytes, fbytes; - struct timeb t1, t2; + struct timeval t1, t2; ret = FAIL; retry: @@ -248,7 +244,7 @@ register FILE *fp2; char ibuf[FIBUFSIZ]; int ret, mil, retries = 0; long alen, abytes, fbytes; - struct timeb t1, t2; + struct timeval t1, t2; ret = FAIL; retry: @@ -288,7 +284,7 @@ acct: } sprintf(ibuf, "received data %ld bytes %ld.%02d secs", fbytes, (long)t2.time, mil/10); - if (retries > 0) + if (retries > 0) sprintf(&ibuf[strlen(ibuf)]," %d retries", retries); sysacct(abytes, t2.time); DEBUG(1, "%s\n", ibuf); @@ -546,4 +542,3 @@ dcorr: } return FAIL; } - diff --git a/src/cmd/uucp/gename.c b/src/cmd/uucp/gename.c index b9a6d85..876e1b3 100644 --- a/src/cmd/uucp/gename.c +++ b/src/cmd/uucp/gename.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)gename.c 5.6 (Berkeley) 10/9/85"; -#endif - #include "uucp.h" #include @@ -23,8 +19,7 @@ static char alphabet[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr /* * generate file name */ -gename(pre, sys, grade, file) -char pre, *sys, grade, *file; +void gename(char pre, char *sys, char grade, char *file) { register int i, fd; static char snum[5]; diff --git a/src/cmd/uucp/getargs.c b/src/cmd/uucp/getargs.c index 234b0ed..30caafa 100644 --- a/src/cmd/uucp/getargs.c +++ b/src/cmd/uucp/getargs.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)getargs.c 5.3 (Berkeley) 6/19/85"; -#endif - #include "uucp.h" /*LINTLIBRARY*/ @@ -22,8 +18,7 @@ static char sccsid[] = "@(#)getargs.c 5.3 (Berkeley) 6/19/85"; * * return - the number of subfields, or -1 if >= maxargs. */ - -getargs(s, arps, maxargs) +int getargs(s, arps, maxargs) register char *s; char *arps[]; int maxargs; diff --git a/src/cmd/uucp/getprm.c b/src/cmd/uucp/getprm.c index 31b6e4d..62fd964 100644 --- a/src/cmd/uucp/getprm.c +++ b/src/cmd/uucp/getprm.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)getprm.c 5.4 (Berkeley) 10/9/85"; -#endif - #include "uucp.h" #include @@ -15,7 +11,6 @@ static char sccsid[] = "@(#)getprm.c 5.4 (Berkeley) 10/9/85"; * * return - pointer to next character in s */ - char * getprm(s, prm) register char *s, *prm; diff --git a/src/cmd/uucp/getpwinfo.c b/src/cmd/uucp/getpwinfo.c index 6e54801..5f0c40f 100644 --- a/src/cmd/uucp/getpwinfo.c +++ b/src/cmd/uucp/getpwinfo.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)getpwinfo.c 5.3.1 (2.11BSD) 1997/10/2"; -#endif - #include "uucp.h" #include @@ -13,8 +9,7 @@ static char sccsid[] = "@(#)getpwinfo.c 5.3.1 (2.11BSD) 1997/10/2"; * return codes: SUCCESS | FAIL * */ - -guinfo(uid, name, path) +int guinfo(uid, name, path) int uid; register char *path, *name; { @@ -42,14 +37,12 @@ register char *path, *name; return SUCCESS; } - /* * get passwd file info for name * * return codes: SUCCESS | FAIL */ - -gninfo(name, uid, path) +int gninfo(name, uid, path) char *path, *name; int *uid; { diff --git a/src/cmd/uucp/gio.c b/src/cmd/uucp/gio.c index 5cb45c8..1dd09aa 100644 --- a/src/cmd/uucp/gio.c +++ b/src/cmd/uucp/gio.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)gio.c 5.6 (Berkeley) 10/9/85"; -#endif - #include "uucp.h" #include "pk.h" #include @@ -11,12 +7,15 @@ jmp_buf Failbuf; int Retries = 0; struct pack *Pk; -pkfail() +static int gwrblk(char *blk, int len, int fn); +static int grdblk(char *blk, int len, int fn); + +void pkfail() { longjmp(Failbuf, 1); } -gturnon() +int gturnon() { struct pack *pkopen(); @@ -28,7 +27,7 @@ gturnon() return SUCCESS; } -gturnoff() +int gturnoff() { if(setjmp(Failbuf)) return(FAIL); @@ -36,10 +35,7 @@ gturnoff() return SUCCESS; } - -gwrmsg(type, str, fn) -char type; -register char *str; +int gwrmsg(char type, char *str, int fn) { char bufr[BUFSIZ]; register char *s; @@ -64,7 +60,7 @@ register char *str; } /*ARGSUSED*/ -grdmsg(str, fn) +int grdmsg(str, fn) register char *str; { unsigned len; @@ -82,14 +78,13 @@ register char *str; return SUCCESS; } - -gwrdata(fp1, fn) +int gwrdata(fp1, fn) FILE *fp1; { char bufr[BUFSIZ]; register int len; int ret, mil; - struct timeb t1, t2; + struct timeval t1, t2; long bytes; char text[BUFSIZ]; @@ -97,12 +92,8 @@ FILE *fp1; return FAIL; bytes = 0L; Retries = 0; -#ifdef USG - time(&t1.time); - t1.millitm = 0; -#else - ftime(&t1); -#endif + gettimeofday(&t1, NULL); + while ((len = read(fileno(fp1), bufr, BUFSIZ)) > 0) { bytes += len; ret = gwrblk(bufr, len, fn); @@ -113,35 +104,31 @@ FILE *fp1; break; } ret = gwrblk(bufr, 0, fn); -#ifdef USG - time(&t2.time); - t2.millitm = 0; -#else - ftime(&t2); -#endif + + gettimeofday(&t2, NULL); Now = t2; - t2.time -= t1.time; - mil = t2.millitm - t1.millitm; + t2.tv_sec -= t1.tv_sec; + mil = (t2.tv_usec - t1.tv_usec) / 1000; if (mil < 0) { - --t2.time; + --t2.tv_sec; mil += 1000; } sprintf(text, "sent data %ld bytes %ld.%02d secs", - bytes, (long)t2.time, mil/10); - sysacct(bytes, t2.time); - if (Retries > 0) + bytes, (long)t2.tv_sec, mil/10); + sysacct(bytes, t2.tv_sec); + if (Retries > 0) sprintf((char *)text+strlen(text)," %d retries", Retries); DEBUG(1, "%s\n", text); syslog(text); return SUCCESS; } -grddata(fn, fp2) +int grddata(fn, fp2) FILE *fp2; { register int len; char bufr[BUFSIZ]; - struct timeb t1, t2; + struct timeval t1, t2; int mil; long bytes; char text[BUFSIZ]; @@ -150,12 +137,8 @@ FILE *fp2; return FAIL; bytes = 0L; Retries = 0; -#ifdef USG - time(&t1.time); - t1.millitm = 0; -#else - ftime(&t1); -#endif + gettimeofday(&t1, NULL); + for (;;) { len = grdblk(bufr, BUFSIZ, fn); if (len < 0) { @@ -167,23 +150,18 @@ FILE *fp2; if (len < BUFSIZ) break; } -#ifdef USG - time(&t2.time); - t2.millitm = 0; -#else - ftime(&t2); -#endif + gettimeofday(&t2, NULL); Now = t2; - t2.time -= t1.time; - mil = t2.millitm - t1.millitm; + t2.tv_sec -= t1.tv_sec; + mil = (t2.tv_usec - t1.tv_usec) / 1000; if (mil < 0) { - --t2.time; + --t2.tv_sec; mil += 1000; } sprintf(text, "received data %ld bytes %ld.%02d secs", - bytes, (long)t2.time, mil/10); - sysacct(bytes, t2.time); - if (Retries > 0) + bytes, (long)t2.tv_sec, mil/10); + sysacct(bytes, t2.tv_sec); + if (Retries > 0) sprintf((char *)text+strlen(text)," %d retries", Retries); DEBUG(1, "%s\n", text); syslog(text); @@ -197,7 +175,7 @@ static int tc = TC; #endif /*ARGSUSED*/ -grdblk(blk, len, fn) +int grdblk(blk, len, fn) register int len; char *blk; { @@ -222,7 +200,7 @@ char *blk; } /*ARGSUSED*/ -gwrblk(blk, len, fn) +int gwrblk(blk, len, fn) register char *blk; { #if !defined(BSD4_2) && !defined(USG) @@ -232,5 +210,5 @@ register char *blk; ultouch(); } #endif - return pkwrite(Pk, blk, len); + return pkwrite(Pk, blk, len); } diff --git a/src/cmd/uucp/gnamef.c b/src/cmd/uucp/gnamef.c index ea964d6..e574e2e 100644 --- a/src/cmd/uucp/gnamef.c +++ b/src/cmd/uucp/gnamef.c @@ -1,13 +1,4 @@ -#ifndef lint -static char sccsid[] = "@(#)gnamef.c 5.4 (Berkeley) 6/20/85"; -#endif - #include "uucp.h" -#ifdef NDIR -#include "ndir.h" -#else -#include -#endif /*LINTLIBRARY*/ @@ -18,8 +9,7 @@ static char sccsid[] = "@(#)gnamef.c 5.4 (Berkeley) 6/20/85"; * 0 - end of directory read * 1 - returned name */ - -gnamef(dirp, filename) +int gnamef(dirp, filename) register DIR *dirp; register char *filename; { diff --git a/src/cmd/uucp/gnsys.c b/src/cmd/uucp/gnsys.c index ca8803f..9f7f6e1 100644 --- a/src/cmd/uucp/gnsys.c +++ b/src/cmd/uucp/gnsys.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)gnsys.c 5.4.1 (2.11BSD) 1997/10/31"; -#endif - #include "uucp.h" #include #ifdef NDIR @@ -13,6 +9,8 @@ static char sccsid[] = "@(#)gnsys.c 5.4.1 (2.11BSD) 1997/10/31"; #define LSIZE 128 /* number of systems to store */ #define WSUFSIZE 6 /* work file name suffix size */ +static int srchst(char *name, char **list, int n); + /*LINTLIBRARY*/ /* @@ -26,9 +24,7 @@ static char sccsid[] = "@(#)gnsys.c 5.4.1 (2.11BSD) 1997/10/31"; * SUCCESS - no more names * FAIL - bad directory */ - -gnsys(sname, dir, pre) -char *sname, *dir, pre; +int gnsys(char *sname, char *dir, char pre) { register char *s, *p1, *p2; char px[3]; @@ -114,8 +110,7 @@ retry: * return codes: * n - the number of items in the list */ - -srchst(name, list, n) +int srchst(name, list, n) char *name; register char **list; int n; diff --git a/src/cmd/uucp/gnxseq.c b/src/cmd/uucp/gnxseq.c index dea4fca..daa7ec2 100644 --- a/src/cmd/uucp/gnxseq.c +++ b/src/cmd/uucp/gnxseq.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)gnxseq.c 5.4 (Berkeley) 6/20/85"; -#endif - #include "uucp.h" #ifdef BSD4_2 #include diff --git a/src/cmd/uucp/imsg.c b/src/cmd/uucp/imsg.c index 8f51fe1..3995193 100644 --- a/src/cmd/uucp/imsg.c +++ b/src/cmd/uucp/imsg.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)imsg.c 5.3 (Berkeley) 1/6/86"; -#endif - #include "uucp.h" #include @@ -9,7 +5,7 @@ char Msync[2] = "\020"; /* to talk to both eunice and x.25 without also screwing up tcp/ip * we must adaptively choose what character to end the msg with - * + * * The idea is that initially we send ....\000\n * Then, after they have sent us a message, we use the first character * they send. @@ -26,8 +22,7 @@ char Mend = '\0'; * FAIL - no more messages * SUCCESS - message returned */ - -imsg(amsg, fn) +int imsg(amsg, fn) char *amsg; register int fn; { @@ -42,7 +37,7 @@ register int fn; c &= 0177; if (c == '\n' || c == '\r') DEBUG(5, "%c", c); - else + else DEBUG(5, (isprint(c) || isspace(c)) ? "%c" : "\\%o", c & 0377); if (c == Msync[0]) { @@ -68,18 +63,13 @@ register int fn; return foundsync; } - /* * this is the initial write message routine - * used before a protocol is agreed upon. * * return code: always 0 */ - -omsg(type, msg, fn) -register char *msg; -char type; -int fn; +int omsg(char type, char *msg, int fn) { char buf[MAXFULLNAME]; register char *c; @@ -92,7 +82,7 @@ int fn; *c++ = *msg++; *c++ = '\0'; DEBUG(5, "omsg <%s>\n", buf); - if (seenend) + if (seenend) c[-1] = Mend; else *c++ = '\n'; diff --git a/src/cmd/uucp/lastpart.c b/src/cmd/uucp/lastpart.c index 4b64022..a9d3e91 100644 --- a/src/cmd/uucp/lastpart.c +++ b/src/cmd/uucp/lastpart.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)lastpart.c 5.4 (Berkeley) 6/20/85"; -#endif - #include #include "uucp.h" @@ -12,7 +8,6 @@ static char sccsid[] = "@(#)lastpart.c 5.4 (Berkeley) 6/20/85"; * * return - pointer to last part */ - char * lastpart(file) register char *file; diff --git a/src/cmd/uucp/logent.c b/src/cmd/uucp/logent.c index 9aa85db..a94eaed 100644 --- a/src/cmd/uucp/logent.c +++ b/src/cmd/uucp/logent.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)logent.c 5.6 (Berkeley) 10/9/85"; -#endif - #include "uucp.h" #ifdef BSD4_2 #include @@ -11,18 +7,21 @@ static char sccsid[] = "@(#)logent.c 5.6 (Berkeley) 10/9/85"; #if defined(USG) || defined(BSD4_2) #include #endif +#include static FILE *Lp = NULL; static FILE *Sp = NULL; -static Ltried = 0; -static Stried = 0; +static int Ltried = 0; +static int Stried = 0; + +static void mlogent(FILE *fp, char *status, char *text); /*LINTLIBRARY*/ /* * make log entry */ -logent(text, status) +void logent(text, status) char *text, *status; { #ifdef LOGBYSITE @@ -73,12 +72,11 @@ char *text, *status; /* * make a log entry */ - -mlogent(fp, status, text) +void mlogent(fp, status, text) char *text, *status; register FILE *fp; { - static pid = 0; + static int pid = 0; register struct tm *tp; extern struct tm *localtime(); @@ -88,13 +86,10 @@ register FILE *fp; status = ""; if (!pid) pid = getpid(); -#ifdef USG - time(&Now.time); - Now.millitm = 0; -#else - ftime(&Now); -#endif - tp = localtime(&Now.time); + + gettimeofday(&Now, NULL); + + tp = localtime(&Now.tv_sec); #ifdef USG fprintf(fp, "%s %s (%d/%d-%2.2d:%2.2d-%d) ", #else @@ -125,7 +120,7 @@ register FILE *fp; /* * close log file */ -logcls() +void logcls() { if (Lp != NULL) fclose(Lp); @@ -138,11 +133,10 @@ logcls() Stried = 0; } - /* * make system log entry */ -syslog(text) +void syslog(text) char *text; { register struct tm *tp; @@ -185,23 +179,19 @@ char *text; fioclex(fileno(Sp)); } -#ifdef USG - time(&Now.time); - Now.millitm = 0; -#else - ftime(&Now); -#endif - tp = localtime(&Now.time); + gettimeofday(&Now, NULL); + + tp = localtime(&Now.tv_sec); fprintf(Sp, "%s %s ", User, Rmtname); #ifdef USG fprintf(Sp, "(%d/%d-%2.2d:%2.2d) ", tp->tm_mon + 1, tp->tm_mday, tp->tm_hour, tp->tm_min); - fprintf(Sp, "(%ld) %s\n", Now.time, text); + fprintf(Sp, "(%ld) %s\n", Now.tv_sec, text); #else fprintf(Sp, "(%d/%d-%02d:%02d) ", tp->tm_mon + 1, tp->tm_mday, tp->tm_hour, tp->tm_min); - fprintf(Sp, "(%ld.%02u) %s\n", Now.time, Now.millitm/10, text); + fprintf(Sp, "(%ld.%02u) %s\n", Now.tv_sec, Now.tv_usec/10000, text); #endif /* Position at end and flush */ @@ -220,7 +210,7 @@ char *text; #include #endif -fioclex(fd) +void fioclex(fd) int fd; { register int ret; @@ -230,6 +220,7 @@ int fd; #else ret = ioctl(fd, FIOCLEX, STBNULL); #endif - if (ret) + if (ret) { DEBUG(2, "CAN'T FIOCLEX %d\n", fd); + } } diff --git a/src/cmd/uucp/mailst.c b/src/cmd/uucp/mailst.c index f129351..2d182c9 100644 --- a/src/cmd/uucp/mailst.c +++ b/src/cmd/uucp/mailst.c @@ -1,12 +1,12 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)mailst.c 5.6.1 (2.11BSD GTE) 6/11/94"; -#endif - #include #include "uucp.h" #ifdef USG #include #endif +#include + +static FILE *rpopen(char *cmd, char *mode); +static int rpclose(FILE *ptr); /*LINTLIBRARY*/ @@ -16,8 +16,7 @@ static char sccsid[] = "@(#)mailst.c 5.6.1 (2.11BSD GTE) 6/11/94"; * If file is non-null, the file is also sent. * (this is used for mail returned to sender.) */ - -mailst(user, str, file) +void mailst(user, str, file) char *user, *str, *file; { register FILE *fp, *fi; @@ -53,7 +52,7 @@ char *cmd; char *mode; { int p[2]; - register myside, hisside, pid; + register int myside, hisside, pid; if(pipe(p) < 0) return NULL; @@ -82,10 +81,10 @@ char *mode; return(fdopen(myside, mode)); } -rpclose(ptr) +int rpclose(ptr) FILE *ptr; { - register f, r; + register int f, r; register sig_t hstat, istat, qstat; int status; diff --git a/src/cmd/uucp/pk.h b/src/cmd/uucp/pk.h index d138c01..80a2b58 100644 --- a/src/cmd/uucp/pk.h +++ b/src/cmd/uucp/pk.h @@ -126,3 +126,15 @@ struct piocb { }; extern int pksizes[]; + +void pkclose(struct pack *pk); +int pkread(struct pack *pk, char *ibuf, int icount); +int pkwrite(struct pack *pk, char *ibuf, int icount); +int pksack(struct pack *pk); +void pkoutput(struct pack *pk); +void pkgetpack(struct pack *pk); +void pkmove(char *p1, char *p2, int count, int flag); +void pkxstart(struct pack *pk, char cntl, int x); +void pkreset(struct pack *pk); +void pkfail(void); +void pkcntl(int c, struct pack *pk); diff --git a/src/cmd/uucp/pk0.c b/src/cmd/uucp/pk0.c index 4a5a139..7033f23 100644 --- a/src/cmd/uucp/pk0.c +++ b/src/cmd/uucp/pk0.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)pk0.c 5.7.1 (2.11BSD) 1997/10/2"; -#endif - #include "uucp.h" #include "pk.h" @@ -20,15 +16,18 @@ int Reacks; #define PKWTIME 4 #define PKRSKEW 3 #define PKWSKEW 2 + extern int pktimeout, pktimeskew, Ntimeout; +static int pksize(int n); + /* * receive control messages */ -pkcntl(c, pk) +void pkcntl(c, pk) register struct pack *pk; { - register cntl, val; + register int cntl, val; val = c & MOD8; cntl = (c>>3) & MOD8; @@ -109,10 +108,10 @@ register struct pack *pk; pkoutput(pk); } -pkaccept(pk) +int pkaccept(pk) register struct pack *pk; { - register x, seq; + register int x, seq; char m, cntl, *p, imask, **bp; int bad, accept, skip, t, cc; unsigned short sum; @@ -230,12 +229,12 @@ free: } /*ARGSUSED*/ -pkread(pk, ibuf, icount) +int pkread(pk, ibuf, icount) register struct pack *pk; char *ibuf; int icount; { - register x; + register int x; int is, cc, xfr, count; char *cp, **bp; @@ -293,17 +292,17 @@ int icount; } /*ARGSUSED*/ -pkwrite(pk, ibuf, icount) +int pkwrite(pk, ibuf, icount) register struct pack *pk; char *ibuf; int icount; { - register x; + register int x; int partial; caddr_t cp; int cc, fc, count; - if (pk->p_state&DOWN || !pk->p_state&LIVE) { + if ((pk->p_state & DOWN) || !(pk->p_state & LIVE)) { return -1; } @@ -349,10 +348,10 @@ int icount; return count; } -pksack(pk) +int pksack(pk) register struct pack *pk; { - register x, i; + register int x, i; i = 0; for(x=pk->p_ps; x!=pk->p_rpr; ) { @@ -369,10 +368,10 @@ register struct pack *pk; return i; } -pkoutput(pk) +void pkoutput(pk) register struct pack *pk; { - register x; + register int x; int i; char bstate; @@ -476,10 +475,10 @@ out: * releasing space and turning off line discipline */ /*ARGSUSED*/ -pkclose(pk) +void pkclose(pk) register struct pack *pk; { - register i; + register int i; char **bp; int rcheck = 0; @@ -543,28 +542,27 @@ register struct pack *pk; free((char *)pk); } -pkreset(pk) +void pkreset(pk) register struct pack *pk; { - pk->p_ps = pk->p_pr = pk->p_rpr = 0; pk->p_nxtps = 1; } #ifndef BSD4_2 -bzero(s,n) +void bzero(s,n) register char *s; -register n; +register int n; { while (n--) *s++ = 0; } #endif -pksize(n) -register n; +int pksize(n) +register int n; { - register k; + register int k; n >>= 5; for(k=0; n >>= 1; k++) diff --git a/src/cmd/uucp/pk1.c b/src/cmd/uucp/pk1.c index 7a01236..e3df3b8 100644 --- a/src/cmd/uucp/pk1.c +++ b/src/cmd/uucp/pk1.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)pk1.c 5.9.2 (2.11BSD) 1997/10/2"; -#endif - #include #include #include "uucp.h" @@ -32,6 +28,7 @@ int Connodata = 0; int Ntimeout = 0; int pktimeout = 4; int pktimeskew = 2; + /* * packet driver support routines * @@ -39,10 +36,12 @@ int pktimeskew = 2; extern struct pack *pklines[]; +static int pkcget(int fn, char *b, int n); +static void pkdata(char c, unsigned short sum, struct pack *pk, char **bp); + /* * start initial synchronization. */ - struct pack * pkopen(ifn, ofn) int ifn, ofn; @@ -120,11 +119,11 @@ int pksizes[] = { }; #define GETRIES 10 + /* * Pseudo-dma byte collection. */ - -pkgetpack(pk) +void pkgetpack(pk) register struct pack *pk; { int k, tries, noise; @@ -217,13 +216,9 @@ register struct pack *pk; } } -pkdata(c, sum, pk, bp) -char c; -unsigned short sum; -register struct pack *pk; -char **bp; +void pkdata(char c, unsigned short sum, register struct pack *pk, char **bp) { - register x; + register int x; int t; char m; @@ -254,6 +249,7 @@ slot: * setup input transfers */ #define PKMAXBUF 128 + /* * Start transmission on output device associated with pk. * For asynch devices (t_line==1) framing is @@ -261,10 +257,7 @@ slot: * in the driver (t_line==2) the transfer is * passed on to the driver. */ -pkxstart(pk, cntl, x) -register struct pack *pk; -char cntl; -register x; +void pkxstart(register struct pack *pk, char cntl, register int x) { register char *p; short checkword; @@ -319,8 +312,7 @@ register x; pkoutput(pk); } - -pkmove(p1, p2, count, flag) +void pkmove(p1, p2, count, flag) char *p1, *p2; int count, flag; { @@ -338,7 +330,6 @@ int count, flag; *d++ = *s++; } - /* * get n characters from input * @@ -348,12 +339,13 @@ int count, flag; */ jmp_buf Getjbuf; -cgalarm() + +void cgalarm() { longjmp(Getjbuf, 1); } -pkcget(fn, b, n) +int pkcget(fn, b, n) int fn; register char *b; register int n; @@ -423,7 +415,7 @@ register int n; logent(strerror(errno),"FAILED pkcget Read"); longjmp(Sjbuf, 6); } - b += ret; + b += ret; n -= ret; } alarm(0); diff --git a/src/cmd/uucp/prefix.c b/src/cmd/uucp/prefix.c index 0b5d149..d155898 100644 --- a/src/cmd/uucp/prefix.c +++ b/src/cmd/uucp/prefix.c @@ -1,17 +1,12 @@ -#ifndef lint -static char sccsid[] = "@(#)prefix.c 5.3 (Berkeley) 6/20/85"; -#endif - /*LINTLIBRARY*/ /* * check s2 for prefix s1 * * return 0 - != - * return 1 - == + * return 1 - == */ - -prefix(s1, s2) +int prefix(s1, s2) register char *s1, *s2; { register char c; @@ -26,9 +21,9 @@ register char *s1, *s2; * check s2 for prefix s1 with a wildcard character ? * * return 0 - != - * return 1 - == + * return 1 - == */ - +int wprefix(s1, s2) register char *s1, *s2; { diff --git a/src/cmd/uucp/setline.c b/src/cmd/uucp/setline.c index 6587b04..05369ba 100644 --- a/src/cmd/uucp/setline.c +++ b/src/cmd/uucp/setline.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)setline.c 5.3 (Berkeley) 6/20/85"; -#endif - #include "uucp.h" #ifdef USG #include @@ -20,8 +16,7 @@ static char sccsid[] = "@(#)setline.c 5.3 (Berkeley) 6/20/85"; * return code - none */ /*ARGSUSED*/ -setupline(type) -char type; +void setupline(char type) { #ifdef USG static struct termio tbuf, sbuf; diff --git a/src/cmd/uucp/subdir.c b/src/cmd/uucp/subdir.c index 5634803..2e29d4a 100644 --- a/src/cmd/uucp/subdir.c +++ b/src/cmd/uucp/subdir.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)subdir.c 5.4 (Berkeley) 6/23/85"; -#endif - #include "uucp.h" /*LINTLIBRARY*/ @@ -85,7 +81,7 @@ char *as; /* * save away filename */ -subchdir(s) +int subchdir(s) register char *s; { inspool = (strcmp(s, Spool) == 0); @@ -99,10 +95,12 @@ char * subdir(d, pre) register char *d, pre; { - if (strcmp(d, Spool) == 0) - if (pre == CMDPRE) + if (strcmp(d, Spool) == 0) { + if (pre == CMDPRE) { return CMDSDIR; - else if (pre == XQTPRE) + } else if (pre == XQTPRE) { return XEQTDIR; + } + } return d; } diff --git a/src/cmd/uucp/sysacct.c b/src/cmd/uucp/sysacct.c index 6738191..060315e 100644 --- a/src/cmd/uucp/sysacct.c +++ b/src/cmd/uucp/sysacct.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)sysacct.c 5.3 (Berkeley) 6/23/85"; -#endif - #include /*LINTLIBRARY*/ @@ -11,7 +7,7 @@ static char sccsid[] = "@(#)sysacct.c 5.3 (Berkeley) 6/23/85"; */ /*ARGSUSED*/ -sysacct(bytes, time) +void sysacct(bytes, time) time_t time; long bytes; { diff --git a/src/cmd/uucp/systat.c b/src/cmd/uucp/systat.c index 5ac1f74..5131594 100644 --- a/src/cmd/uucp/systat.c +++ b/src/cmd/uucp/systat.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)systat.c 5.4 (Berkeley) 6/23/85"; -#endif - #include "uucp.h" #define STATNAME(f, n) sprintf(f, "%s/%s/%s", Spool, "STST", n) @@ -13,7 +9,7 @@ static char sccsid[] = "@(#)systat.c 5.4 (Berkeley) 6/23/85"; * make system status entry * return codes: none */ -systat(name, type, text) +void systat(name, type, text) char *name, *text; int type; { @@ -71,8 +67,7 @@ int type; * * return codes: none */ - -rmstat(name) +void rmstat(name) char *name; { char filename[MAXFULLNAME]; @@ -86,8 +81,7 @@ char *name; * * return codes 0 - ok | >0 system status */ - -callok(name) +int callok(name) char *name; { char filename[MAXFULLNAME], line[S_SIZE]; diff --git a/src/cmd/uucp/tio.c b/src/cmd/uucp/tio.c index abaa388..f939d43 100644 --- a/src/cmd/uucp/tio.c +++ b/src/cmd/uucp/tio.c @@ -1,14 +1,9 @@ -#ifndef lint -static char sccsid[] = "@(#)tio.c 4.6 (Berkeley) 1/24/86"; -#endif - #include #include "uucp.h" #include #include #include -extern int pkfail(); #define TPACKSIZE 512 #define TBUFSIZE 1024 #define LBUFSIZE 128 @@ -95,7 +90,7 @@ FILE *fp1; struct tbuf bufr; register int len; int ret, mil; - struct timeb t1, t2; + struct timeval t1, t2; long bytes; char text[LBUFSIZE]; @@ -159,7 +154,7 @@ FILE *fp2; { register int len, nread; char bufr[TBUFSIZE]; - struct timeb t1, t2; + struct timeval t1, t2; int mil; long bytes, Nbytes; diff --git a/src/cmd/uucp/ulockf.c b/src/cmd/uucp/ulockf.c index d1ed3c2..952153c 100644 --- a/src/cmd/uucp/ulockf.c +++ b/src/cmd/uucp/ulockf.c @@ -1,10 +1,7 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)ulockf.c 5.5.1 (2.11BSD) 1997/10/2"; -#endif - #include "uucp.h" #include #include +#include #define LCKMODE 0444 /* File mode for lock files */ #define MAXLOCKS 16 /* Maximum number of lock files */ @@ -13,6 +10,8 @@ char *Lockfile[MAXLOCKS]; char *LockDirectory = LOCKDIR; int Nlocks = 0; +static int onelock(int pid, char *tempfile, char *name); + /*LINTLIBRARY*/ /* @@ -21,7 +20,7 @@ int Nlocks = 0; * * return codes: SUCCESS | FAIL */ -ulockf(hfile, atime) +int ulockf(hfile, atime) char *hfile; time_t atime; { @@ -85,7 +84,7 @@ time_t atime; /* * remove all lock files in list or name */ -rmlock(name) +void rmlock(name) register char *name; { register int i; @@ -110,7 +109,7 @@ register char *name; * makes lock a name on behalf of pid. Tempfile must be in the same * file system as name. */ -onelock(pid, tempfile, name) +int onelock(pid, tempfile, name) int pid; char *tempfile, *name; { diff --git a/src/cmd/uucp/uuclean.c b/src/cmd/uucp/uuclean.c index 178636d..14aec04 100644 --- a/src/cmd/uucp/uuclean.c +++ b/src/cmd/uucp/uuclean.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)uuclean.c 5.6 (Berkeley) 10/9/85"; -#endif - #include #include "uucp.h" #include @@ -12,6 +8,11 @@ static char sccsid[] = "@(#)uuclean.c 5.6 (Berkeley) 10/9/85"; #include #endif +static void stpre(char *p); +static int chkpre(char *file); +static void notfyuser(char *file); +static void sdmail(char *file, int uid); + /* * * this program will search through the spool @@ -34,9 +35,9 @@ static char sccsid[] = "@(#)uuclean.c 5.6 (Berkeley) 10/9/85"; #define NOMTIME 72 /* hours to age files before deletion */ int checkprefix = 0; -struct timeb Now; +struct timeval Now; -main(argc, argv) +int main(argc, argv) char *argv[]; { DIR *dirp; @@ -62,7 +63,7 @@ char *argv[]; break; case 'p': checkprefix = 1; - if (&argv[1][2] != '\0') + if (argv[1][2] != '\0') stpre(&argv[1][2]); break; case 'x': @@ -115,10 +116,10 @@ char *argv[]; exit(0); } - #define MAXPRE 10 char Pre[MAXPRE][NAMESIZE]; int Npre = 0; + /*** * chkpre(file) check for prefix * char *file; @@ -127,8 +128,7 @@ int Npre = 0; * 0 - not prefix * 1 - is prefix */ - -chkpre(file) +int chkpre(file) char *file; { int i; @@ -146,8 +146,7 @@ char *file; * * return codes: none */ - -stpre(p) +void stpre(p) char *p; { if (Npre < MAXPRE - 2) @@ -160,8 +159,7 @@ char *p; * * return code - none */ - -notfyuser(file) +void notfyuser(file) char *file; { FILE *fp; @@ -195,7 +193,6 @@ char *file; mailst(args[3], msg, CNULL); } - /*** * sdmail(file, uid) * @@ -205,8 +202,7 @@ char *file; * This is only implemented for local system * mail at this time. */ - -sdmail(file, uid) +void sdmail(file, uid) char *file; { static struct passwd *pwd; @@ -224,7 +220,7 @@ char *file; mailst(pwd->pw_name, mstr, CNULL); } -cleanup(code) +void cleanup(code) int code; { exit(code); diff --git a/src/cmd/uucp/uucp.c b/src/cmd/uucp/uucp.c index 8b616b8..f8fb6e8 100644 --- a/src/cmd/uucp/uucp.c +++ b/src/cmd/uucp/uucp.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)uucp.c 5.5 (Berkeley) 10/9/85"; -#endif - #include "uucp.h" #include #include @@ -16,11 +12,11 @@ char Path[100], Optns[10], Ename[MAXBASENAME+1]; char Grade = 'n'; #ifdef DONTCOPY int Copy = 0; -#else +#else int Copy = 1; #endif char Nuser[32]; -struct timeb Now; +struct timeval Now; /* variables used to check if talking to more than one system. */ int xsflag = -1; @@ -30,7 +26,12 @@ long Nbytes = 0; #define MAXBYTES 50000 /* maximun number of bytes of data per C. file */ #define MAXCOUNT 15 /* maximun number of files per C. file */ -main(argc, argv) +static int copy(char *s1, char *f1, char *s2, char *f2); +static void clscfile(void); +static void chsys(char *s1); +static void xuux(char *ename, char *s1, char *f1, char *s2, char *f2, char *opts); + +int main(argc, argv) char *argv[]; { int ret; @@ -100,7 +101,7 @@ char *argv[]; DEBUG(4, "\n\n** %s **\n", "START"); if (!avoidgwd) { cp = getwd(Wrkdir); - ASSERT(cp != 0, "GETWD FAILED", Wrkdir, cp); + ASSERT(cp != 0, "GETWD FAILED", Wrkdir, 0); } ret = subchdir(Spool); ASSERT(ret >= 0, "CHDIR FAILED", Spool, ret); @@ -183,7 +184,7 @@ char *argv[]; cleanup(0); } -cleanup(code) +void cleanup(code) int code; { logcls(); @@ -193,14 +194,12 @@ int code; exit(code); } - /* * generate copy files * * return codes 0 | FAIL */ - -copy(s1, f1, s2, f2) +int copy(s1, f1, s2, f2) register char *s1, *f1, *s2, *f2; { int type, statret; @@ -369,8 +368,7 @@ register char *s1, *f1, *s2, *f2; * * return code - none */ - -xuux(ename, s1, f1, s2, f2, opts) +void xuux(ename, s1, f1, s2, f2, opts) char *ename, *s1, *s2, *f1, *f2, *opts; { char cmd[200]; @@ -396,7 +394,6 @@ char Cfile[NAMESIZE]; * * return an open file descriptor */ - FILE * gtcfile(sys) register char *sys; @@ -416,7 +413,7 @@ register char *sys; gename(CMDPRE, sys, Grade, Cfile); #ifdef VMS savemask = umask(~0600); /* vms must have read permission */ -#else +#else savemask = umask(~0200); #endif Cfp = fopen(subfile(Cfile), "w"); @@ -432,8 +429,7 @@ register char *sys; * * return code - none */ - -clscfile() +void clscfile() { if (Cfp == NULL) return; @@ -447,7 +443,7 @@ clscfile() /* * compile a list of all systems we are referencing */ -chsys(s1) +void chsys(s1) register char *s1; { if (xsflag < 0) diff --git a/src/cmd/uucp/uucp.h b/src/cmd/uucp/uucp.h index 7e91841..5ba647d 100644 --- a/src/cmd/uucp/uucp.h +++ b/src/cmd/uucp/uucp.h @@ -6,14 +6,13 @@ #include #include #include +#include - -struct timeb { - time_t time; - u_short millitm; - short timezone; - short dstflag; -}; +#ifdef NDIR +#include "ndir.h" +#else +#include +#endif /* * Determine local uucp name of this machine. @@ -48,11 +47,11 @@ struct timeb { * If everything fails, it uses "unknown" for the system name. */ #define GETHOSTNAME /**/ -/* #define UNAME /**/ -/* #define WHOAMI /**/ -/* #define CCWHOAMI /**/ -/* #define UUNAME /**/ -/* #define GETMYHNAME /**/ +// #define UNAME /**/ +// #define WHOAMI /**/ +// #define CCWHOAMI /**/ +// #define UUNAME /**/ +// #define GETMYHNAME /**/ /* If the above fails ... */ #define MYNAME "wlonex" @@ -62,38 +61,38 @@ struct timeb { * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT. */ #include -/*#define EX_NOINPUT 66 /**/ -/*#define EX_NOHOST 68 /**/ -/*#define EX_CANTCREAT 73 /**/ +//#define EX_NOINPUT 66 /**/ +//#define EX_NOHOST 68 /**/ +//#define EX_CANTCREAT 73 /**/ /* * Define the various kinds of connections to include. * The complete list is in the condevs array in condevs.c */ -/* #define ATT2224 /* AT&T 2224 */ +// #define ATT2224 /* AT&T 2224 */ //#define BSDTCP /* 4.2bsd or 2.9bsd TCP/IP */ -/* #define CDS224 /* Concord Data Systems 2400 */ -/* #define DATAKIT /* ATT's datakit */ -/* #define DF02 /* Dec's DF02/DF03 */ -/* #define DF112 /* Dec's DF112 */ -/* #define DN11 /* "standard" DEC dialer */ +// #define CDS224 /* Concord Data Systems 2400 */ +// #define DATAKIT /* ATT's datakit */ +// #define DF02 /* Dec's DF02/DF03 */ +// #define DF112 /* Dec's DF112 */ +// #define DN11 /* "standard" DEC dialer */ #define HAYES /* Hayes' Smartmodem */ -/* #define HAYES2400 /* Hayes' 2400 baud Smartmodem */ -/* #define MICOM /* Micom Mux port */ -/* #define NOVATION /* Novation modem */ -/* #define PAD /* X.25 PAD */ -/* #define PENRIL /* PENRIL Dialer */ -/* #define PNET /* Purdue network */ -/* #define RVMACS /* Racal-Vadic MACS 820 dialer, 831 adaptor */ -/* #define SYTEK /* Sytek Local Area Net */ -/* #define UNETTCP /* 3Com's UNET */ -/* #define USR2400 /* USRobotics Courier 2400 */ -/* #define VA212 /* Racal-Vadic 212 */ -/* #define VA811S /* Racal-Vadic 811S dialer, 831 adaptor */ -/* #define VA820 /* Racal-Vadic 820 dialer, 831 adaptor */ -/* #define VADIC /* Racal-Vadic 345x */ -/* #define VENTEL /* Ventel Dialer */ -/* #define VMACS /* Racal-Vadic MACS 811 dialer, 831 adaptor */ +// #define HAYES2400 /* Hayes' 2400 baud Smartmodem */ +// #define MICOM /* Micom Mux port */ +// #define NOVATION /* Novation modem */ +// #define PAD /* X.25 PAD */ +// #define PENRIL /* PENRIL Dialer */ +// #define PNET /* Purdue network */ +// #define RVMACS /* Racal-Vadic MACS 820 dialer, 831 adaptor */ +// #define SYTEK /* Sytek Local Area Net */ +// #define UNETTCP /* 3Com's UNET */ +// #define USR2400 /* USRobotics Courier 2400 */ +// #define VA212 /* Racal-Vadic 212 */ +// #define VA811S /* Racal-Vadic 811S dialer, 831 adaptor */ +// #define VA820 /* Racal-Vadic 820 dialer, 831 adaptor */ +// #define VADIC /* Racal-Vadic 345x */ +// #define VENTEL /* Ventel Dialer */ +// #define VMACS /* Racal-Vadic MACS 811 dialer, 831 adaptor */ #if defined(USR2400) && !defined(HAYES) #define HAYES @@ -114,9 +113,9 @@ struct timeb { * Look at uucpdelay() in condevs.c for details. */ #define INTERVALTIMER /**/ -/*#define FASTTIMER /**/ -/*#define FTIME /**/ -/*#define BUSYLOOP /**/ +//#define FASTTIMER /**/ +//#define FTIME /**/ +//#define BUSYLOOP /**/ /* * If your site is using "ndir.h" to retrofit the Berkeley @@ -124,12 +123,12 @@ struct timeb { * You will probably also have to set LIBNDIR in Makefile. * Otherwise, is assumed to have the Berkeley directory definitions. */ -/*#define NDIR /**/ +//#define NDIR /**/ /* * If yours is a BTL system III, IV, V or so-on site, define USG. */ -/*#define USG /**/ +//#define USG /**/ /* * If you are running 4.3bsd, define BSD4_3 and BSD4_2 @@ -139,7 +138,7 @@ struct timeb { */ #define BSD4_3 /**/ #define BSD4_2 /**/ -/*#define BRL4_2 /**/ +//#define BRL4_2 /**/ #if defined(BRL4_2) && !defined(BSD4_2) #define BSD4_2 @@ -149,12 +148,12 @@ struct timeb { /* * If you are running 2.9bsd define BSD2_9 */ -/*#define BSD2_9 /**/ +//#define BSD2_9 /**/ /* * If you are using 'inetd' with 4.2bsd, define BSDINETD */ -/* #define BSDINETD /**/ +// #define BSDINETD /**/ /* * If you are running 4.3bsd, 2.11bsd or BRL 4.2, you are running 'inetd' @@ -164,18 +163,19 @@ struct timeb { #define BSDINETD #endif -/*#define VMSDTR /* Turn on modem control on vms(works DTR) for +//#define VMSDTR + /* Turn on modem control on vms(works DTR) for develcon and gandalf ports to gain access */ /* * If you want to use the same modem for dialing in and out define * DIALINOUT to be the localtion of the acucntrl program */ -/* #define DIALINOUT "/usr/libexec/acucntrl" /**/ +// #define DIALINOUT "/usr/libexec/acucntrl" /**/ /* * If you want all ACU lines to be DIALINOUT, define ALLACUINOUT */ -/* #define ALLACUINOUT /**/ +// #define ALLACUINOUT /**/ /* define the value of WFMASK - for umask call - used for all uucp work files */ #define WFMASK 0137 @@ -205,7 +205,7 @@ struct timeb { * know where the LCK files are kept, and you have to change your /etc/rc * if your rc cleans out the lock files (as it should). */ -/*#define LOCKDIR "LCK" /**/ +//#define LOCKDIR "LCK" /**/ #define LOCKDIR "." /**/ /* @@ -221,14 +221,14 @@ struct timeb { * If you are not going to use it (hint: you are not), * do not define GNXSEQ. This saves precious room on PDP11s. */ -/*#define GNXSEQ /* comment this out to save space */ +//#define GNXSEQ /* comment this out to save space */ /* * If you want the logfile stored in a file for each site instead * of one file * define LOGBYSITE as the directory to put the files in */ -/*#define LOGBYSITE "/usr/spool/uucp/LOG" /**/ +//#define LOGBYSITE "/usr/spool/uucp/LOG" /**/ #define XQTDIR "/usr/spool/uucp/XTMP" #define SQFILE "/etc/uucp/SQFILE" @@ -314,15 +314,6 @@ struct timeb { #define MAXPH 60 /* maximum length of a phone number */ - /* This structure tells how to get to a device */ -struct condev { - char *CU_meth; /* method, such as 'ACU' or 'DIR' */ - char *CU_brand; /* brand, such as 'Hayes' or 'Vadic' */ - int (*CU_gen)(); /* what to call to search for brands */ - int (*CU_open)(); /* what to call to open brand */ - int (*CU_clos)(); /* what to call to close brand */ -}; - /* This structure tells about a device */ struct Devices { #define D_type D_arg[0] @@ -337,6 +328,16 @@ struct Devices { char D_argbfr[100]; }; + /* This structure tells how to get to a device */ +struct condev { + char *CU_meth; /* method, such as 'ACU' or 'DIR' */ + char *CU_brand; /* brand, such as 'Hayes' or 'Vadic' */ + int (*CU_gen)(char *flds[]); /* what to call to search for brands */ + int (*CU_open)(char *telno, char *flds[], struct Devices *dev); + /* what to call to open brand */ + int (*CU_clos)(int fd); /* what to call to close brand */ +}; + /* system status stuff */ #define SS_OK 0 #define SS_NODEVICE 1 @@ -366,21 +367,11 @@ struct Devices { #define WKDSIZE 100 /* size of work dir name */ #include -#ifndef USG -//#include -#else -struct timeb -{ - time_t time; - unsigned short millitm; - short timezone; - short dstflag; -}; + #define rindex strrchr #define index strchr -#endif -extern struct timeb Now; +extern struct timeval Now; extern int Ifn, Ofn; extern char *Rmtname; @@ -400,11 +391,7 @@ extern int (*CU_end)(); extern struct condev condevs[]; extern char NOLOGIN[]; -extern char DLocal[], DLocalX[], *subfile(), *subdir(); - -/* Commonly called routines which return non-int value */ -extern char *fdig(), *cfgets(); -extern FILE *rpopen(); +extern char DLocal[], DLocalX[]; extern char _FAILED[], CANTOPEN[], DEVNULL[]; @@ -422,3 +409,76 @@ extern int main(); #endif #define DEBUG(a,b,c) #endif + +void logent(char *text, char *status); +void getnextfd(void); +int fixline(int tty, int spwant); +int dochat(struct Devices *dev, char *flds[], int fd); +int expect(char *str, int fn); +void rmlock(char *name); +int guinfo(int uid, char *name, char *path); +void uucpname(char *name); +void assert(char *s1, char *s2, int i1); +void chkdebug(void); +int subchdir(char *s); +void fixmode(int tty); +int omsg(char type, char *msg, int fn); +int imsg(char *amsg, int fn); +int versys(char **nameptr); +int ulockf(char *hfile, time_t atime); +int callback(char *name); +void systat(char *name, int type, char *text); +void gename(char pre, char *sys, char grade, char *file); +char *subfile(char *as); +void xuucico(char *rmtname); +int callok(char *name); +void clsacu(void); +int gnsys(char *sname, char *dir, char pre); +int conn(char *system); +int startup(int role); +int cntrl(int role, char *wkpre); +void rmstat(char *name); +void logcls(void); +void xuuxqt(void); +void fioclex(int fd); +void cleanup(int code); +int gninfo(char *name, int *uid, char *path); +int prefix(char *s1, char *s2); +int wprefix(char *s1, char *s2); +char *cfgets(char *buf, int siz, FILE *fil); +int getargs(char *s, char *arps[], int maxargs); +int mkdirs(char *name); +int xmv(char *f1, char *f2); +char *subdir(char *d, char pre); +int gnamef(DIR *dirp, char *filename); +int iswrk(char *file, char *reqst, char *dir, char *pre); +int gturnon(void); +int gturnoff(void); +int grdmsg(char *str, int fn); +int gwrmsg(char type, char *str, int fn); +int grddata(int fn, FILE *fp); +int gwrdata(FILE *fp, int fn); +void setupline(char type); +int gtwvec(char *file, char *dir, char *wkpre, char **wrkvec); +int expfile(char *file); +int chkpth(char *logname, char *mchname, char *path); +int chkperm(char *file, char *mopt); +void xuucp(char *str); +int isdir(char *name); +char *lastpart(char *file); +int anyread(char *file); +void mailst(char *user, char *str, char *file); +void sysacct(long bytes, time_t time); +void syslog(char *text); +int chksum(char *s, int n); +int snccmp(char *s1, char *s2); +int rddev(FILE *fp, struct Devices *dev); +void alarmtr(int sig); +int nulldev(void); +int diropn(char *flds[]); +void genbrk(int fn, int bnulls); +void exphone(char *in, char *out); +int ckexpf(char *file); +int xcp(char *f1, char *f2); +char *getprm(char *s, char *prm); +int gtwrkf(char *dir, char *file); diff --git a/src/cmd/uucp/uucpd.c b/src/cmd/uucp/uucpd.c index 2aa3deb..d90a66e 100644 --- a/src/cmd/uucp/uucpd.c +++ b/src/cmd/uucp/uucpd.c @@ -1,7 +1,3 @@ -#if defined(DOSCCS) && !defined(lint) -static char sccsid[] = "@(#)uucpd.c 5.4.1 (2.11BSD GTE) 1/1/94"; -#endif - /* * 4.2BSD or 2.9BSD TCP/IP server for uucico * uucico's TCP channel causes this server to be run at the remote end. @@ -98,7 +94,7 @@ char **argv; for(;;) { s = accept(tcp_socket, &hisctladdr, &hisaddrlen); if (s < 0){ - if (errno == EINTR) + if (errno == EINTR) continue; perror("uucpd: accept"); exit(1); diff --git a/src/cmd/uucp/uucpdefs.c b/src/cmd/uucp/uucpdefs.c index d99f908..61cece5 100644 --- a/src/cmd/uucp/uucpdefs.c +++ b/src/cmd/uucp/uucpdefs.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)uucpdefs.c 5.5.1 (2.11BSD) 1996/11/27"; -#endif - #include "uucp.h" char Progname[64]; diff --git a/src/cmd/uucp/uucpname.c b/src/cmd/uucp/uucpname.c index e485067..69c4883 100644 --- a/src/cmd/uucp/uucpname.c +++ b/src/cmd/uucp/uucpname.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)uucpname.c 5.5 (Berkeley) 10/9/85"; -#endif - #include "uucp.h" #include #include @@ -28,7 +24,7 @@ char Myfullname[64]; * * return code - none */ -uucpname(name) +void uucpname(name) register char *name; { register char *s; @@ -119,7 +115,7 @@ register char *name; p = index(s, '\n'); if (p) *p = '\0'; - } + } if (uucpf != NULL) fclose(uucpf); } @@ -190,11 +186,11 @@ int len; register char *p, *q, *nptr; int i; register FILE *fd; - + fd = fopen(HDRFILE, "r"); if (fd == NULL) return(-1); - + hname[0] = 0; nname[0] = 0; nptr = nname; diff --git a/src/cmd/uucp/uudecode.c b/src/cmd/uucp/uudecode.c index 2f67d61..3bab484 100644 --- a/src/cmd/uucp/uudecode.c +++ b/src/cmd/uucp/uudecode.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)uudecode.c 5.3 (Berkeley) 4/10/85"; -#endif - /* * uudecode [input] * @@ -19,7 +15,10 @@ static char sccsid[] = "@(#)uudecode.c 5.3 (Berkeley) 4/10/85"; /* single character decode */ #define DEC(c) (((c) - ' ') & 077) -main(argc, argv) +static void decode(FILE *in, FILE *out); +static void outdec(char *p, FILE *f, int n); + +int main(argc, argv) char **argv; { FILE *in, *out; @@ -98,7 +97,7 @@ char **argv; /* * copy from in to out, decoding as you go along. */ -decode(in, out) +void decode(in, out) FILE *in; FILE *out; { @@ -131,7 +130,7 @@ FILE *out; * be output to file f. n is used to tell us not to * output all of them at the end of the file. */ -outdec(p, f, n) +void outdec(p, f, n) char *p; FILE *f; { @@ -166,10 +165,3 @@ int cnt; } return (cnt); } - -/* - * Return the ptr in sp at which the character c appears; - * NULL if not found - */ - -#define NULL 0 diff --git a/src/cmd/uucp/uuencode.c b/src/cmd/uucp/uuencode.c index 072d9aa..fa94f46 100644 --- a/src/cmd/uucp/uuencode.c +++ b/src/cmd/uucp/uuencode.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)uuencode.c 5.3 (Berkeley) 1/22/85"; -#endif - /* * uuencode [input] output * @@ -11,11 +7,16 @@ static char sccsid[] = "@(#)uuencode.c 5.3 (Berkeley) 1/22/85"; #include #include #include +#include /* ENC is the basic 1 character encoding function to make a char printing */ #define ENC(c) ((c) ? ((c) & 077) + ' ': '`') -main(argc, argv) +static void encode(FILE *in, FILE *out); +static int fr(FILE *fd, char *buf, int cnt); +static void outdec(char *p, FILE *f); + +int main(argc, argv) char **argv; { FILE *in; @@ -51,7 +52,7 @@ char **argv; /* * copy from in to out, encoding as you go along. */ -encode(in, out) +void encode(in, out) FILE *in; FILE *out; { @@ -75,7 +76,7 @@ FILE *out; /* * output one group of 3 bytes, pointed at by p, on file f. */ -outdec(p, f) +void outdec(p, f) char *p; FILE *f; { diff --git a/src/cmd/uucp/uulog.c b/src/cmd/uucp/uulog.c index 0a883c4..22c9afe 100644 --- a/src/cmd/uucp/uulog.c +++ b/src/cmd/uucp/uulog.c @@ -1,14 +1,10 @@ -#ifndef lint -static char sccsid[] = "@(#)uulog.c 5.4 (Berkeley) 6/23/85"; -#endif - #include "uucp.h" #ifndef SYSBUF static char SYSBUF[BUFSIZ]; #endif -main(argc, argv) +int main(argc, argv) char *argv[]; { FILE *plogf; @@ -87,7 +83,7 @@ char *argv[]; exit(0); } -cleanup(code) +void cleanup(code) int code; { exit(code); diff --git a/src/cmd/uucp/uuname.c b/src/cmd/uucp/uuname.c index bc74078..991871f 100644 --- a/src/cmd/uucp/uuname.c +++ b/src/cmd/uucp/uuname.c @@ -1,26 +1,23 @@ -#ifndef lint -static char sccsid[] = "@(#)uuname.c 5.3 (Berkeley) 10/9/85"; -#endif - #include "uucp.h" #include /* - * return list of all remote systems + * return list of all remote systems * recognized by uucp, or (with -l) the local uucp name. * * return codes: 0 | 1 (can't read) */ -struct timeb Now; - -main(argc,argv) +struct timeval Now; + +static void intrEXIT(int inter); + +int main(argc,argv) char *argv[]; int argc; { int ret; int i; - int intrEXIT(); FILE *np; /* Increase buffers for s and prev. cornell!pavel */ char prev[1000]; @@ -52,7 +49,7 @@ int argc; printf("%s (name file) protected\n",SYSFILE); exit(1); } - while ( cfgets(s,sizeof(s),np) != NULL ) { + while (cfgets(s,sizeof(s),np) != NULL ) { for(i=0; s[i]!=' ' && s[i]!='\t'; i++) ; s[i]='\0'; @@ -63,15 +60,16 @@ int argc; printf("%s\n",s); strcpy(prev, s); } - + exit(0); } -intrEXIT(inter) + +void intrEXIT(inter) { exit(inter); } -cleanup(code) +void cleanup(code) int code; { exit(code); diff --git a/src/cmd/uucp/uupoll.c b/src/cmd/uucp/uupoll.c index d2132b4..66ecb5a 100644 --- a/src/cmd/uucp/uupoll.c +++ b/src/cmd/uucp/uupoll.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)uupoll.c 5.5 (Berkeley) 10/9/85"; -#endif - /* * Poll named system(s). * @@ -15,9 +11,9 @@ static char sccsid[] = "@(#)uupoll.c 5.5 (Berkeley) 10/9/85"; #include "uucp.h" int TransferSucceeded = 1; -struct timeb Now; +struct timeval Now; -main(argc, argv) +int main(argc, argv) register int argc; register char **argv; { @@ -72,7 +68,7 @@ register char **argv; cleanup(0); } -cleanup(code) +void cleanup(code) int code; { exit(code); diff --git a/src/cmd/uucp/uuq.c b/src/cmd/uucp/uuq.c index 6f62df6..ea584f0 100644 --- a/src/cmd/uucp/uuq.c +++ b/src/cmd/uucp/uuq.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)uuq.c 4.6.1 (2.11BSD) 1997/10/2"; -#endif - /* * uuq - looks at uucp queues * @@ -65,12 +61,15 @@ float baudrate = 1200.; char Username[BUFSIZ]; char Filename[BUFSIZ]; int Maxulen = 0; -struct timeb Now; +struct timeval Now; -main(argc, argv) +static void gather(void); +static int analjob(char *filename); + +int main(argc, argv) char **argv; { - register i; + register int i; register struct sys *sp; register struct job *jp; struct job **sortjob; @@ -172,7 +171,7 @@ char **argv; exit(0); } -jcompare(j1, j2) +int jcompare(j1, j2) struct job **j1, **j2; { int delta; @@ -186,7 +185,7 @@ struct job **j1, **j2; /* * Get all the command file names */ -gather() +void gather() { struct direct *d; DIR *df; @@ -215,7 +214,7 @@ gather() /* * analjob does the grunge work of verifying jobs */ -analjob(filename) +int analjob(filename) char *filename; { struct job *jp; diff --git a/src/cmd/uucp/uusend.c b/src/cmd/uucp/uusend.c index 012b999..2bbc8ec 100644 --- a/src/cmd/uucp/uusend.c +++ b/src/cmd/uucp/uusend.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)uusend.c 5.2.1 (2.11BSD) 1996/10/24"; -#endif - /* * uusend: primitive operation to allow uucp like copy of binary files * but handle indirection over systems. @@ -26,6 +22,7 @@ static char sccsid[] = "@(#)uusend.c 5.2.1 (2.11BSD) 1996/10/24"; #include #include #include +#include #include #include #include @@ -39,7 +36,7 @@ static char sccsid[] = "@(#)uusend.c 5.2.1 (2.11BSD) 1996/10/24"; * which they certainly should to avoid security holes */ #define RECOVER -/*#define DEBUG "/usr/spool/uucp/uusend.log"/**/ +//#define DEBUG "/usr/spool/uucp/uusend.log"/**/ FILE *in, *out; FILE *dout; @@ -76,7 +73,7 @@ char f[100]; /* name of default output file */ char *f = ""; /* so we waste a little space */ #endif -main(argc, argv) +int main(argc, argv) int argc; char **argv; { @@ -327,7 +324,7 @@ register char *p; } #ifndef BSD4_2 -makedir(dirname, mode) +int makedir(dirname, mode) char *dirname; int mode; { diff --git a/src/cmd/uucp/uusnap.c b/src/cmd/uucp/uusnap.c index ca7318c..df73af4 100644 --- a/src/cmd/uucp/uusnap.c +++ b/src/cmd/uucp/uusnap.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)uusnap.c 5.7 (Berkeley) 10/9/85"; -#endif - /* * Uusnap - displays a snapshot of the uucp system. * originally by RJKing WECo-MG6565 May 83 @@ -46,7 +42,10 @@ int sndx; /* Number of systems */ struct scnt sys[NSYSTEM]; /* Systems queued */ int xqtisrunning = 0; -main() +static void scandir(char *dnam, char *prfx, int flen, char fchr, int type); +static void getstst(char *sdir); + +int main() { register int i, j, nlen = 0; time_t curtime, t; @@ -125,8 +124,7 @@ main() exit(0); } -scandir(dnam, prfx, flen, fchr, type) -char *dnam, *prfx, fchr; +void scandir(char *dnam, char *prfx, int flen, char fchr, int type) { register struct direct *dentp; register DIR *dirp; @@ -189,7 +187,7 @@ char *dnam, *prfx, fchr; closedir(dirp); } -getstst(sdir) +void getstst(sdir) char *sdir; { register int i, csys; @@ -263,7 +261,7 @@ char *sdir; buff[0] = '\0'; fgets(buff, sizeof(buff), st); fclose(st); - if(tp = rindex(buff, ' ')) + if ((tp = rindex(buff, ' '))) *tp = NULL; /* drop system name */ else continue; diff --git a/src/cmd/uucp/uux.c b/src/cmd/uucp/uux.c index 9e9a082..538d578 100644 --- a/src/cmd/uucp/uux.c +++ b/src/cmd/uucp/uux.c @@ -1,9 +1,6 @@ -#ifndef lint -static char sccsid[] = "@(#)uux.c 5.6 (Berkeley) 1/24/86"; -#endif - #include "uucp.h" #include +#include #define NOSYSPART 0 #define HASSYSPART 1 @@ -25,9 +22,12 @@ register char *p; for (p = d; *p != '\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; +struct timeval Now; -main(argc, argv) +static FILE *ufopen(char *file, char *mode); +static int split(char *name, char *sys, char *rest); + +int main(argc, argv) char *argv[]; { char cfile[NAMESIZE]; /* send commands for files from here */ @@ -57,8 +57,6 @@ char *argv[]; char Xsys[MAXBASENAME+1], local[MAXBASENAME+1]; char *xsys = Xsys; FILE *fprx, *fpc, *fpd, *fp; - extern char *getprm(), *lastpart(); - extern FILE *ufopen(); int uid, ret; char redir = '\0'; int nonoti = 0; @@ -316,8 +314,7 @@ char *argv[]; fprintf(fprx, "%c %s\n", X_RQDFILE, dfile); } else { APPCMD(lastpart(rest)); - fprintf(fprx, "%c %s %s\n", X_RQDFILE, - dfile, lastpart(rest)); + fprintf(fprx, "%c %s %s\n", X_RQDFILE, dfile, lastpart(rest)); } redir = '\0'; continue; @@ -342,8 +339,7 @@ char *argv[]; fprintf(fprx, "%c %s\n", X_RQDFILE, dfile); fprintf(fprx, "%c %s\n", X_STDIN, dfile); } else { - fprintf(fprx, "%c %s %s\n", X_RQDFILE, dfile, - lastpart(rest)); + fprintf(fprx, "%c %s %s\n", X_RQDFILE, dfile, lastpart(rest)); APPCMD(lastpart(rest)); } @@ -367,8 +363,7 @@ char *argv[]; fprintf(fprx, "%c %s\n", X_RQDFILE, t2file); fprintf(fprx, "%c %s\n", X_STDIN, t2file); } else { - fprintf(fprx, "%c %s %s\n", X_RQDFILE, t2file, - lastpart(rest)); + fprintf(fprx, "%c %s %s\n", X_RQDFILE, t2file, lastpart(rest)); APPCMD(lastpart(rest)); } redir = '\0'; @@ -412,11 +407,13 @@ char *argv[]; if (strcmp(xsys, local) == SAME) { /* rti!trt: xmv() works across filesystems, link(II) doesnt */ xmv(rxfile, tfile); - if (startjob) - if (rflag) + if (startjob) { + if (rflag) { xuucico(xsys); - else + } else { xuuxqt(); + } + } } else { GENSEND(fpc, rxfile, tfile, User, "", rxfile); @@ -448,8 +445,7 @@ int Fnamect = 0; * * return - none - do exit() */ - -cleanup(code) +void cleanup(code) int code; { int i; @@ -470,7 +466,6 @@ int code; * * return file pointer. */ - FILE *ufopen(file, mode) char *file, *mode; { @@ -480,6 +475,7 @@ char *file, *mode; logent("Fname", "TABLE OVERFLOW"); return fopen(subfile(file), mode); } + #ifdef VMS /* * EUNICE bug: @@ -487,7 +483,7 @@ char *file, *mode; * Note if we are running under Unix shell we don't * do the right thing. */ -arg_fix(argc, argv) +void arg_fix(argc, argv) char **argv; { register char *cp, *tp; @@ -514,8 +510,7 @@ char **argv; * NOSYSPART * HASSYSPART */ - -split(name, sys, rest) +int split(name, sys, rest) register char *name, *rest; char *sys; { diff --git a/src/cmd/uucp/uuxqt.c b/src/cmd/uucp/uuxqt.c index 35fc510..3cbd8f9 100644 --- a/src/cmd/uucp/uuxqt.c +++ b/src/cmd/uucp/uuxqt.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)uuxqt.c 5.8.1 (2.11BSD) 1997/10/2"; -#endif - #include "uucp.h" #include #include @@ -11,6 +7,7 @@ static char sccsid[] = "@(#)uuxqt.c 5.8.1 (2.11BSD) 1997/10/2"; #include #endif #include +#include #define BADCHARS "&^|(`\\<>;\"{}\n'" #define RECHECKTIME 60*10 /* 10 minutes */ @@ -37,7 +34,7 @@ int TransferSucceeded = 1; int notiok = 1; int nonzero = 0; -struct timeb Now; +struct timeval Now; char PATH[MAXFULLNAME] = "PATH=/bin:/usr/bin:/usr/ucb"; char Shell[MAXFULLNAME]; @@ -51,13 +48,22 @@ char *nenv[] = { 0 }; +static int gtxfile(char *file); +static int argok(char *xc, char *cmd); +static void notify(char *user, char *rmt, char *cmd, char *str); +static void mvxfiles(char *xfile); +static int shio(char *cmd, char *fi, char *fo); +static int chknotify(char *cmd); +static void rmxfiles(char *xfile); +static int gotfiles(char *file); + /* to remove restrictions from uuxqt * define ALLOK 1 * * to add allowable commands, add to the file CMDFILE * A line of form "PATH=..." changes the search path */ -main(argc, argv) +int main(argc, argv) char *argv[]; { char xcmd[MAXFULLNAME]; @@ -73,7 +79,6 @@ char *argv[]; char path[MAXFULLNAME]; char cmd[BUFSIZ]; char *cmdp, prm[1000], *ptr; - char *getprm(), *lastpart(); int uid, ret, ret2, badfiles; register int i; int stcico = 0; @@ -379,8 +384,7 @@ doprocess: cleanup(0); } - -cleanup(code) +void cleanup(code) int code; { logcls(); @@ -396,14 +400,12 @@ int code; exit(code); } - /* * get a file to execute * * return codes: 0 - no file | 1 - file to execute */ - -gtxfile(file) +int gtxfile(file) register char *file; { char pre[3]; @@ -460,8 +462,7 @@ retry: * * return codes: 0 - not ready | 1 - all files ready */ - -gotfiles(file) +int gotfiles(file) register char *file; { struct stat stbuf; @@ -488,12 +489,10 @@ register char *file; return 1; } - /* * remove execute files to x-directory */ - -rmxfiles(xfile) +void rmxfiles(xfile) register char *xfile; { register FILE *fp; @@ -515,12 +514,10 @@ register char *xfile; return; } - /* * move execute files to x-directory */ - -mvxfiles(xfile) +void mvxfiles(xfile) char *xfile; { register FILE *fp; @@ -546,13 +543,12 @@ char *xfile; } /* - * check for valid command/argument + * check for valid command/argument * *NOTE - side effect is to set xc to the command to be executed. * * return 0 - ok | 1 nok */ - -argok(xc, cmd) +int argok(xc, cmd) register char *xc, *cmd; { register char **ptr; @@ -587,7 +583,6 @@ register char *xc, *cmd; return SUCCESS; } - /* * if notification should be sent for successful execution of cmd * @@ -595,8 +590,7 @@ register char *xc, *cmd; * NT_ERR - do notification if exit status != 0 * NT_NO - don't do notification ever */ - -chknotify(cmd) +int chknotify(cmd) char *cmd; { register char **ptr; @@ -613,13 +607,10 @@ char *cmd; return NT_YES; /* "shouldn't happen" */ } - - /* * send mail to user giving execution results */ - -notify(user, rmt, cmd, str) +void notify(user, rmt, cmd, str) char *user, *rmt, *cmd, *str; { char text[MAXFULLNAME]; @@ -643,7 +634,7 @@ char *user, *rmt, *cmd, *str; * return mail to sender * */ -retosndr(user, rmt, file) +void retosndr(user, rmt, file) char *user, *rmt, *file; { char ruser[MAXFULLNAME]; @@ -669,8 +660,7 @@ char *user, *rmt, *file; /* * execute shell of command with fi and fo as standard input/output */ - -shio(cmd, fi, fo) +int shio(cmd, fi, fo) char *cmd, *fi, *fo; { int status, f; diff --git a/src/cmd/uucp/versys.c b/src/cmd/uucp/versys.c index 7b56c8c..d5550de 100644 --- a/src/cmd/uucp/versys.c +++ b/src/cmd/uucp/versys.c @@ -1,7 +1,3 @@ -#if !defined(lint) && defined(DOSCCS) -static char sccsid[] = "@(#)versys.c 5.5.1 (2.11BSD) 1997/10/2"; -#endif - #include "uucp.h" #include #include @@ -10,6 +6,8 @@ static char sccsid[] = "@(#)versys.c 5.5.1 (2.11BSD) 1997/10/2"; char PhoneNumber[MAXPH]; +static int uualias(char **hostptr); + /* * verify system names n1 and n2 * return codes: SUCCESS | FAIL @@ -20,7 +18,7 @@ char PhoneNumber[MAXPH]; * See accompanying changes in uucp.c and uux.c * -- Ray Essick, April 27, 1984 */ -versys(nameptr) +int versys(nameptr) register char **nameptr; { register FILE *fp; @@ -64,8 +62,7 @@ register char **nameptr; * FAIL No L.aliases file * SUCCESS Anything else */ - -uualias(hostptr) +int uualias(hostptr) char **hostptr; /* we change it */ { FILE *Aliases; /* list of aliases */ diff --git a/src/cmd/uucp/xqt.c b/src/cmd/uucp/xqt.c index d077208..27e19ea 100644 --- a/src/cmd/uucp/xqt.c +++ b/src/cmd/uucp/xqt.c @@ -1,7 +1,3 @@ -#ifndef lint -static char sccsid[] = "@(#)xqt.c 5.3 (Berkeley) 6/23/85"; -#endif - #include #include "uucp.h" @@ -19,7 +15,7 @@ int LocalOnly = 0; #define fork vfork #endif -xuucico(rmtname) +void xuucico(rmtname) char *rmtname; { if (fork() == 0) { @@ -60,14 +56,12 @@ char *rmtname; return; } - /* * start up uuxqt * * return codes: none */ - -xuuxqt() +void xuuxqt() { if (fork() == 0) { /* start uuxqt */ @@ -87,7 +81,7 @@ xuuxqt() return; } -xuucp(str) +void xuucp(str) char *str; { char text[300];