From 315b15886dcaaaf8e2bf474739d7c019d3f2396a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 9 Jul 1997 00:28:27 +0000 Subject: Clean up some -Wall complaints. --- lib/libc/gen/fnmatch.c | 4 ++-- lib/libc/gen/fstab.c | 12 ++++++------ lib/libc/gen/getbsize.c | 5 +++-- lib/libc/gen/getcwd.c | 4 ++-- lib/libc/gen/getgrent.c | 4 ++-- lib/libc/gen/getgrouplist.c | 4 ++-- lib/libc/gen/getlogin.c | 3 ++- lib/libc/gen/getpass.c | 4 ++-- lib/libc/gen/getttyent.c | 8 ++++---- lib/libc/gen/opendir.c | 3 ++- lib/libc/gen/popen.c | 4 ++-- lib/libc/gen/pwcache.c | 4 ++-- lib/libc/gen/rewinddir.c | 4 +++- lib/libc/gen/syslog.c | 4 ++-- lib/libc/gen/timezone.c | 32 ++++++++++++++++---------------- lib/libc/gen/ttyname.c | 6 +++--- lib/libc/gen/ttyslot.c | 10 +++++----- lib/libc/gen/unvis.c | 4 ++-- lib/libc/gen/vis.c | 6 +++--- 19 files changed, 65 insertions(+), 60 deletions(-) (limited to 'lib') diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c index ebe1edb084a..dd4740f6130 100644 --- a/lib/libc/gen/fnmatch.c +++ b/lib/libc/gen/fnmatch.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: fnmatch.c,v 1.2 1996/08/19 08:22:44 tholo Exp $"; +static char rcsid[] = "$OpenBSD: fnmatch.c,v 1.3 1997/07/09 00:28:18 millert Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -147,7 +147,7 @@ rangematch(pattern, test, flags) * consistency with the regular expression syntax. * J.T. Conklin (conklin@ngai.kaleida.com) */ - if (negate = (*pattern == '!' || *pattern == '^')) + if ((negate = (*pattern == '!' || *pattern == '^'))) ++pattern; for (ok = 0; (c = *pattern++) != ']';) { diff --git a/lib/libc/gen/fstab.c b/lib/libc/gen/fstab.c index d9d87de270d..98cd34302ff 100644 --- a/lib/libc/gen/fstab.c +++ b/lib/libc/gen/fstab.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: fstab.c,v 1.5 1997/06/14 01:42:09 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: fstab.c,v 1.6 1997/07/09 00:28:19 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -76,9 +76,9 @@ fstabscan() _fs_fstab.fs_vfstype = strcmp(_fs_fstab.fs_type, FSTAB_SW) ? "ufs" : "swap"; - if (cp = strtok((char *)NULL, ":\n")) { + if ((cp = strtok((char *)NULL, ":\n"))) { _fs_fstab.fs_freq = atoi(cp); - if (cp = strtok((char *)NULL, ":\n")) { + if ((cp = strtok((char *)NULL, ":\n"))) { _fs_fstab.fs_passno = atoi(cp); return(1); } @@ -144,8 +144,8 @@ bad: /* no way to distinguish between EOF and syntax error */ struct fstab * getfsent() { - if (!_fs_fp && !setfsent() || !fstabscan()) - return((struct fstab *)NULL); + if ((!_fs_fp && !setfsent()) || !fstabscan()) + return(NULL); return(&_fs_fstab); } @@ -178,7 +178,7 @@ setfsent() rewind(_fs_fp); return(1); } - if (_fs_fp = fopen(_PATH_FSTAB, "r")) + if ((_fs_fp = fopen(_PATH_FSTAB, "r"))) return(1); error(errno); return(0); diff --git a/lib/libc/gen/getbsize.c b/lib/libc/gen/getbsize.c index ddc8dd84010..b622bf32fe4 100644 --- a/lib/libc/gen/getbsize.c +++ b/lib/libc/gen/getbsize.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getbsize.c,v 1.3 1996/08/19 08:23:04 tholo Exp $"; +static char rcsid[] = "$OpenBSD: getbsize.c,v 1.4 1997/07/09 00:28:19 millert Exp $"; #endif /* not lint */ #include @@ -84,6 +84,7 @@ getbsize(headerlenp, blocksizep) default: fmterr: _warnx("%s: unknown blocksize", p); n = 512; + max = MAXB; mul = 1; break; } @@ -99,7 +100,7 @@ underflow: _warnx("%s: minimum blocksize is 512", p); } else blocksize = n = 512; - *headerlenp = snprintf(header, sizeof(header), "%d%s-blocks", n, form); + *headerlenp = snprintf(header, sizeof(header), "%ld%s-blocks", n, form); *blocksizep = blocksize; return (header); } diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c index 19f811a2fc3..7809e02f20e 100644 --- a/lib/libc/gen/getcwd.c +++ b/lib/libc/gen/getcwd.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getcwd.c,v 1.3 1996/11/27 22:00:45 millert Exp $"; +static char rcsid[] = "$OpenBSD: getcwd.c,v 1.4 1997/07/09 00:28:20 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -47,7 +47,7 @@ static char rcsid[] = "$OpenBSD: getcwd.c,v 1.3 1996/11/27 22:00:45 millert Exp #define ISDOT(dp) \ (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \ - dp->d_name[1] == '.' && dp->d_name[2] == '\0')) + (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) char * getcwd(pt, size) diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index f7b9b7805c3..650a91d2e7c 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -33,7 +33,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getgrent.c,v 1.6 1997/01/25 04:59:42 downsj Exp $"; +static char rcsid[] = "$OpenBSD: getgrent.c,v 1.7 1997/07/09 00:28:20 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -70,7 +70,7 @@ static int __ypcurrentlen; struct group * getgrent() { - if (!_gr_fp && !start_gr() || !grscan(0, 0, NULL)) + if ((!_gr_fp && !start_gr()) || !grscan(0, 0, NULL)) return(NULL); return(&_gr_group); } diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c index ae44c99cfe1..37cc2b5c5d5 100644 --- a/lib/libc/gen/getgrouplist.c +++ b/lib/libc/gen/getgrouplist.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getgrouplist.c,v 1.4 1996/09/15 09:31:01 tholo Exp $"; +static char rcsid[] = "$OpenBSD: getgrouplist.c,v 1.5 1997/07/09 00:28:21 millert Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -66,7 +66,7 @@ getgrouplist(uname, agroup, groups, grpcnt) * Scan the group file to find additional groups. */ setgrent(); - while (grp = getgrent()) { + while ((grp = getgrent())) { if (grp->gr_gid == agroup) continue; for (i = 0; grp->gr_mem[i]; i++) { diff --git a/lib/libc/gen/getlogin.c b/lib/libc/gen/getlogin.c index 73349f25a6d..abf13131da3 100644 --- a/lib/libc/gen/getlogin.c +++ b/lib/libc/gen/getlogin.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getlogin.c,v 1.2 1996/08/19 08:23:41 tholo Exp $"; +static char rcsid[] = "$OpenBSD: getlogin.c,v 1.3 1997/07/09 00:28:21 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -43,6 +43,7 @@ static char rcsid[] = "$OpenBSD: getlogin.c,v 1.2 1996/08/19 08:23:41 tholo Exp #include int __logname_valid; /* known to setlogin() */ +int _getlogin __P((char *, size_t)); char * getlogin() diff --git a/lib/libc/gen/getpass.c b/lib/libc/gen/getpass.c index 4fdc7f79be0..0e49afc09e6 100644 --- a/lib/libc/gen/getpass.c +++ b/lib/libc/gen/getpass.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getpass.c,v 1.4 1996/12/04 23:02:13 chuck Exp $"; +static char rcsid[] = "$OpenBSD: getpass.c,v 1.5 1997/07/09 00:28:22 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -74,7 +74,7 @@ getpass(prompt) (void)sigprocmask(SIG_BLOCK, &nset, &oset); (void)tcgetattr(fileno(fp), &term); - if (echo = (term.c_lflag & ECHO)) { + if ((echo = (term.c_lflag & ECHO))) { term.c_lflag &= ~ECHO; (void)tcsetattr(fileno(fp), TCSAFLUSH|TCSASOFT, &term); } diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c index 1ec45a1e52f..6638849d460 100644 --- a/lib/libc/gen/getttyent.c +++ b/lib/libc/gen/getttyent.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getttyent.c,v 1.3 1996/09/15 09:31:03 tholo Exp $"; +static char rcsid[] = "$OpenBSD: getttyent.c,v 1.4 1997/07/09 00:28:22 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -53,7 +53,7 @@ getttynam(tty) register struct ttyent *t; setttyent(); - while (t = getttyent()) + while ((t = getttyent())) if (!strcmp(tty, t->ty_name)) break; endttyent(); @@ -130,7 +130,7 @@ getttyent() tty.ty_comment = p; if (*p == 0) tty.ty_comment = 0; - if (p = strchr(p, '\n')) + if ((p = strchr(p, '\n'))) *p = '\0'; return (&tty); } @@ -190,7 +190,7 @@ setttyent() if (tf) { rewind(tf); return (1); - } else if (tf = fopen(_PATH_TTYS, "r")) + } else if ((tf = fopen(_PATH_TTYS, "r"))) return (1); return (0); } diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index 2c8487e82a9..81aa0538c31 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: opendir.c,v 1.3 1996/09/07 19:04:06 tholo Exp $"; +static char rcsid[] = "$OpenBSD: opendir.c,v 1.4 1997/07/09 00:28:23 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -43,6 +43,7 @@ static char rcsid[] = "$OpenBSD: opendir.c,v 1.3 1996/09/07 19:04:06 tholo Exp $ #include #include #include +#include #include /* diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index ccb2230ca51..9372d0ebf89 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: popen.c,v 1.6 1997/06/22 23:18:55 tholo Exp $"; +static char rcsid[] = "$OpenBSD: popen.c,v 1.7 1997/07/09 00:28:23 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -64,7 +64,7 @@ popen(program, type) FILE *iop; int pdes[2], pid; - if (*type != 'r' && *type != 'w' || type[1]) { + if ((*type != 'r' && *type != 'w') || type[1] != '\0') { errno = EINVAL; return (NULL); } diff --git a/lib/libc/gen/pwcache.c b/lib/libc/gen/pwcache.c index b2114cc302d..6b1997baced 100644 --- a/lib/libc/gen/pwcache.c +++ b/lib/libc/gen/pwcache.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: pwcache.c,v 1.2 1996/08/19 08:25:29 tholo Exp $"; +static char rcsid[] = "$OpenBSD: pwcache.c,v 1.3 1997/07/09 00:28:23 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -44,7 +44,7 @@ static char rcsid[] = "$OpenBSD: pwcache.c,v 1.2 1996/08/19 08:25:29 tholo Exp $ #include #define NCACHE 64 /* power of 2 */ -#define MASK NCACHE - 1 /* bits to store with */ +#define MASK (NCACHE - 1) /* bits to store with */ char * user_from_uid(uid, nouser) diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c index 33c488c9805..b863e719078 100644 --- a/lib/libc/gen/rewinddir.c +++ b/lib/libc/gen/rewinddir.c @@ -32,12 +32,14 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: rewinddir.c,v 1.2 1996/08/19 08:25:37 tholo Exp $"; +static char rcsid[] = "$OpenBSD: rewinddir.c,v 1.3 1997/07/09 00:28:24 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include +void __seekdir __P((DIR *, long)); + void rewinddir(dirp) DIR *dirp; diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index 81a5b4d6a48..cc56cdef0d6 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: syslog.c,v 1.2 1996/08/19 08:26:33 tholo Exp $"; +static char rcsid[] = "$OpenBSD: syslog.c,v 1.3 1997/07/09 00:28:24 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -177,7 +177,7 @@ vsyslog(pri, fmt, ap) * We wouldn't need this mess if printf handled %m, or if * strerror() had been invented before syslog(). */ - for (t = fmt_cpy, fmt_left = FMT_LEN; ch = *fmt; ++fmt) { + for (t = fmt_cpy, fmt_left = FMT_LEN; (ch = *fmt); ++fmt) { if (ch == '%' && fmt[1] == 'm') { ++fmt; prlen = snprintf(t, fmt_left, "%s", diff --git a/lib/libc/gen/timezone.c b/lib/libc/gen/timezone.c index 9a5c96227d7..6086f67bb31 100644 --- a/lib/libc/gen/timezone.c +++ b/lib/libc/gen/timezone.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: timezone.c,v 1.2 1996/08/19 08:26:48 tholo Exp $"; +static char rcsid[] = "$OpenBSD: timezone.c,v 1.3 1997/07/09 00:28:25 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -62,8 +62,8 @@ timezone(zone, dst) register char *beg, *end; - if (beg = getenv("TZNAME")) { /* set in environment */ - if (end = strchr(beg, ',')) { /* "PST,PDT" */ + if ((beg = getenv("TZNAME"))) { /* set in environment */ + if ((end = strchr(beg, ','))) { /* "PST,PDT" */ if (dst) return(++end); *end = '\0'; @@ -82,22 +82,22 @@ static struct zone { char *stdzone; char *dlzone; } zonetab[] = { - -1*60, "MET", "MET DST", /* Middle European */ - -2*60, "EET", "EET DST", /* Eastern European */ - 4*60, "AST", "ADT", /* Atlantic */ - 5*60, "EST", "EDT", /* Eastern */ - 6*60, "CST", "CDT", /* Central */ - 7*60, "MST", "MDT", /* Mountain */ - 8*60, "PST", "PDT", /* Pacific */ + { -1*60, "MET", "MET DST"} , /* Middle European */ + { -2*60, "EET", "EET DST"} , /* Eastern European */ + { 4*60, "AST", "ADT"} , /* Atlantic */ + { 5*60, "EST", "EDT"} , /* Eastern */ + { 6*60, "CST", "CDT"} , /* Central */ + { 7*60, "MST", "MDT"} , /* Mountain */ + { 8*60, "PST", "PDT"} , /* Pacific */ #ifdef notdef /* there's no way to distinguish this from WET */ - 0, "GMT", 0, /* Greenwich */ + { 0, "GMT", 0 }, /* Greenwich */ #endif - 0*60, "WET", "WET DST", /* Western European */ - -10*60, "EST", "EST", /* Aust: Eastern */ - -10*60+30, "CST", "CST", /* Aust: Central */ - -8*60, "WST", 0, /* Aust: Western */ - -1 + { 0*60, "WET", "WET DST" }, /* Western European */ + { -10*60, "EST", "EST" }, /* Aust: Eastern */ + { -10*60+30,"CST", "CST" }, /* Aust: Central */ + { -8*60, "WST", 0 }, /* Aust: Western */ + { -1 } }; /* diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c index 1d01f7b6294..0c965085e76 100644 --- a/lib/libc/gen/ttyname.c +++ b/lib/libc/gen/ttyname.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: ttyname.c,v 1.3 1996/09/15 09:31:07 tholo Exp $"; +static char rcsid[] = "$OpenBSD: ttyname.c,v 1.4 1997/07/09 00:28:25 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -68,7 +68,7 @@ ttyname(fd) if (fstat(fd, &sb) || !S_ISCHR(sb.st_mode)) return (NULL); - if (db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL)) { + if ((db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL))) { memset(&bkey, 0, sizeof(bkey)); bkey.type = S_IFCHR; bkey.dev = sb.st_rdev; @@ -98,7 +98,7 @@ oldttyname(fd, sb) if ((dp = opendir(_PATH_DEV)) == NULL) return (NULL); - while (dirp = readdir(dp)) { + while ((dirp = readdir(dp))) { if (dirp->d_fileno != sb->st_ino) continue; bcopy(dirp->d_name, buf + sizeof(_PATH_DEV) - 1, diff --git a/lib/libc/gen/ttyslot.c b/lib/libc/gen/ttyslot.c index 52fc873f80d..779cb37ce0c 100644 --- a/lib/libc/gen/ttyslot.c +++ b/lib/libc/gen/ttyslot.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: ttyslot.c,v 1.2 1996/08/19 08:27:04 tholo Exp $"; +static char rcsid[] = "$OpenBSD: ttyslot.c,v 1.3 1997/07/09 00:28:26 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -50,13 +50,13 @@ ttyslot() char *name; setttyent(); - for (cnt = 0; cnt < 3; ++cnt) - if (name = ttyname(cnt)) { - if (p = strrchr(name, '/')) + for (cnt = 0; cnt < 3; ++cnt) + if ((name = ttyname(cnt))) { + if ((p = strrchr(name, '/'))) ++p; else p = name; - for (slot = 1; ttyp = getttyent(); ++slot) + for (slot = 1; (ttyp = getttyent()); ++slot) if (!strcmp(ttyp->ty_name, p)) { endttyent(); return(slot); diff --git a/lib/libc/gen/unvis.c b/lib/libc/gen/unvis.c index e6eabd334e0..db92e7eea6d 100644 --- a/lib/libc/gen/unvis.c +++ b/lib/libc/gen/unvis.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: unvis.c,v 1.4 1996/09/15 09:31:10 tholo Exp $"; +static char rcsid[] = "$OpenBSD: unvis.c,v 1.5 1997/07/09 00:28:26 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -230,7 +230,7 @@ strunvis(dst, src) char *start = dst; int state = 0; - while (c = *src++) { + while ((c = *src++)) { again: switch (unvis(dst, c, &state, 0)) { case UNVIS_VALID: diff --git a/lib/libc/gen/vis.c b/lib/libc/gen/vis.c index 071cc505819..2b755bf1605 100644 --- a/lib/libc/gen/vis.c +++ b/lib/libc/gen/vis.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: vis.c,v 1.2 1996/08/19 08:27:36 tholo Exp $"; +static char rcsid[] = "$OpenBSD: vis.c,v 1.3 1997/07/09 00:28:26 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -51,7 +51,7 @@ vis(dst, c, flag, nextc) int c, nextc; register int flag; { - if ((u_int)c <= UCHAR_MAX && isascii(c) && isgraph(c) || + if (((u_int)c <= UCHAR_MAX && isascii(c) && isgraph(c)) || ((flag & VIS_SP) == 0 && c == ' ') || ((flag & VIS_TAB) == 0 && c == '\t') || ((flag & VIS_NL) == 0 && c == '\n') || @@ -158,7 +158,7 @@ strvis(dst, src, flag) register char c; char *start; - for (start = dst; c = *src;) + for (start = dst; (c = *src);) dst = vis(dst, c, flag, *++src); *dst = '\0'; return (dst - start); -- cgit v1.2.3