From 24d1b49eff196da594b7cfa86030a0aee2e2674f Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 19 Jul 1997 07:11:45 +0000 Subject: Wall cleanup; people running lpd should test! --- usr.sbin/lpr/common_source/common.c | 8 ++++---- usr.sbin/lpr/filters/lpf.c | 6 +++--- usr.sbin/lpr/lpd/lpd.c | 9 +++++---- usr.sbin/lpr/lpd/printjob.c | 35 ++++++++++++++++------------------- usr.sbin/lpr/lpr/lpr.c | 8 ++++---- 5 files changed, 32 insertions(+), 34 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index 5f97d093306..9e3f963db50 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: common.c,v 1.4 1997/01/17 16:11:35 millert Exp $ */ +/* $OpenBSD: common.c,v 1.5 1997/07/19 07:11:41 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: common.c,v 1.4 1997/01/17 16:11:35 millert Exp $"; +static char rcsid[] = "$OpenBSD: common.c,v 1.5 1997/07/19 07:11:41 deraadt Exp $"; #endif #endif /* not lint */ @@ -52,6 +52,7 @@ static char rcsid[] = "$OpenBSD: common.c,v 1.4 1997/01/17 16:11:35 millert Exp #include #include +#include #include #include @@ -145,8 +146,7 @@ getport(rhost, rport) if (rhost == NULL) fatal("no remote host to connect to"); bzero((char *)&sin, sizeof(sin)); - sin.sin_addr.s_addr = inet_addr(rhost); - if (sin.sin_addr.s_addr != INADDR_NONE) + if (inet_aton(rhost, &sin.sin_addr) != -1) sin.sin_family = AF_INET; else { hp = gethostbyname(rhost); diff --git a/usr.sbin/lpr/filters/lpf.c b/usr.sbin/lpr/filters/lpf.c index 4b9561693eb..7dae02418f3 100644 --- a/usr.sbin/lpr/filters/lpf.c +++ b/usr.sbin/lpr/filters/lpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpf.c,v 1.3 1997/01/17 16:12:33 millert Exp $ */ +/* $OpenBSD: lpf.c,v 1.4 1997/07/19 07:11:42 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)lpf.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: lpf.c,v 1.3 1997/01/17 16:12:33 millert Exp $"; +static char rcsid[] = "$OpenBSD: lpf.c,v 1.4 1997/07/19 07:11:42 deraadt Exp $"; #endif #endif /* not lint */ @@ -177,7 +177,7 @@ main(argc, argv) } default: - if (col >= width || !literal && ch < ' ') { + if ((col >= width) || (!literal && ch < ' ')) { col++; break; } diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c index b00baa2ed8d..3a462cac510 100644 --- a/usr.sbin/lpr/lpd/lpd.c +++ b/usr.sbin/lpr/lpd/lpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpd.c,v 1.13 1997/01/17 16:12:41 millert Exp $ */ +/* $OpenBSD: lpd.c,v 1.14 1997/07/19 07:11:43 deraadt Exp $ */ /* $NetBSD: lpd.c,v 1.7 1996/04/24 14:54:06 mrg Exp $ */ /* @@ -45,7 +45,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)lpd.c 8.7 (Berkeley) 5/10/95"; #else -static char rcsid[] = "$OpenBSD: lpd.c,v 1.13 1997/01/17 16:12:41 millert Exp $"; +static char rcsid[] = "$OpenBSD: lpd.c,v 1.14 1997/07/19 07:11:43 deraadt Exp $"; #endif #endif /* not lint */ @@ -103,6 +103,8 @@ static char rcsid[] = "$OpenBSD: lpd.c,v 1.13 1997/01/17 16:12:41 millert Exp $" #include "pathnames.h" #include "extern.h" +extern int __ivaliduser __P((FILE *, in_addr_t, const char *, const char *)); + int lflag; /* log requests flag */ int from_remote; /* from remote socket */ @@ -357,7 +359,7 @@ doit() if (lflag) { if (*cp >= '\1' && *cp <= '\5') syslog(LOG_INFO, "%s requests %s %s", - from, cmdnames[*cp], cp+1); + from, cmdnames[(int)*cp], cp+1); else syslog(LOG_INFO, "bad request (%d) from %s", *cp, from); @@ -516,7 +518,6 @@ chkhost(f) register struct hostent *hp; register FILE *hostf; int first = 1; - extern char *inet_ntoa(); int good = 0; /* Need real hostname for temporary filenames */ diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 299e37aeca1..d5dfd927726 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printjob.c,v 1.11 1997/04/04 18:41:44 deraadt Exp $ */ +/* $OpenBSD: printjob.c,v 1.12 1997/07/19 07:11:44 deraadt Exp $ */ /* $NetBSD: printjob.c,v 1.9.4.3 1996/07/12 22:31:39 jtc Exp $ */ /* @@ -132,7 +132,6 @@ static char *scnline __P((int, char *, int)); static int sendfile __P((int, char *)); static int sendit __P((char *)); static void sendmail __P((char *, int)); -static void set_ttyflags __P((struct termios *)); static void setty __P((void)); void @@ -332,7 +331,7 @@ printit(file) */ for (i = 0; i < 4; i++) strcpy(fonts[i], ifonts[i]); - sprintf(&width[2], "%d", PW); + sprintf(&width[2], "%ld", PW); strcpy(indent+2, "0"); /* @@ -719,7 +718,7 @@ start: tof = 0; /* Copy filter output to "lf" logfile */ - if (fp = fopen(tempfile, "r")) { + if ((fp = fopen(tempfile, "r"))) { while (fgets(buf, sizeof(buf), fp)) fputs(buf, stderr); fclose(fp); @@ -794,7 +793,7 @@ sendit(file) } if (line[0] >= 'a' && line[0] <= 'z') { strcpy(last, line); - while (i = getline(cfp)) + while ((i = getline(cfp))) if (strcmp(last, line)) break; switch (sendfile('\3', last+1)) { @@ -926,7 +925,6 @@ banner(name1, name2) char *name1, *name2; { time_t tvec; - extern char *ctime(); time(&tvec); if (!SF && !tof) @@ -999,7 +997,7 @@ scan_out(scfd, scsp, dlm) for (j = WIDTH; --j;) *strp++ = BACKGND; else - strp = scnline(scnkey[c][scnhgt-1-d], strp, cc); + strp = scnline(scnkey[(int)c][scnhgt-1-d], strp, cc); if (*sp == dlm || *sp == '\0' || nchrs++ >= PW/(WIDTH+1)-1) break; *strp++ = BACKGND; @@ -1045,7 +1043,7 @@ sendmail(user, bombed) { register int i, nofile; int p[2], s; - register char *cp; + register char *cp = NULL; char buf[100]; struct stat stb; FILE *fp; @@ -1058,7 +1056,7 @@ sendmail(user, bombed) (void) close(i); if ((cp = strrchr(_PATH_SENDMAIL, '/')) != NULL) cp++; - else + else cp = _PATH_SENDMAIL; snprintf(buf, sizeof buf, "%s@%s", user, fromhost); execl(_PATH_SENDMAIL, cp, buf, 0); @@ -1133,8 +1131,8 @@ dofork(action) if (pid == 0) { pw = getpwuid(DU); if (pw == 0) { - syslog(LOG_ERR, "uid %d not in password file", - DU); + syslog(LOG_ERR, "uid %u not in password file", + (uid_t)DU); break; } initgroups(pw->pw_name, pw->pw_gid); @@ -1206,18 +1204,18 @@ init() FF = DEFFF; if (cgetnum(bp, "pw", &PW) < 0) PW = DEFWIDTH; - sprintf(&width[2], "%d", PW); + sprintf(&width[2], "%ld", PW); if (cgetnum(bp, "pl", &PL) < 0) PL = DEFLENGTH; - sprintf(&length[2], "%d", PL); + sprintf(&length[2], "%ld", PL); if (cgetnum(bp,"px", &PX) < 0) PX = 0; - sprintf(&pxwidth[2], "%d", PX); + sprintf(&pxwidth[2], "%ld", PX); if (cgetnum(bp, "py", &PY) < 0) PY = 0; - sprintf(&pxlength[2], "%d", PY); + sprintf(&pxlength[2], "%ld", PY); cgetstr(bp, "rm", &RM); - if (s = checkremote()) + if ((s = checkremote())) syslog(LOG_WARNING, s); cgetstr(bp, "af", &AF); @@ -1263,7 +1261,7 @@ openpr() char *cp; if (!remote && *LP) { - if (cp = strchr(LP, '@')) + if ((cp = strchr(LP, '@'))) opennet(cp); else opentty(); @@ -1358,7 +1356,6 @@ static void opentty() { register int i; - int resp, port; for (i = 1; ; i = i < 32 ? i << 1 : i) { pfd = open(LP, RW ? O_RDWR : O_WRONLY); @@ -1387,7 +1384,7 @@ static void openrem() { register int i, n; - int resp, port; + int resp; for (i = 1; ; i = i < 256 ? i << 1 : i) { resp = -1; diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c index e27aa660f6a..4889be99396 100644 --- a/usr.sbin/lpr/lpr/lpr.c +++ b/usr.sbin/lpr/lpr/lpr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lpr.c,v 1.17 1997/07/09 00:16:12 millert Exp $ */ +/* $OpenBSD: lpr.c,v 1.18 1997/07/19 07:11:44 deraadt Exp $ */ /* $NetBSD: lpr.c,v 1.10 1996/03/21 18:12:25 jtc Exp $ */ /* @@ -50,7 +50,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)lpr.c 8.4 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: lpr.c,v 1.17 1997/07/09 00:16:12 millert Exp $"; +static char rcsid[] = "$OpenBSD: lpr.c,v 1.18 1997/07/19 07:11:44 deraadt Exp $"; #endif #endif /* not lint */ @@ -111,12 +111,12 @@ static void chkprinter __P((char *)); static void cleanup __P((int)); static void copy __P((int, char [])); static void fatal2 __P((const char *, ...)); -static char *itoa __P((int)); static char *linked __P((char *)); static char *lmktemp __P((char *, int, int)); static void mktemps __P((void)); static int nfile __P((char *)); static int test __P((char *)); +static char *itoa __P((int)); uid_t uid, euid; @@ -127,7 +127,6 @@ main(argc, argv) { struct passwd *pw; struct group *gptr; - extern char *itoa(); register char *arg, *cp; char buf[BUFSIZ]; int i, f; @@ -411,6 +410,7 @@ main(argc, argv) exit(0); } cleanup(0); + return (1); /* NOTREACHED */ } -- cgit v1.2.3