From: Eric Allman Date: Mon, 10 Aug 1981 06:03:49 +0000 (-0800) Subject: lint it X-Git-Tag: BSD-4_1_snap-Snapshot-Development~1050 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/29871fefc4af705941f975a21404b0af18c3c9e3 lint it SCCS-vsn: usr.sbin/sendmail/src/alias.c 3.8 SCCS-vsn: usr.sbin/sendmail/src/conf.c 3.15 SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.17 SCCS-vsn: usr.sbin/sendmail/src/collect.c 3.11 SCCS-vsn: usr.sbin/sendmail/src/err.c 3.6 SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 3.20 SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 3.16 SCCS-vsn: usr.sbin/sendmail/src/savemail.c 3.10 SCCS-vsn: usr.sbin/sendmail/src/useful.h 3.2 SCCS-vsn: usr.sbin/sendmail/src/util.c 3.6 SCCS-vsn: usr.sbin/sendmail/src/main.c 3.15 SCCS-vsn: usr.sbin/sendmail/src/readcf.c 3.6 SCCS-vsn: usr.sbin/sendmail/src/macro.c 1.4 SCCS-vsn: usr.sbin/sendmail/src/stab.c 3.4 --- diff --git a/usr/src/usr.sbin/sendmail/src/alias.c b/usr/src/usr.sbin/sendmail/src/alias.c index 7a33da6cda..f64ca6a7d2 100644 --- a/usr/src/usr.sbin/sendmail/src/alias.c +++ b/usr/src/usr.sbin/sendmail/src/alias.c @@ -3,7 +3,7 @@ # include # include "sendmail.h" -static char SccsId[] = "@(#)alias.c 3.7 %G%"; +static char SccsId[] = "@(#)alias.c 3.8 %G%"; /* ** ALIAS -- Compute aliases. @@ -61,17 +61,16 @@ extern datum fetch(); alias() { register ADDRESS *q; - ADDRESS *q2; + register char *p; +# ifndef DBM FILE *af; char line[MAXLINE+1]; - register char *p; - extern int errno; bool didalias; bool gotmatch; auto ADDRESS al; - extern bool sameaddr(); - extern ADDRESS *parse(); +# else int mno; +# endif DBM if (NoAlias) return; @@ -189,7 +188,7 @@ alias() sendto(p, 1); } } while (didalias); - fclose(af); + (void) fclose(af); #else DBM /* ** Scan send queues @@ -269,22 +268,21 @@ forward(user) char buf[60]; register FILE *fp; register char *p; - extern char *index(); if (user->q_mailer != M_LOCAL || bitset(QBADADDR, user->q_flags)) return (FALSE); /* good address -- look for .forward file in home */ - expand("$z/.forward", buf, &buf[sizeof buf - 1]); + (void) expand("$z/.forward", buf, &buf[sizeof buf - 1]); fp = fopen(buf, "r"); if (fp == NULL) return (FALSE); /* we do have an address to forward to -- do it */ - fgets(buf, sizeof buf, fp); + (void) fgets(buf, sizeof buf, fp); if ((p = index(buf, '\n')) != NULL) *p = '\0'; - fclose(fp); + (void) fclose(fp); if (buf[0] == '\0') return (FALSE); if (Verbose) diff --git a/usr/src/usr.sbin/sendmail/src/collect.c b/usr/src/usr.sbin/sendmail/src/collect.c index b3e9a94661..f2d97425b7 100644 --- a/usr/src/usr.sbin/sendmail/src/collect.c +++ b/usr/src/usr.sbin/sendmail/src/collect.c @@ -3,7 +3,7 @@ # include # include "sendmail.h" -static char SccsId[] = "@(#)collect.c 3.10 %G%"; +static char SccsId[] = "@(#)collect.c 3.11 %G%"; /* ** COLLECT -- read & parse message header & make temp file. @@ -51,23 +51,22 @@ maketemp(from) char buf[MAXFIELD+1]; register char *p; char c; - extern int errno; extern bool isheader(); - extern char *newstr(); - extern char *xalloc(); - extern char *index(), *rindex(); char *xfrom; extern char *hvalue(); - extern char *strcpy(), *strcat(), *mktemp(); + extern char *mktemp(); + extern char *capitalize(); +# ifdef DEBUG HDR *h; +# endif extern char *index(); /* ** Create the temp file name and create the file. */ - mktemp(InFileName); - close(creat(InFileName, 0600)); + (void) mktemp(InFileName); + (void) close(creat(InFileName, 0600)); if ((tf = fopen(InFileName, "w")) == NULL) { syserr("Cannot create %s", InFileName); @@ -80,7 +79,7 @@ maketemp(from) if (strncmp(buf, "From ", 5) == 0) { eatfrom(buf); - fgets(buf, sizeof buf, stdin); + (void) fgets(buf, sizeof buf, stdin); } /* @@ -105,8 +104,8 @@ maketemp(from) if (fgets(p, sizeof buf - (p - buf), stdin) == NULL) break; } - if (c != EOF) - ungetc(c, stdin); + if (!feof(stdin)) + (void) ungetc(c, stdin); MsgSize += strlen(buf); @@ -125,7 +124,7 @@ maketemp(from) /* throw away a blank line */ if (buf[0] == '\n') - fgets(buf, sizeof buf, stdin); + (void) fgets(buf, sizeof buf, stdin); /* ** Collect the body of the message. @@ -149,16 +148,16 @@ maketemp(from) { if (errno == ENOSPC) { - freopen(InFileName, "w", tf); + (void) freopen(InFileName, "w", tf); fputs("\nMAIL DELETED BECAUSE OF LACK OF DISK SPACE\n\n", tf); syserr("Out of disk space for temp file"); } else syserr("Cannot write %s", InFileName); - freopen("/dev/null", "w", tf); + (void) freopen("/dev/null", "w", tf); } } - fclose(tf); + (void) fclose(tf); /* ** Find out some information from the headers. @@ -341,17 +340,12 @@ chompheader(line, def) bool def; { register char *p; - extern int errno; register HDR *h; HDR **hp; extern bool isheader(); - extern char *newstr(); - extern char *xalloc(); char *fname; char *fvalue; - extern char *index(), *rindex(); struct hdrinfo *hi; - extern char *strcpy(), *strcat(), *mktemp(); /* strip off trailing newline */ p = rindex(line, '\n'); diff --git a/usr/src/usr.sbin/sendmail/src/conf.c b/usr/src/usr.sbin/sendmail/src/conf.c index 191560e75d..4064865f5f 100644 --- a/usr/src/usr.sbin/sendmail/src/conf.c +++ b/usr/src/usr.sbin/sendmail/src/conf.c @@ -88,7 +88,7 @@ -static char SccsId[] = "@(#)conf.c 3.14 %G%"; +static char SccsId[] = "@(#)conf.c 3.15 %G%"; # include /* definitions of machine id's at berkeley */ @@ -276,7 +276,6 @@ ttypath() struct stat stbuf; register int i; static char pathn[] = "/dev/ttyx"; - extern int errno; /* compute the pathname of the controlling tty */ if ((i = ttyn(2)) == 'x' && (i = ttyn(1)) == 'x' && (i = ttyn(0)) == 'x') @@ -336,7 +335,7 @@ fdopen(fd, type) register FILE *f; f = fopen("/dev/null", type); - close(fileno(f)); + (void) close(fileno(f)); fileno(f) = fd; return (f); } @@ -404,8 +403,8 @@ ttypath() { struct stat stbuf; register char *pathn; - extern int errno; extern char *ttyname(); + extern char *getlogin(); /* compute the pathname of the controlling tty */ if ((pathn = ttyname(2)) == NULL && (pathn = ttyname(1)) == NULL && (pathn = ttyname(0)) == NULL) @@ -456,5 +455,11 @@ bool checkcompat(to) register ADDRESS *to; { +# ifdef lint + ADDRESS *x = to; + + to = x; +# endif lint + return (TRUE); } diff --git a/usr/src/usr.sbin/sendmail/src/deliver.c b/usr/src/usr.sbin/sendmail/src/deliver.c index be4c792ffe..02809f157e 100644 --- a/usr/src/usr.sbin/sendmail/src/deliver.c +++ b/usr/src/usr.sbin/sendmail/src/deliver.c @@ -7,7 +7,7 @@ # include # endif LOG -static char SccsId[] = "@(#)deliver.c 3.16 %G%"; +static char SccsId[] = "@(#)deliver.c 3.17 %G%"; /* ** DELIVER -- Deliver a message to a particular address. @@ -38,15 +38,11 @@ deliver(to, editfcn) register char *p; register struct mailer *m; register int i; - extern int errno; extern putmessage(); - extern char *index(); extern bool checkcompat(); char *pv[MAXPV+1]; - extern char *newstr(); char tobuf[MAXLINE]; char buf[MAXNAME]; - extern char *expand(); bool firstone; if (bitset(QDONTSEND, to->q_flags)) @@ -83,7 +79,7 @@ deliver(to, editfcn) *pvp++ = "-f"; else *pvp++ = "-r"; - expand("$g", buf, &buf[sizeof buf - 1]); + (void) expand("$g", buf, &buf[sizeof buf - 1]); *pvp++ = newstr(buf); } @@ -103,7 +99,7 @@ deliver(to, editfcn) break; /* this entry is safe -- go ahead and process it */ - expand(*mvp, buf, &buf[sizeof buf - 1]); + (void) expand(*mvp, buf, &buf[sizeof buf - 1]); *pvp++ = newstr(buf); if (pvp >= &pv[MAXPV - 3]) { @@ -212,13 +208,13 @@ deliver(to, editfcn) /* create list of users for error messages */ if (tobuf[0] != '\0') - strcat(tobuf, ","); - strcat(tobuf, to->q_paddr); + (void) strcat(tobuf, ","); + (void) strcat(tobuf, to->q_paddr); define('u', user); /* to user */ define('z', to->q_home); /* user's home */ /* expand out this user */ - expand(user, buf, &buf[sizeof buf - 1]); + (void) expand(user, buf, &buf[sizeof buf - 1]); *pvp++ = newstr(buf); if (pvp >= &pv[MAXPV - 2]) { @@ -240,7 +236,7 @@ deliver(to, editfcn) while (*++mvp != NULL) { - expand(*mvp, buf, &buf[sizeof buf - 1]); + (void) expand(*mvp, buf, &buf[sizeof buf - 1]); *pvp++ = newstr(buf); if (pvp >= &pv[MAXPV]) syserr("deliver: pv overflow after $u for %s", pv[0]); @@ -260,7 +256,7 @@ deliver(to, editfcn) editfcn = putmessage; if (m == Mailer[M_PRIVATE]) { - expand("$z/.mailer", buf, &buf[sizeof buf - 1]); + (void) expand("$z/.mailer", buf, &buf[sizeof buf - 1]); m->m_mailer = buf; } i = sendoff(m, pv, editfcn); @@ -321,32 +317,32 @@ sendoff(m, pvp, editfcn) # endif if (pid >= 0) break; - sleep(NFORKTRIES - i); + sleep((unsigned) NFORKTRIES - i); } if (pid < 0) { syserr("Cannot fork"); - close(pvect[0]); - close(pvect[1]); + (void) close(pvect[0]); + (void) close(pvect[1]); return (-1); } else if (pid == 0) { /* child -- set up input & exec mailer */ /* make diagnostic output be standard output */ - close(2); - dup(1); - signal(SIGINT, SIG_IGN); - close(0); + (void) close(2); + (void) dup(1); + (void) signal(SIGINT, SIG_IGN); + (void) close(0); if (dup(pvect[0]) < 0) { syserr("Cannot dup to zero!"); _exit(EX_OSERR); } - close(pvect[0]); - close(pvect[1]); + (void) close(pvect[0]); + (void) close(pvect[1]); if (!bitset(M_RESTR, m->m_flags)) - setuid(getuid()); + (void) setuid(getuid()); # ifndef VFORK /* ** We have to be careful with vfork - we can't mung up the @@ -374,18 +370,18 @@ sendoff(m, pvp, editfcn) /* syserr fails because log is closed */ /* syserr("Cannot exec %s", m->m_mailer); */ printf("Cannot exec %s\n", m->m_mailer); - fflush(stdout); + (void) fflush(stdout); _exit(EX_UNAVAILABLE); } /* write out message to mailer */ - close(pvect[0]); - signal(SIGPIPE, pipesig); + (void) close(pvect[0]); + (void) signal(SIGPIPE, pipesig); mfile = fdopen(pvect[1], "w"); if (editfcn == NULL) editfcn = putmessage; (*editfcn)(mfile, m); - fclose(mfile); + (void) fclose(mfile); /* ** Wait for child to die and report status. @@ -425,7 +421,7 @@ sendoff(m, pvp, editfcn) ** m -- the mailer descriptor for this mailer. ** ** Returns: -** stat. +** none. ** ** Side Effects: ** Errors may be incremented. @@ -446,7 +442,6 @@ giveresponse(stat, force, m) extern int N_SysEx; extern long MsgSize; char buf[30]; - extern char *sprintf(); i = stat - EX__BASE; if (i < 0 || i > N_SysEx) @@ -488,7 +483,7 @@ giveresponse(stat, force, m) if (statmsg == NULL) { - sprintf(buf, "error %d", stat); + (void) sprintf(buf, "error %d", stat); statmsg = buf; } @@ -496,7 +491,6 @@ giveresponse(stat, force, m) syslog(LOG_INFO, "%s->%s: %ld: %s", From.q_paddr, To, MsgSize, statmsg); # endif LOG setstat(stat); - return (stat); } /* ** PUTMESSAGE -- output a message to the final mailer. @@ -526,7 +520,6 @@ putmessage(fp, m) register char *p; extern char *arpadate(); bool anyheader = FALSE; - extern char *expand(); extern char *capitalize(); extern char SentDate[]; @@ -543,7 +536,7 @@ putmessage(fp, m) continue; if (bitset(H_DEFAULT, h->h_flags)) { - expand(h->h_value, buf, &buf[sizeof buf]); + (void) expand(h->h_value, buf, &buf[sizeof buf]); p = buf; } else @@ -561,7 +554,7 @@ putmessage(fp, m) /* output the body of the message */ rewind(stdin); while (!ferror(fp) && (i = fread(buf, 1, BUFSIZ, stdin)) > 0) - fwrite(buf, 1, i, fp); + (void) fwrite(buf, 1, i, fp); if (ferror(fp)) { @@ -587,7 +580,7 @@ putmessage(fp, m) pipesig() { syserr("Broken pipe"); - signal(SIGPIPE, SIG_IGN); + (void) signal(SIGPIPE, SIG_IGN); } /* ** SENDTO -- Designate a send list. @@ -614,7 +607,6 @@ sendto(list, copyf) register char *q; register char c; ADDRESS *a; - extern ADDRESS *parse(); bool more; /* more keeps track of what the previous delimiter was */ @@ -660,8 +652,6 @@ recipient(a) register ADDRESS *q; register struct mailer *m; extern bool forward(); - extern int errno; - extern bool sameaddr(); To = a->q_paddr; m = Mailer[a->q_mailer]; @@ -696,7 +686,7 @@ recipient(a) a->q_home = newstr(pw->pw_dir); define('z', a->q_home); - expand("$z/.mailer", xbuf, &xbuf[sizeof xbuf - 1]); + (void) expand("$z/.mailer", xbuf, &xbuf[sizeof xbuf - 1]); if (access(xbuf, 1) == 0) { a->q_mailer = M_PRIVATE; @@ -777,6 +767,6 @@ mailfile(filename) putmessage(f, Mailer[1]); fputs("\n", f); - fclose(f); + (void) fclose(f); return (EX_OK); } diff --git a/usr/src/usr.sbin/sendmail/src/err.c b/usr/src/usr.sbin/sendmail/src/err.c index 2fc45ad687..f8f09fac5b 100644 --- a/usr/src/usr.sbin/sendmail/src/err.c +++ b/usr/src/usr.sbin/sendmail/src/err.c @@ -5,7 +5,7 @@ # include # endif LOG -static char SccsId[] = "@(#)err.c 3.5 %G%"; +static char SccsId[] = "@(#)err.c 3.6 %G%"; /* ** SYSERR -- Print error message. @@ -18,48 +18,50 @@ static char SccsId[] = "@(#)err.c 3.5 %G%"; ** a, b, c, d, e -- parameters ** ** Returns: -** -1 always +** none ** ** Side Effects: ** increments Errors. ** sets ExitStat. */ +# ifdef lint +int sys_nerr; +char *sys_errlist[]; +# endif lint + /*VARARGS1*/ syserr(fmt, a, b, c, d, e) char *fmt; { - extern int errno; static char errbuf[MAXLINE+1]; - register char *p; extern char *sys_errlist[]; extern int sys_nerr; - extern char *sprintf(); register char *eb = errbuf; /* add arpanet error number if not present */ if (!isdigit(*fmt)) { - strcpy(eb, "455 "); + (void) strcpy(eb, "455 "); eb += 4; } /* put error message into buffer */ - sprintf(eb, fmt, a, b, c, d, e); + (void) sprintf(eb, fmt, a, b, c, d, e); if (errno != 0) { eb += strlen(eb); if (errno < sys_nerr && errno > 0) - sprintf(eb, ": %s", sys_errlist[errno]); + (void) sprintf(eb, ": %s", sys_errlist[errno]); else - sprintf(eb, ": error %d", errno); + (void) sprintf(eb, ": error %d", errno); } if (ArpaFmt) printf("%s\r\n", errbuf); else printf("sendmail: %s\n", &errbuf[4]); - fflush(stdout); + (void) fflush(stdout); Errors++; /* determine exit status if not already set */ @@ -75,7 +77,6 @@ syserr(fmt, a, b, c, d, e) syslog(LOG_ERR, "%s->%s: %s", From.q_paddr, To, errbuf); # endif LOG errno = 0; - return (-1); } /* ** USRERR -- Signal user error. @@ -86,7 +87,7 @@ syserr(fmt, a, b, c, d, e) ** fmt, a, b, c, d -- printf strings ** ** Returns: -** -1 +** none ** ** Side Effects: ** increments Errors. @@ -99,11 +100,10 @@ usrerr(fmt, a, b, c, d, e) extern char SuprErrs; if (SuprErrs) - return (0); + return; Errors++; message("450", fmt, a, b, c, d, e); - return (-1); } /* ** MESSAGE -- print message (not necessarily an error) @@ -121,6 +121,7 @@ usrerr(fmt, a, b, c, d, e) ** none. */ +/*VARARGS2*/ message(num, msg, a, b, c, d, e) register char *num; register char *msg; @@ -142,5 +143,5 @@ message(num, msg, a, b, c, d, e) if (ArpaFmt) printf("\r"); printf("\n"); - fflush(stdout); + (void) fflush(stdout); } diff --git a/usr/src/usr.sbin/sendmail/src/macro.c b/usr/src/usr.sbin/sendmail/src/macro.c index d23dda759d..cece717467 100644 --- a/usr/src/usr.sbin/sendmail/src/macro.c +++ b/usr/src/usr.sbin/sendmail/src/macro.c @@ -1,6 +1,6 @@ # include "useful.h" -static char SccsId[] = "@(#)macro.c 1.3 %G%"; +static char SccsId[] = "@(#)macro.c 1.4 %G%"; char *Macro[128]; extern int Debug; diff --git a/usr/src/usr.sbin/sendmail/src/main.c b/usr/src/usr.sbin/sendmail/src/main.c index 03ae3d5ee6..36da9043cf 100644 --- a/usr/src/usr.sbin/sendmail/src/main.c +++ b/usr/src/usr.sbin/sendmail/src/main.c @@ -7,7 +7,7 @@ # include # endif LOG -static char SccsId[] = "@(#)main.c 3.14 %G%"; +static char SccsId[] = "@(#)main.c 3.15 %G%"; /* ** SENDMAIL -- Post mail to a set of destinations. @@ -151,32 +151,23 @@ main(argc, argv) extern char *getlogin(); char *locname; extern int finis(); - extern ADDRESS *parse(); - register ADDRESS *q; extern char Version[]; - extern int errno; char *from; typedef int (*fnptr)(); char nbuf[MAXLINE]; /* holds full name */ struct passwd *pw; - extern char *newstr(); - extern char *index(); - extern char *strcpy(), *strcat(); + extern char *arpadate(); char *cfname; register int i; char pbuf[10]; /* holds pid */ char tbuf[10]; /* holds "current" time */ char cbuf[5]; /* holds hop count */ char dbuf[30]; /* holds ctime(tbuf) */ - extern char *sprintf(); -# ifndef V6 - extern char *getenv(); -# endif V6 bool canrename; if (signal(SIGINT, SIG_IGN) != SIG_IGN) - signal(SIGINT, finis); - signal(SIGTERM, finis); + (void) signal(SIGINT, finis); + (void) signal(SIGTERM, finis); setbuf(stdout, (char *) NULL); # ifdef LOG openlog("sendmail", 0); @@ -185,10 +176,10 @@ main(argc, argv) # ifdef DEBUGFILE if ((i = open(DEBUGFILE, 1)) > 0) { - lseek(i, 0L, 2); - close(1); - dup(i); - close(i); + (void) lseek(i, 0L, 2); + (void) close(1); + (void) dup(i); + (void) close(i); Debug++; } # endif DEBUGFILE @@ -254,7 +245,7 @@ main(argc, argv) break; /* (default) */ case 'q': /* be silent about it */ - freopen("/dev/null", "w", stdout); + (void) freopen("/dev/null", "w", stdout); break; case 'm': /* mail back */ @@ -334,18 +325,18 @@ main(argc, argv) */ /* process id */ - sprintf(pbuf, "%d", getpid()); + (void) sprintf(pbuf, "%d", getpid()); define('p', pbuf); /* hop count */ - sprintf(cbuf, "%d", HopCount); + (void) sprintf(cbuf, "%d", HopCount); define('c', cbuf); /* time as integer, unix time, arpa time */ - time(&CurTime); - sprintf(tbuf, "%ld", &CurTime); + (void) time(&CurTime); + (void) sprintf(tbuf, "%ld", &CurTime); define('t', tbuf); - strcpy(dbuf, ctime(&CurTime)); + (void) strcpy(dbuf, ctime(&CurTime)); *index(dbuf, '\n') = '\0'; define('d', dbuf); define('a', arpadate(dbuf)); @@ -362,7 +353,7 @@ main(argc, argv) char cfbuf[60]; define('z', p); - expand("$z/.mailcf", cfbuf, &cfbuf[sizeof cfbuf - 1]); + (void) expand("$z/.mailcf", cfbuf, &cfbuf[sizeof cfbuf - 1]); if (access(cfbuf, 2) == 0) readcf(cfbuf); } @@ -410,7 +401,7 @@ main(argc, argv) { if (*p == '&') { - strcpy(nb, realname); + (void) strcpy(nb, realname); *nb = toupper(*nb); while (*nb != '\0') nb++; @@ -436,7 +427,7 @@ main(argc, argv) setfrom(from, realname); - expand("$l", FromLine, &FromLine[sizeof FromLine - 1]); + (void) expand("$l", FromLine, &FromLine[sizeof FromLine - 1]); # ifdef DEBUG if (Debug) printf("From person = \"%s\"\n", From.q_paddr); @@ -474,9 +465,9 @@ main(argc, argv) } else { - strcpy(nbuf, argv[0]); - strcat(nbuf, "@"); - strcat(nbuf, argv[2]); + (void) strcpy(nbuf, argv[0]); + (void) strcat(nbuf, "@"); + (void) strcat(nbuf, argv[2]); p = nbuf; argv += 2; argc -= 2; @@ -515,7 +506,7 @@ main(argc, argv) for (q = Mailer[i]->m_sendq; q != NULL; q = q->q_next) { - deliver(q, (fnptr) NULL); + (void) deliver(q, (fnptr) NULL); } } @@ -583,7 +574,7 @@ setfrom(from, realname) if (from == NULL || parse(from, &From, 0) == NULL) { from = newstr(realname); - parse(from, &From, 0); + (void) parse(from, &From, 0); } else FromFlag = TRUE; @@ -603,7 +594,7 @@ setfrom(from, realname) rewrite(pvp, 1); frombuf[0] = '\0'; while (*pvp != NULL) - strcat(frombuf, *pvp++); + (void) strcat(frombuf, *pvp++); define('f', newstr(frombuf)); } @@ -635,8 +626,8 @@ finis() savemail(); if (HasXscrpt) - unlink(Transcript); - unlink(InFileName); + (void) unlink(Transcript); + (void) unlink(InFileName); exit(ExitStat); } /* @@ -663,10 +654,10 @@ openxscrpt() { extern char *mktemp(); - mktemp(Transcript); + (void) mktemp(Transcript); HasXscrpt++; if (freopen(Transcript, "w", stdout) == NULL) syserr("Can't create %s", Transcript); - chmod(Transcript, 0600); + (void) chmod(Transcript, 0600); setbuf(stdout, (char *) NULL); } diff --git a/usr/src/usr.sbin/sendmail/src/parseaddr.c b/usr/src/usr.sbin/sendmail/src/parseaddr.c index f8c7062200..86511d237d 100644 --- a/usr/src/usr.sbin/sendmail/src/parseaddr.c +++ b/usr/src/usr.sbin/sendmail/src/parseaddr.c @@ -2,7 +2,7 @@ # include # include "sendmail.h" -static char SccsId[] = "@(#)parseaddr.c 3.15 %G%"; +static char SccsId[] = "@(#)parseaddr.c 3.16 %G%"; /* ** PARSE -- Parse an address @@ -58,8 +58,6 @@ parse(addr, a, copyf) register char **pvp; register struct mailer *m; extern char **prescan(); - extern char *newstr(); - extern char *strcpy(); extern ADDRESS *buildaddr(); /* @@ -198,9 +196,9 @@ prescan(addr, delim) register char c; char *tok; register char *q; - extern char *index(); register int state; int nstate; + extern char lower(); space = FALSE; q = buf; @@ -446,7 +444,7 @@ toktype(c) if (firstime) { firstime = FALSE; - expand("$o", buf, &buf[sizeof buf - 1]); + (void) expand("$o", buf, &buf[sizeof buf - 1]); strcat(buf, DELIMCHARS); } if (isspace(c)) @@ -539,7 +537,7 @@ rewrite(pvp, ruleset) case MATCHANY: /* match any number of tokens */ - setmatch(mlist, rp[1], NULL, avp); + setmatch(mlist, rp[1], (char **) NULL, avp); break; case MATCHCLASS: @@ -582,7 +580,7 @@ rewrite(pvp, ruleset) if (*rp == MATCHONE) { /* undo binding */ - setmatch(mlist, rp[1], NULL, NULL); + setmatch(mlist, rp[1], (char **) NULL, (char **) NULL); } } @@ -631,7 +629,7 @@ rewrite(pvp, ruleset) *avp++ = rp; } *avp++ = NULL; - bmove(npvp, pvp, (avp - npvp) * sizeof *avp); + bmove((char *) npvp, (char *) pvp, (avp - npvp) * sizeof *avp); # ifdef DEBUG if (Debug) { @@ -787,7 +785,6 @@ buildaddr(tv, a) static char buf[MAXNAME]; struct mailer **mp; register struct mailer *m; - extern char *xalloc(); if (a == NULL) a = (ADDRESS *) xalloc(sizeof *a); @@ -825,7 +822,7 @@ buildaddr(tv, a) syserr("buildaddr: no user"); buf[0] = '\0'; while (**++tv != NULL) - strcat(buf, *tv); + (void) strcat(buf, *tv); a->q_user = buf; return (a); @@ -896,7 +893,7 @@ printaddr(a, follow) while (a != NULL) { printf("addr@%x: ", a); - fflush(stdout); + (void) fflush(stdout); printf("%s: mailer %d (%s), host `%s', user `%s'\n", a->q_paddr, a->q_mailer, Mailer[a->q_mailer]->m_name, a->q_host, a->q_user); printf("\tnext=%x flags=%o, rmailer %d\n", a->q_next, diff --git a/usr/src/usr.sbin/sendmail/src/readcf.c b/usr/src/usr.sbin/sendmail/src/readcf.c index ab4c41174d..ae80be4e5f 100644 --- a/usr/src/usr.sbin/sendmail/src/readcf.c +++ b/usr/src/usr.sbin/sendmail/src/readcf.c @@ -2,7 +2,7 @@ # include "sendmail.h" # include -static char SccsId[] = "@(#)readcf.c 3.5 %G%"; +static char SccsId[] = "@(#)readcf.c 3.6 %G%"; /* ** READCF -- read control file. @@ -30,11 +30,8 @@ readcf(cfname) char buf[MAXLINE]; register char *p; struct rewrite *rwp = NULL; - extern char *xalloc(); extern char **prescan(); extern char **copyplist(); - extern char *rindex(); - extern char *newstr(); int class; int ruleset = 0; @@ -101,7 +98,7 @@ readcf(cfname) break; case 'H': /* required header line */ - chompheader(&buf[1], TRUE); + (void) chompheader(&buf[1], TRUE); break; case 'C': /* word class */ @@ -142,105 +139,10 @@ readcf(cfname) } } -/* - printrules(); -*/ -} - /* -** RWCRACK -- crack rewrite line. -** -** Parameters: -** l -- line to crack. -** -** Returns: -** local copy of cracked line. -** -** Side Effects: -** none. -*/ - -char ** -rwcrack(l) - register char *l; -{ - char *av[MAXATOM]; - int ac = 0; - register char **avp; - char buf[MAXNAME]; - register char *b; - bool wasdelim = FALSE; - char *delims = ":@!^."; - extern char *index(); - bool tchange; - extern char *newstr(), *xalloc(); - - for (avp = av; *l != '\0' && *l != '\n'; avp++) - { - b = buf; - tchange = FALSE; - while (!tchange) - { - if (*l != '$') - { - if (wasdelim || index(delims, *l) != NULL) - tchange = TRUE; - wasdelim = (index(delims, *l) != NULL); - if (wasdelim) - tchange = TRUE; - *b++ = *l++; - continue; - } - - tchange = TRUE; - switch (*++l) - { - case '$': /* literal $ */ - *b++ = *l; - break; - - case '+': /* match anything */ - *b++ = MATCHANY; - *b++ = *++l; - break; - - case '-': /* match one token */ - *b++ = MATCHONE; - *b++ = *++l; - break; - - case '#': /* canonical net name */ - *b++ = CANONNET; - break; - - case '@': /* canonical host name */ - *b++ = CANONHOST; - break; - - case ':': /* canonical user name */ - *b++ = CANONUSER; - break; - - default: - *b++ = '$'; - l--; - break; - } - l++; - } - - /* save the argument we have collected */ - *b = '\0'; - *avp = newstr(buf); - ac++; - } - - /* allocate new space for vector */ - ac++; - *avp = NULL; - avp = (char **) xalloc(ac * sizeof *av); - bmove(av, avp, ac * sizeof *av); - - return (avp); +# ifdef DEBUG + if (Debug > 6) + printrules(); +# endif DEBUG } /* ** PRINTRULES -- print rewrite rules (for debugging) diff --git a/usr/src/usr.sbin/sendmail/src/savemail.c b/usr/src/usr.sbin/sendmail/src/savemail.c index 523cce843c..7c0ad8c43b 100644 --- a/usr/src/usr.sbin/sendmail/src/savemail.c +++ b/usr/src/usr.sbin/sendmail/src/savemail.c @@ -2,7 +2,7 @@ # include # include "sendmail.h" -static char SccsId[] = "@(#)savemail.c 3.9 %G%"; +static char SccsId[] = "@(#)savemail.c 3.10 %G%"; /* ** SAVEMAIL -- Save mail on error @@ -36,13 +36,8 @@ savemail() extern struct passwd *getpwnam(); register char *p; register int i; - auto long tim; - extern int errno; extern char *ttypath(); - extern ADDRESS *parse(); static int exclusive; - extern char *strcpy(), *strcat(); - extern char *expand(); if (exclusive++) return; @@ -97,13 +92,14 @@ savemail() xfile = fopen(Transcript, "r"); if (xfile == NULL) syserr("Cannot open %s", Transcript); - printf("\r\nMessage from %s\r\n", expand("$n", buf, &buf[sizeof buf - 1])); + (void) expand("$n", buf, &buf[sizeof buf - 1]); + printf("\r\nMessage from %s\r\n", buf); printf("Errors occurred while sending mail, transcript follows:\r\n"); - while (fgets(buf, sizeof buf, xfile) && !ferror(stdout)) + while (fgets(buf, sizeof buf, xfile) != NULL && !ferror(stdout)) fputs(buf, stdout); if (ferror(stdout)) - syserr("savemail: stdout: write err"); - fclose(xfile); + (void) syserr("savemail: stdout: write err"); + (void) fclose(xfile); } } @@ -120,13 +116,14 @@ savemail() if (MailBack) { - freopen("/dev/null", "w", stdout); + (void) freopen("/dev/null", "w", stdout); NoAlias++; ForceMail++; /* fake up an address header for the from person */ bmove((char *) &From, (char *) &to_addr, sizeof to_addr); - if (parse(expand("$n", buf, &buf[sizeof buf - 1]), &From, -1) == NULL) + (void) expand("$n", buf, &buf[sizeof buf - 1]); + if (parse(buf, &From, -1) == NULL) { syserr("Can't parse myself!"); ExitStat = EX_SOFTWARE; @@ -148,8 +145,8 @@ savemail() ** and we all know what poor typists programmers are. */ - setuid(getuid()); - setgid(getgid()); + (void) setuid(getuid()); + (void) setgid(getgid()); setpwent(); p = NULL; if (From.q_mailer == M_LOCAL) @@ -173,7 +170,7 @@ savemail() /* we have a home directory; open dead.letter */ message("050", "Saving message in dead.letter"); define('z', p); - expand("$z/dead.letter", buf, &buf[sizeof buf - 1]); + (void) expand("$z/dead.letter", buf, &buf[sizeof buf - 1]); To = buf; i = mailfile(buf); giveresponse(i, TRUE, Mailer[M_LOCAL]); @@ -214,21 +211,20 @@ errhdr(fp) { char buf[MAXLINE]; register FILE *xfile; - extern int errno; - fflush(stdout); + (void) fflush(stdout); if ((xfile = fopen(Transcript, "r")) == NULL) syserr("Cannot open %s", Transcript); errno = 0; fprintf(fp, "To: %s\n", To); fprintf(fp, "Subject: Unable to deliver mail\n"); fprintf(fp, "\n ----- Transcript of session follows -----\n"); - while (fgets(xfile, buf, sizeof buf) != NULL) + while (fgets(buf, sizeof buf, xfile) != NULL) fputs(buf, fp); fprintf(fp, "\n ----- Unsent message follows -----\n"); - fflush(fp); + (void) fflush(fp); putmessage(fp, Mailer[1]); - close(xfile); + (void) fclose(xfile); if (errno != 0) syserr("errhdr: I/O error"); } diff --git a/usr/src/usr.sbin/sendmail/src/sendmail.h b/usr/src/usr.sbin/sendmail/src/sendmail.h index e12ce3f50a..c4e72dff9e 100644 --- a/usr/src/usr.sbin/sendmail/src/sendmail.h +++ b/usr/src/usr.sbin/sendmail/src/sendmail.h @@ -1,7 +1,7 @@ /* ** SENDMAIL.H -- Global definitions for sendmail. ** -** @(#)sendmail.h 3.19 %G% +** @(#)sendmail.h 3.20 %G% */ @@ -228,3 +228,12 @@ extern char FromLine[]; /* a UNIX-style From line for this message */ # include # define setstat(s) { if (ExitStat == EX_OK) ExitStat = s; } + + +/* useful functions */ + +extern char *newstr(); +extern ADDRESS *parse(); +extern char *xalloc(); +extern char *expand(); +extern bool sameaddr(); diff --git a/usr/src/usr.sbin/sendmail/src/stab.c b/usr/src/usr.sbin/sendmail/src/stab.c index d829e1f1a6..36f91e1ccf 100644 --- a/usr/src/usr.sbin/sendmail/src/stab.c +++ b/usr/src/usr.sbin/sendmail/src/stab.c @@ -1,6 +1,6 @@ # include "sendmail.h" -static char SccsId[] = "@(#)stab.c 3.3 %G%"; +static char SccsId[] = "@(#)stab.c 3.4 %G%"; /* ** STAB -- manage the symbol table @@ -33,7 +33,6 @@ stab(name, op) { register STAB *s = SymTab; register STAB **ps = &SymTab; - extern char *newstr(); extern bool sameword(); # ifdef DEBUG diff --git a/usr/src/usr.sbin/sendmail/src/useful.h b/usr/src/usr.sbin/sendmail/src/useful.h index 2656111bcf..f5ad2cb8e4 100644 --- a/usr/src/usr.sbin/sendmail/src/useful.h +++ b/usr/src/usr.sbin/sendmail/src/useful.h @@ -1,7 +1,7 @@ /* ** USEFUL.H -- Some useful stuff. ** -** @(#)useful.h 3.1 %G% +** @(#)useful.h 3.2 %G% */ # define bool char @@ -15,3 +15,16 @@ # define setbit(bit, word) (word |= bit) # define clrbit(bit, word) (word &= ~bit) # define bitset(bit, word) ((word) & (bit)) + +/* define the types of some common functions */ +extern char *strcpy(); +extern char *strcat(); +extern char *malloc(); +extern char *index(), *rindex(); +extern int errno; +extern char *sprintf(); +extern long time(); +extern char *ctime(); +# ifndef V6 +extern char *getenv(); +# endif diff --git a/usr/src/usr.sbin/sendmail/src/util.c b/usr/src/usr.sbin/sendmail/src/util.c index 5aa9f9ef6b..c12c24d7c0 100644 --- a/usr/src/usr.sbin/sendmail/src/util.c +++ b/usr/src/usr.sbin/sendmail/src/util.c @@ -3,7 +3,7 @@ # include "useful.h" # include -static char SccsId[] = "@(#)util.c 3.5 %G%"; +static char SccsId[] = "@(#)util.c 3.6 %G%"; /* ** STRIPQUOTES -- Strip quotes & quote bits from a string. @@ -95,7 +95,6 @@ xalloc(sz) register unsigned int sz; { register char *p; - extern char *malloc(); p = malloc(sz); if (p == NULL) @@ -125,7 +124,6 @@ newstr(s) register char *s; { register char *p; - extern char *strcpy(); p = xalloc((unsigned) (strlen(s) + 1)); strcpy(p, s); @@ -157,15 +155,14 @@ copyplist(list, copycont) { register char **vp; register char **newvp; - extern char *xalloc(); for (vp = list; *vp != NULL; vp++) continue; vp++; - newvp = (char **) xalloc((vp - list) * sizeof *vp); - bmove(list, newvp, (vp - list) * sizeof *vp); + newvp = (char **) xalloc((unsigned) (vp - list) * sizeof *vp); + bmove((char *) list, (char *) newvp, (vp - list) * sizeof *vp); if (copycont) { @@ -254,7 +251,7 @@ xputs(s) } putchar(c); } - fflush(stdout); + (void) fflush(stdout); } # endif DEBUG /* @@ -314,3 +311,22 @@ sameword(a, b) } return (FALSE); } + /* +** SYSLOG -- fake entry to fool lint +*/ + +# ifdef LOG +# ifdef lint + +/*VARARGS2*/ +syslog(pri, fmt, args) + int pri; + char *fmt; +{ + pri = *fmt; + args = pri; + pri = args; +} + +# endif lint +# endif LOG