diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-12-14 12:18:28 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-12-14 12:18:28 +0000 |
commit | 28e461d672204f54b8eb68a590d36c23a32f9574 (patch) | |
tree | 3e3c51ee95dec9ad261710930b40e4426389cbb8 | |
parent | fb3035e3379d9258753316427b03a4d8d0676d07 (diff) |
-Wall'ing.
39 files changed, 189 insertions, 162 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c index d378e3747f5..12452ecf096 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cat.c,v 1.6 1996/09/28 20:52:50 imp Exp $ */ +/* $OpenBSD: cat.c,v 1.7 1996/12/14 12:17:33 mickey Exp $ */ /* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: cat.c,v 1.6 1996/09/28 20:52:50 imp Exp $"; +static char rcsid[] = "$OpenBSD: cat.c,v 1.7 1996/12/14 12:17:33 mickey Exp $"; #endif #endif /* not lint */ @@ -253,7 +253,7 @@ raw_cat(rfd) err(1, "%s", filename); bsize = MAX(sbuf.st_blksize, 1024); if ((buf = malloc((u_int)bsize)) == NULL) - err(1, NULL); + err(1, "buffer"); } while ((nr = read(rfd, buf, bsize)) > 0) for (off = 0; nr; nr -= nw, off += nw) diff --git a/bin/chio/chio.c b/bin/chio/chio.c index e8045728cbd..8954ba8dda1 100644 --- a/bin/chio/chio.c +++ b/bin/chio/chio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chio.c,v 1.4 1996/11/02 03:47:10 deraadt Exp $ */ +/* $OpenBSD: chio.c,v 1.5 1996/12/14 12:17:35 mickey Exp $ */ /* $NetBSD: chio.c,v 1.1.1.1 1996/04/03 00:34:38 thorpej Exp $ */ /* @@ -104,7 +104,6 @@ main(argc, argv) char **argv; { int ch, i; - char *cp; while ((ch = getopt(argc, argv, "f:")) != -1) { switch (ch) { @@ -478,7 +477,12 @@ do_status(cname, argc, argv) struct changer_params data; u_int8_t *statusp; int i, count, chet, schet, echet; - char *cmdname, *description; + char *description; + +#ifdef lint + count = 0; + description = NULL; +#endif /* * On a status command, we expect the following: diff --git a/bin/chmod/chmod.c b/bin/chmod/chmod.c index e35f3ce5cbd..9893e13c961 100644 --- a/bin/chmod/chmod.c +++ b/bin/chmod/chmod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chmod.c,v 1.3 1996/08/02 12:40:50 deraadt Exp $ */ +/* $OpenBSD: chmod.c,v 1.4 1996/12/14 12:17:37 mickey Exp $ */ /* $NetBSD: chmod.c,v 1.12 1995/03/21 09:02:09 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94"; #else -static char rcsid[] = "$OpenBSD: chmod.c,v 1.3 1996/08/02 12:40:50 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: chmod.c,v 1.4 1996/12/14 12:17:37 mickey Exp $"; #endif #endif /* not lint */ @@ -74,7 +74,10 @@ main(argc, argv) int oct, omode; int Hflag, Lflag, Pflag, Rflag, ch, fflag, fts_options, hflag, rval; char *ep, *mode; - +#ifdef lint + set = NULL; + omode = 0; +#endif Hflag = Lflag = Pflag = Rflag = fflag = hflag = 0; while ((ch = getopt(argc, argv, "HLPRXfgorstuwx")) != -1) switch (ch) { diff --git a/bin/cp/cp.c b/bin/cp/cp.c index 7b77747aa3e..fc3e45047e8 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cp.c,v 1.4 1996/10/28 02:55:05 tholo Exp $ */ +/* $OpenBSD: cp.c,v 1.5 1996/12/14 12:17:38 mickey Exp $ */ /* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cp.c 8.5 (Berkeley) 4/29/95"; #else -static char rcsid[] = "$OpenBSD: cp.c,v 1.4 1996/10/28 02:55:05 tholo Exp $"; +static char rcsid[] = "$OpenBSD: cp.c,v 1.5 1996/12/14 12:17:38 mickey Exp $"; #endif #endif /* not lint */ @@ -258,7 +258,9 @@ copy(argv, type, fts_options) FTSENT *curr; int base, dne, nlen, rval; char *p, *target_mid; - +#ifdef lint + base = 0; +#endif if ((ftsp = fts_open(argv, fts_options, mastercmp)) == NULL) err(1, NULL); for (rval = 0; (curr = fts_read(ftsp)) != NULL;) { diff --git a/bin/csh/alloc.c b/bin/csh/alloc.c index 1b3bc03f77a..a35927a8833 100644 --- a/bin/csh/alloc.c +++ b/bin/csh/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.2 1996/06/23 14:19:12 deraadt Exp $ */ +/* $OpenBSD: alloc.c,v 1.3 1996/12/14 12:17:40 mickey Exp $ */ /* $NetBSD: alloc.c,v 1.6 1995/03/21 09:02:23 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)alloc.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: alloc.c,v 1.2 1996/06/23 14:19:12 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: alloc.c,v 1.3 1996/12/14 12:17:40 mickey Exp $"; #endif #endif /* not lint */ @@ -126,6 +126,6 @@ showall(v, t) struct command *t; { memtop = (char *) sbrk(0); - (void) fprintf(cshout, "Allocated memory from 0x%lx to 0x%lx (%ld).\n", + (void) fprintf(cshout, "Allocated memory from 0x%lx to 0x%lx (%d).\n", (unsigned long) membot, (unsigned long) memtop, memtop - membot); } diff --git a/bin/csh/printf.c b/bin/csh/printf.c index a44269b597a..b39ff0a7c44 100644 --- a/bin/csh/printf.c +++ b/bin/csh/printf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printf.c,v 1.4 1996/09/15 22:00:26 millert Exp $ */ +/* $OpenBSD: printf.c,v 1.5 1996/12/14 12:17:41 mickey Exp $ */ /* $NetBSD: printf.c,v 1.6 1995/03/21 09:03:15 cgd Exp $ */ /* @@ -34,7 +34,7 @@ * SUCH DAMAGE. */ -#if !defined(BUILTIN) && !defined(SHELL) +#if !defined(BUILTIN) #ifndef lint static char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ @@ -46,36 +46,18 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 7/20/93"; #else -static char rcsid[] = "$OpenBSD: printf.c,v 1.4 1996/09/15 22:00:26 millert Exp $"; +static char rcsid[] = "$OpenBSD: printf.c,v 1.5 1996/12/14 12:17:41 mickey Exp $"; #endif #endif /* not lint */ #include <sys/types.h> -#include <err.h> #include <errno.h> #include <limits.h> -#ifdef SHELL -#define EOF -1 -#else #include <stdio.h> -#endif #include <stdlib.h> #include <string.h> - -/* - * XXX - * This *has* to go away. TK. - */ -#ifdef SHELL -#define main printfcmd -#define warnx(a, b, c) { \ - char buf[64]; \ - (void)snprintf(buf, sizeof(buf), a, b, c); \ - error(buf); \ -} -#include "../../bin/sh/bltin/bltin.h" -#endif +#include <err.h> #define PF(f, func) { \ if (fieldwidth) \ @@ -264,7 +246,7 @@ escape(fmt) register char *store; register int value, c; - for (store = fmt; c = *fmt; ++fmt, ++store) { + for (store = fmt; (c = *fmt) != 0; ++fmt, ++store) { if (c != '\\') { *store = c; continue; diff --git a/bin/csh/proc.c b/bin/csh/proc.c index 200d59e1963..da53e3b325c 100644 --- a/bin/csh/proc.c +++ b/bin/csh/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.2 1996/06/23 14:19:28 deraadt Exp $ */ +/* $OpenBSD: proc.c,v 1.3 1996/12/14 12:17:42 mickey Exp $ */ /* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: proc.c,v 1.2 1996/06/23 14:19:28 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: proc.c,v 1.3 1996/12/14 12:17:42 mickey Exp $"; #endif #endif /* not lint */ @@ -53,6 +53,7 @@ static char rcsid[] = "$OpenBSD: proc.c,v 1.2 1996/06/23 14:19:28 deraadt Exp $" #else # include <varargs.h> #endif +#include <err.h> #include "csh.h" #include "dir.h" @@ -1190,7 +1191,7 @@ pfind(cp) } if (np) return (np); - stderror(ERR_NAME | cp[1] == '?' ? ERR_JOBPAT : ERR_NOSUCHJOB); + stderror(ERR_NAME | (cp[1] == '?' ? ERR_JOBPAT : ERR_NOSUCHJOB)); /* NOTREACHED */ return (0); } diff --git a/bin/csh/time.c b/bin/csh/time.c index fb5855909ac..c70fc4c7fa7 100644 --- a/bin/csh/time.c +++ b/bin/csh/time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: time.c,v 1.2 1996/06/23 14:19:31 deraadt Exp $ */ +/* $OpenBSD: time.c,v 1.3 1996/12/14 12:17:44 mickey Exp $ */ /* $NetBSD: time.c,v 1.7 1995/03/21 13:55:25 mycroft Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: time.c,v 1.2 1996/06/23 14:19:31 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: time.c,v 1.3 1996/12/14 12:17:44 mickey Exp $"; #endif #endif /* not lint */ @@ -251,7 +251,7 @@ pdeltat(t1, t0) struct timeval td; timersub(t1, t0, &td); - (void) fprintf(cshout, "%d.%01d", td.tv_sec, td.tv_usec / 100000); + (void) fprintf(cshout, "%ld.%01ld", td.tv_sec, td.tv_usec / 100000); } #define P2DIG(i) (void) fprintf(cshout, "%d%d", (i) / 10, (i) % 10) diff --git a/bin/date/netdate.c b/bin/date/netdate.c index b3670155acb..28b4768a26a 100644 --- a/bin/date/netdate.c +++ b/bin/date/netdate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netdate.c,v 1.4 1996/08/26 23:31:26 deraadt Exp $ */ +/* $OpenBSD: netdate.c,v 1.5 1996/12/14 12:17:45 mickey Exp $ */ /* $NetBSD: netdate.c,v 1.10 1995/09/07 06:21:06 jtc Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)netdate.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$OpenBSD: netdate.c,v 1.4 1996/08/26 23:31:26 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: netdate.c,v 1.5 1996/12/14 12:17:45 mickey Exp $"; #endif #endif /* not lint */ @@ -56,6 +56,7 @@ static char rcsid[] = "$OpenBSD: netdate.c,v 1.4 1996/08/26 23:31:26 deraadt Exp #include <stdio.h> #include <string.h> #include <unistd.h> +#include <rpc/rpc.h> /* bindresvport() proto */ #include "extern.h" diff --git a/bin/dd/args.c b/bin/dd/args.c index 6a4d98283e2..3d8ec3053de 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -1,4 +1,4 @@ -/* $OpenBSD: args.c,v 1.4 1996/06/23 14:19:45 deraadt Exp $ */ +/* $OpenBSD: args.c,v 1.5 1996/12/14 12:17:47 mickey Exp $ */ /* $NetBSD: args.c,v 1.7 1996/03/01 01:18:58 jtc Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: args.c,v 1.4 1996/06/23 14:19:45 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: args.c,v 1.5 1996/12/14 12:17:47 mickey Exp $"; #endif #endif /* not lint */ @@ -105,7 +105,7 @@ jcl(argv) in.dbsz = out.dbsz = 512; - while (oper = *++argv) { + while ((oper = *++argv) != NULL) { oper = strdup(oper); if ((arg = strchr(oper, '=')) == NULL) errx(1, "unknown operand %s", oper); diff --git a/bin/dd/conv.c b/bin/dd/conv.c index bd3f3f4efbc..026ccd55259 100644 --- a/bin/dd/conv.c +++ b/bin/dd/conv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conv.c,v 1.3 1996/06/23 14:19:46 deraadt Exp $ */ +/* $OpenBSD: conv.c,v 1.4 1996/12/14 12:17:48 mickey Exp $ */ /* $NetBSD: conv.c,v 1.6 1996/02/20 19:29:02 jtc Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)conv.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: conv.c,v 1.3 1996/06/23 14:19:46 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: conv.c,v 1.4 1996/12/14 12:17:48 mickey Exp $"; #endif #endif /* not lint */ @@ -67,7 +67,7 @@ def() u_char *inp; const u_char *t; - if (t = ctab) + if ((t = ctab) != NULL) for (inp = in.dbp - (cnt = in.dbrcnt); cnt--; ++inp) *inp = t[*inp]; @@ -118,7 +118,7 @@ void block() { static int intrunc; - int ch, cnt, maxlen; + int ch = -1, cnt, maxlen; u_char *inp, *outp; const u_char *t; @@ -148,7 +148,7 @@ block() */ for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) { maxlen = MIN(cbsz, in.dbcnt); - if (t = ctab) + if ((t = ctab) != NULL) for (cnt = 0; cnt < maxlen && (ch = *inp++) != '\n'; ++cnt) *outp++ = t[ch]; @@ -233,7 +233,7 @@ unblock() const u_char *t; /* Translation and case conversion. */ - if (t = ctab) + if ((t = ctab) != NULL) for (cnt = in.dbrcnt, inp = in.dbp; cnt--;) *--inp = t[*inp]; /* diff --git a/bin/dd/dd.c b/bin/dd/dd.c index 0af46589149..d89ac0d442f 100644 --- a/bin/dd/dd.c +++ b/bin/dd/dd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dd.c,v 1.3 1996/06/23 14:19:47 deraadt Exp $ */ +/* $OpenBSD: dd.c,v 1.4 1996/12/14 12:17:49 mickey Exp $ */ /* $NetBSD: dd.c,v 1.6 1996/02/20 19:29:06 jtc Exp $ */ /*- @@ -48,7 +48,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: dd.c,v 1.3 1996/06/23 14:19:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: dd.c,v 1.4 1996/12/14 12:17:49 mickey Exp $"; #endif #endif /* not lint */ @@ -152,12 +152,12 @@ setup() */ if (!(ddflags & (C_BLOCK|C_UNBLOCK))) { if ((in.db = malloc(out.dbsz + in.dbsz - 1)) == NULL) - err(1, NULL); + err(1, "input buffer"); out.db = in.db; } else if ((in.db = malloc((u_int)(MAX(in.dbsz, cbsz) + cbsz))) == NULL || (out.db = malloc((u_int)(out.dbsz + cbsz))) == NULL) - err(1, NULL); + err(1, "output buffer"); in.dbp = in.db; out.dbp = out.db; @@ -171,7 +171,7 @@ setup() * Truncate the output file; ignore errors because it fails on some * kinds of output files, tapes, for example. */ - if (ddflags & (C_OF | C_SEEK | C_NOTRUNC) == (C_OF | C_SEEK)) + if ((ddflags & (C_OF | C_SEEK | C_NOTRUNC)) == (C_OF | C_SEEK)) (void)ftruncate(out.fd, (off_t)out.offset * out.dbsz); /* diff --git a/bin/dd/misc.c b/bin/dd/misc.c index 666e10e1174..76f549ab9ab 100644 --- a/bin/dd/misc.c +++ b/bin/dd/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.2 1996/06/23 14:19:49 deraadt Exp $ */ +/* $OpenBSD: misc.c,v 1.3 1996/12/14 12:17:50 mickey Exp $ */ /* $NetBSD: misc.c,v 1.4 1995/03/21 09:04:10 cgd Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: misc.c,v 1.2 1996/06/23 14:19:49 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: misc.c,v 1.3 1996/12/14 12:17:50 mickey Exp $"; #endif #endif /* not lint */ @@ -69,21 +69,21 @@ summary() secs = 1; /* Use snprintf(3) so that we don't reenter stdio(3). */ (void)snprintf(buf, sizeof(buf), - "%u+%u records in\n%u+%u records out\n", + "%lu+%lu records in\n%lu+%lu records out\n", st.in_full, st.in_part, st.out_full, st.out_part); (void)write(STDERR_FILENO, buf, strlen(buf)); if (st.swab) { - (void)snprintf(buf, sizeof(buf), "%u odd length swab %s\n", + (void)snprintf(buf, sizeof(buf), "%lu odd length swab %s\n", st.swab, (st.swab == 1) ? "block" : "blocks"); (void)write(STDERR_FILENO, buf, strlen(buf)); } if (st.trunc) { - (void)snprintf(buf, sizeof(buf), "%u truncated %s\n", + (void)snprintf(buf, sizeof(buf), "%lu truncated %s\n", st.trunc, (st.trunc == 1) ? "block" : "blocks"); (void)write(STDERR_FILENO, buf, strlen(buf)); } (void)snprintf(buf, sizeof(buf), - "%u bytes transferred in %u secs (%u bytes/sec)\n", + "%lu bytes transferred in %lu secs (%lu bytes/sec)\n", st.bytes, secs, st.bytes / secs); (void)write(STDERR_FILENO, buf, strlen(buf)); } diff --git a/bin/df/df.c b/bin/df/df.c index ebe8df29cb0..14ef2cf10c7 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -1,4 +1,4 @@ -/* $OpenBSD: df.c,v 1.5 1996/12/07 09:09:06 deraadt Exp $ */ +/* $OpenBSD: df.c,v 1.6 1996/12/14 12:17:52 mickey Exp $ */ /* $NetBSD: df.c,v 1.21.2.1 1995/11/01 00:06:11 jtc Exp $ */ /* @@ -49,7 +49,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: df.c,v 1.5 1996/12/07 09:09:06 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: df.c,v 1.6 1996/12/14 12:17:52 mickey Exp $"; #endif #endif /* not lint */ @@ -241,14 +241,14 @@ maketypelist(fslist) which = IN_LIST; /* Count the number of types. */ - for (i = 1, nextcp = fslist; nextcp = strchr(nextcp, ','); i++) + for (i = 1, nextcp = fslist; (nextcp = strchr(nextcp, ',')) != NULL; i++) ++nextcp; /* Build an array of that many types. */ if ((av = typelist = malloc((i + 1) * sizeof(char *))) == NULL) err(1, NULL); av[0] = fslist; - for (i = 1, nextcp = fslist; nextcp = strchr(nextcp, ','); i++) { + for (i = 1, nextcp = fslist; (nextcp = strchr(nextcp, ',')) != NULL; i++) { *nextcp = '\0'; av[i] = ++nextcp; } diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c index b92b2ab1a5b..83c092c0435 100644 --- a/bin/ed/glbl.c +++ b/bin/ed/glbl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glbl.c,v 1.4 1996/10/12 19:38:34 millert Exp $ */ +/* $OpenBSD: glbl.c,v 1.5 1996/12/14 12:17:53 mickey Exp $ */ /* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */ /* glob.c: This file contains the global command routines for the ed line @@ -33,7 +33,7 @@ #if 0 static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp"; #else -static char rcsid[] = "$OpenBSD: glbl.c,v 1.4 1996/10/12 19:38:34 millert Exp $"; +static char rcsid[] = "$OpenBSD: glbl.c,v 1.5 1996/12/14 12:17:53 mickey Exp $"; #endif #endif /* not lint */ @@ -137,8 +137,8 @@ exec_global(interact, gflag) for (; *ibufp;) if ((status = extract_addr_range()) < 0 || (status = exec_command()) < 0 || - status > 0 && (status = display_lines( - current_addr, current_addr, status)) < 0) + (status > 0 && (status = display_lines( + current_addr, current_addr, status)) < 0)) return status; } return 0; diff --git a/bin/ed/io.c b/bin/ed/io.c index bee2ea7f5ad..c9e2ce12f82 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.5 1996/12/12 12:37:53 mickey Exp $ */ +/* $OpenBSD: io.c,v 1.6 1996/12/14 12:17:54 mickey Exp $ */ /* $NetBSD: io.c,v 1.2 1995/03/21 09:04:43 cgd Exp $ */ /* io.c: This file contains the i/o routines for the ed line editor */ @@ -32,7 +32,7 @@ #if 0 static char *rcsid = "@(#)io.c,v 1.1 1994/02/01 00:34:41 alm Exp"; #else -static char rcsid[] = "$OpenBSD: io.c,v 1.5 1996/12/12 12:37:53 mickey Exp $"; +static char rcsid[] = "$OpenBSD: io.c,v 1.6 1996/12/14 12:17:54 mickey Exp $"; #endif #endif /* not lint */ @@ -111,7 +111,7 @@ read_stream(fp, n) return ERR; if (appended && size && o_isbinary && o_newline_added) fputs("newline inserted\n", stderr); - else if (newline_added && (!appended || !isbinary && !o_isbinary)) + else if (newline_added && (!appended || (!isbinary && !o_isbinary))) fputs("newline appended\n", stderr); if (isbinary && newline_added && !appended) size += 1; @@ -133,8 +133,8 @@ get_stream_line(fp) register int c; register int i = 0; - while (((c = des ? get_des_char(fp) : getc(fp)) != EOF || !feof(fp) && - !ferror(fp)) && c != '\n') { + while (((c = des ? get_des_char(fp) : getc(fp)) != EOF || (!feof(fp) && + !ferror(fp) && c != '\n'))) { REALLOC(sbuf, sbufsz, i + 1, ERR); if (!(sbuf[i++] = c)) isbinary = 1; @@ -333,7 +333,9 @@ put_tty_line(s, l, n, gflag) int gflag; { int col = 0; +#ifndef BACKWARDS int lc = 0; +#endif char *cp; if (gflag & GNP) { diff --git a/bin/ed/main.c b/bin/ed/main.c index 0e7e6df6d3d..0400323cdf0 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.4 1996/10/12 19:38:38 millert Exp $ */ +/* $OpenBSD: main.c,v 1.5 1996/12/14 12:17:56 mickey Exp $ */ /* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */ /* main.c: This file contains the main control and user-interface routines @@ -39,7 +39,7 @@ char *copyright = #if 0 static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.4 1996/10/12 19:38:38 millert Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.5 1996/12/14 12:17:56 mickey Exp $"; #endif #endif /* not lint */ @@ -160,7 +160,7 @@ top: #ifdef _POSIX_SOURCE if (status = sigsetjmp(env, 1)) #else - if (status = setjmp(env)) + if ((status = setjmp(env)) != 0) #endif { fputs("\n?\n", stderr); @@ -217,9 +217,9 @@ top: isglobal = 0; if ((status = extract_addr_range()) >= 0 && (status = exec_command()) >= 0) - if (!status || status && + if (!status || (status && (status = display_lines(current_addr, current_addr, - status)) >= 0) + status)) >= 0)) continue; switch (status) { case EOF: @@ -548,7 +548,7 @@ exec_command() return ERR; else if (build_active_list(c == 'g' || c == 'G') < 0) return ERR; - else if (n = (c == 'G' || c == 'V')) + else if ((n = (c == 'G' || c == 'V'))) GET_COMMAND_SUFFIX(); isglobal++; if (exec_global(n, gflag) < 0) @@ -844,7 +844,7 @@ exec_command() break; case '=': GET_COMMAND_SUFFIX(); - printf("%d\n", addr_cnt ? second_addr : addr_last); + printf("%ld\n", addr_cnt ? second_addr : addr_last); break; case '!': if (addr_cnt > 0) { @@ -906,7 +906,7 @@ get_matching_node_addr(pat, dir) if (!pat) return ERR; do { - if (n = dir ? INC_MOD(n, addr_last) : DEC_MOD(n, addr_last)) { + if ((n = dir ? INC_MOD(n, addr_last) : DEC_MOD(n, addr_last))) { lp = get_addressed_line_node(n); if ((s = get_sbuf_line(lp)) == NULL) return ERR; @@ -1343,7 +1343,7 @@ strip_escapes(s) REALLOC(file, filesz, MAXPATHLEN + 1, NULL); /* assert: no trailing escape */ - while (file[i++] = (*s == '\\') ? *++s : *s) + while ((file[i++] = (*s == '\\') ? *++s : *s) != '\0') s++; return file; } diff --git a/bin/ed/re.c b/bin/ed/re.c index 948a05980d9..276094b7d73 100644 --- a/bin/ed/re.c +++ b/bin/ed/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.4 1996/10/12 19:38:40 millert Exp $ */ +/* $OpenBSD: re.c,v 1.5 1996/12/14 12:17:57 mickey Exp $ */ /* $NetBSD: re.c,v 1.14 1995/03/21 09:04:48 cgd Exp $ */ /* re.c: This file contains the regular expression interface routines for @@ -33,7 +33,7 @@ #if 0 static char *rcsid = "@(#)re.c,v 1.6 1994/02/01 00:34:43 alm Exp"; #else -static char rcsid[] = "$OpenBSD: re.c,v 1.4 1996/10/12 19:38:40 millert Exp $"; +static char rcsid[] = "$OpenBSD: re.c,v 1.5 1996/12/14 12:17:57 mickey Exp $"; #endif #endif /* not lint */ @@ -73,7 +73,7 @@ get_compiled_pattern() return NULL; } patlock = 0; - if (n = regcomp(exp, exps, 0)) { + if ((n = regcomp(exp, exps, 0)) != 0) { regerror(n, exp, errmsg, sizeof errmsg); free(exp); return exp = NULL; diff --git a/bin/ed/sub.c b/bin/ed/sub.c index e0fa18d54b9..c66c2258135 100644 --- a/bin/ed/sub.c +++ b/bin/ed/sub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sub.c,v 1.4 1996/10/12 19:38:42 millert Exp $ */ +/* $OpenBSD: sub.c,v 1.5 1996/12/14 12:17:58 mickey Exp $ */ /* $NetBSD: sub.c,v 1.4 1995/03/21 09:04:50 cgd Exp $ */ /* sub.c: This file contains the substitution routines for the ed @@ -33,7 +33,7 @@ #if 0 static char *rcsid = "@(#)sub.c,v 1.1 1994/02/01 00:34:44 alm Exp"; #else -static char rcsid[] = "$OpenBSD: sub.c,v 1.4 1996/10/12 19:38:42 millert Exp $"; +static char rcsid[] = "$OpenBSD: sub.c,v 1.5 1996/12/14 12:17:58 mickey Exp $"; #endif #endif /* not lint */ @@ -103,7 +103,7 @@ extract_subst_template() ; else if (!isglobal) { while ((n = get_tty_line()) == 0 || - n > 0 && ibuf[n - 1] != '\n') + (n > 0 && ibuf[n - 1] != '\n')) clearerr(stdin); if (n < 0) return NULL; @@ -219,7 +219,7 @@ substitute_matching_text(pat, lp, gflag, kth) off += i; } txt += rm[0].rm_eo; - } while (*txt && (!changed || (gflag & GSG) && rm[0].rm_eo) && + } while (*txt && (!changed || ((gflag & GSG) && rm[0].rm_eo)) && !regexec(pat, txt, SE_MAX, rm, REG_NOTBOL)); i = eot - txt; REALLOC(rbuf, rbufsz, off + i + 2, ERR); diff --git a/bin/expr/expr.c b/bin/expr/expr.c index 49b1736ba8e..412887e53f3 100644 --- a/bin/expr/expr.c +++ b/bin/expr/expr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expr.c,v 1.4 1996/09/15 22:27:38 millert Exp $ */ +/* $OpenBSD: expr.c,v 1.5 1996/12/14 12:17:59 mickey Exp $ */ /* $NetBSD: expr.c,v 1.3.6.1 1996/06/04 20:41:47 cgd Exp $ */ /* @@ -213,7 +213,7 @@ nexttoken() return; } -void +__dead void error() { errx(2, "syntax error"); @@ -370,7 +370,7 @@ eval2() { struct val *l, *r; enum token op; - int v, li, ri; + int v = 0, li, ri; l = eval3(); while ((op = token) == EQ || op == NE || op == LT || op == GT || op == LE || op == GE) { @@ -397,6 +397,8 @@ eval2() case NE: v = (li != ri); break; + default: + break; } } else { to_string(l); @@ -421,6 +423,8 @@ eval2() case NE: v = (strcoll(l->u.s, r->u.s) != 0); break; + default: + break; } } diff --git a/bin/ksh/edit.c b/bin/ksh/edit.c index c05109c859d..53c1fcb301a 100644 --- a/bin/ksh/edit.c +++ b/bin/ksh/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.3 1996/10/01 02:05:33 downsj Exp $ */ +/* $OpenBSD: edit.c,v 1.4 1996/12/14 12:18:07 mickey Exp $ */ /* * Command line editing - common code @@ -17,6 +17,7 @@ # include <sys/stream.h> /* needed for <sys/ptem.h> */ # include <sys/ptem.h> /* needed for struct winsize */ #endif /* OS_SCO */ +#include <sys/ioctl.h> #include <ctype.h> #include "ksh_stat.h" diff --git a/bin/ln/ln.c b/bin/ln/ln.c index e941a8359d2..294d9382e5d 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ln.c,v 1.3 1996/08/02 12:40:56 deraadt Exp $ */ +/* $OpenBSD: ln.c,v 1.4 1996/12/14 12:18:01 mickey Exp $ */ /* $NetBSD: ln.c,v 1.10 1995/03/21 09:06:10 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ln.c 8.2 (Berkeley) 3/31/94"; #else -static char rcsid[] = "$OpenBSD: ln.c,v 1.3 1996/08/02 12:40:56 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ln.c,v 1.4 1996/12/14 12:18:01 mickey Exp $"; #endif #endif /* not lint */ @@ -137,7 +137,7 @@ linkit(target, source, isdir) } /* If the source is a directory, append the target's name. */ - if (isdir || !stat(source, &sb) && S_ISDIR(sb.st_mode)) { + if (isdir || (!stat(source, &sb) && S_ISDIR(sb.st_mode))) { if ((p = strrchr(target, '/')) == NULL) p = target; else @@ -150,7 +150,7 @@ linkit(target, source, isdir) * If the file exists, and -f was specified, unlink it. * Attempt the link. */ - if (fflag && unlink(source) < 0 && errno != ENOENT || + if ((fflag && unlink(source) < 0 && errno != ENOENT) || (*linkf)(target, source)) { warn("%s", source); return (1); diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 0f872a9db27..3004687589a 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.4 1996/08/02 12:40:57 deraadt Exp $ */ +/* $OpenBSD: ls.c,v 1.5 1996/12/14 12:18:03 mickey Exp $ */ /* $NetBSD: ls.c,v 1.16 1996/02/14 05:58:53 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94"; #else -static char rcsid[] = "$OpenBSD: ls.c,v 1.4 1996/08/02 12:40:57 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ls.c,v 1.5 1996/12/14 12:18:03 mickey Exp $"; #endif #endif /* not lint */ @@ -393,6 +393,10 @@ display(p, list) int entries, needstats; char *user, *group, *flags, buf[20]; /* 32 bits == 10 digits */ +#ifdef lint + flags = NULL; +#endif + /* * If list is NULL there are two possibilities: that the parent * directory p has no children, or that fts_children() returned an diff --git a/bin/ls/print.c b/bin/ls/print.c index e651821461e..14a0ca8b872 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.3 1996/08/02 11:45:01 deraadt Exp $ */ +/* $OpenBSD: print.c,v 1.4 1996/12/14 12:18:04 mickey Exp $ */ /* $NetBSD: print.c,v 1.14 1995/09/07 06:43:00 jtc Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94"; #else -static char rcsid[] = "$OpenBSD: print.c,v 1.3 1996/08/02 11:45:01 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: print.c,v 1.4 1996/12/14 12:18:04 mickey Exp $"; #endif #endif /* not lint */ @@ -101,7 +101,7 @@ printlong(dp) continue; sp = p->fts_statp; if (f_inode) - (void)printf("%*lu ", dp->s_inode, sp->st_ino); + (void)printf("%*u ", dp->s_inode, sp->st_ino); if (f_size) (void)printf("%*qd ", dp->s_block, howmany(sp->st_blocks, blocksize)); @@ -192,7 +192,7 @@ printcol(dp) dp->s_block); if ((base += numrows) >= num) break; - while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) { + while ((cnt = (chcnt + (TAB & ~(TAB - 1)))) <= endcol) { (void)putchar('\t'); chcnt = cnt; } @@ -217,7 +217,7 @@ printaname(p, inodefield, sizefield) sp = p->fts_statp; chcnt = 0; if (f_inode) - chcnt += printf("%*lu ", (int)inodefield, sp->st_ino); + chcnt += printf("%*u ", (int)inodefield, sp->st_ino); if (f_size) chcnt += printf("%*qd ", (int)sizefield, howmany(sp->st_blocks, blocksize)); diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 8ab946480e3..6155f2957ce 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mv.c,v 1.4 1996/08/02 12:41:00 deraadt Exp $ */ +/* $OpenBSD: mv.c,v 1.5 1996/12/14 12:18:05 mickey Exp $ */ /* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: mv.c,v 1.4 1996/08/02 12:41:00 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mv.c,v 1.5 1996/12/14 12:18:05 mickey Exp $"; #endif #endif /* not lint */ @@ -63,6 +63,8 @@ static char rcsid[] = "$OpenBSD: mv.c,v 1.4 1996/08/02 12:41:00 deraadt Exp $"; #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <pwd.h> +#include <grp.h> #include "pathnames.h" diff --git a/bin/pdksh/edit.c b/bin/pdksh/edit.c index c05109c859d..53c1fcb301a 100644 --- a/bin/pdksh/edit.c +++ b/bin/pdksh/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.3 1996/10/01 02:05:33 downsj Exp $ */ +/* $OpenBSD: edit.c,v 1.4 1996/12/14 12:18:07 mickey Exp $ */ /* * Command line editing - common code @@ -17,6 +17,7 @@ # include <sys/stream.h> /* needed for <sys/ptem.h> */ # include <sys/ptem.h> /* needed for struct winsize */ #endif /* OS_SCO */ +#include <sys/ioctl.h> #include <ctype.h> #include "ksh_stat.h" diff --git a/bin/ps/print.c b/bin/ps/print.c index 807e6bde0a6..a874bf82225 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.2 1996/06/23 14:20:50 deraadt Exp $ */ +/* $OpenBSD: print.c,v 1.3 1996/12/14 12:18:09 mickey Exp $ */ /* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; #else -static char rcsid[] = "$OpenBSD: print.c,v 1.2 1996/06/23 14:20:50 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: print.c,v 1.3 1996/12/14 12:18:09 mickey Exp $"; #endif #endif /* not lint */ @@ -72,6 +72,7 @@ static char rcsid[] = "$OpenBSD: print.c,v 1.2 1996/06/23 14:20:50 deraadt Exp $ #include <string.h> #include <tzfile.h> #include <unistd.h> +#include <pwd.h> #include "ps.h" @@ -131,7 +132,7 @@ command(ki, ve) left = -1; if (needenv) { argv = kvm_getenvv(kd, ki->ki_p, termwidth); - if (p = argv) { + if ((p = argv) != NULL) { while (*p) { fmt_puts(*p, &left); p++; @@ -142,7 +143,7 @@ command(ki, ve) if (needcomm) { if (!commandonly) { argv = kvm_getargv(kd, ki->ki_p, termwidth); - if (p = argv) { + if ((p = argv) != NULL) { while (*p) { fmt_puts(*p, &left); p++; @@ -629,7 +630,7 @@ pagein(k, ve) VAR *v; v = ve->var; - (void)printf("%*d", v->width, + (void)printf("%*ld", v->width, k->ki_u.u_valid ? k->ki_u.u_ru.ru_majflt : 0); } @@ -695,7 +696,7 @@ printval(bp, v) if (v->flag & LJUST) *cp++ = '-'; *cp++ = '*'; - while (*cp++ = *fcp++); + while ((*cp++ = *fcp++)); /* * Note that the "INF127" check is nonsensical for types diff --git a/bin/ps/ps.c b/bin/ps/ps.c index f152acd640b..6e4b70e89b5 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ps.c,v 1.5 1996/08/06 19:33:47 deraadt Exp $ */ +/* $OpenBSD: ps.c,v 1.6 1996/12/14 12:18:10 mickey Exp $ */ /* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: ps.c,v 1.5 1996/08/06 19:33:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ps.c,v 1.6 1996/12/14 12:18:10 mickey Exp $"; #endif #endif /* not lint */ @@ -466,8 +466,8 @@ kludge_oldps_options(s) * if there's a trailing number, and not a preceding 'p' (pid) or * 't' (tty) flag, then assume it's a pid and insert a 'p' flag. */ - if (isdigit(*cp) && (cp == s || cp[-1] != 't' && cp[-1] != 'p' && - (cp - 1 == s || cp[-2] != 't'))) + if (isdigit(*cp) && (cp == s || (cp[-1] != 't' && cp[-1] != 'p' && + (cp - 1 == s || cp[-2] != 't')))) *ns++ = 'p'; (void)strcpy(ns, cp); /* and append the number */ diff --git a/bin/pwd/pwd.c b/bin/pwd/pwd.c index 1faea0d1b38..25caf23be98 100644 --- a/bin/pwd/pwd.c +++ b/bin/pwd/pwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwd.c,v 1.3 1996/08/02 12:41:03 deraadt Exp $ */ +/* $OpenBSD: pwd.c,v 1.4 1996/12/14 12:18:12 mickey Exp $ */ /* $NetBSD: pwd.c,v 1.7 1995/03/21 09:08:18 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)pwd.c 8.3 (Berkeley) 4/1/94"; #else -static char rcsid[] = "$OpenBSD: pwd.c,v 1.3 1996/08/02 12:41:03 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: pwd.c,v 1.4 1996/12/14 12:18:12 mickey Exp $"; #endif #endif /* not lint */ @@ -84,7 +84,7 @@ main(argc, argv) usage(); if ((p = getcwd(NULL, 0)) == NULL) - err(1, NULL); + err(1, "getcwd"); (void)printf("%s\n", p); exit(0); } diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c index 00f991c9458..c2383c34fa2 100644 --- a/bin/rcp/rcp.c +++ b/bin/rcp/rcp.c @@ -1,5 +1,5 @@ /* $NetBSD: rcp.c,v 1.9 1995/03/21 08:19:06 cgd Exp $ */ -/* $OpenBSD: rcp.c,v 1.6 1996/08/02 12:41:04 deraadt Exp $ */ +/* $OpenBSD: rcp.c,v 1.7 1996/12/14 12:18:13 mickey Exp $ */ /* * Copyright (c) 1983, 1990, 1992, 1993 @@ -101,6 +101,10 @@ char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */ #ifdef KERBEROS int kerberos __P((char **, char *, char *, char *)); void oldw __P((const char *, ...)); +/* XXX from ../../usr.bin/rlogin/krcmd.c */ +int krcmd __P((char **, u_short, char *, char *, int *, char *)); +int krcmd_mutual __P((char **, u_short, char *, char *, int *, + char *, CREDENTIALS *, Key_schedule)); #endif int response __P((void)); void rsource __P((char *, struct stat *)); @@ -216,7 +220,7 @@ main(argc, argv) (void)signal(SIGPIPE, lostconn); - if (targ = colon(argv[argc - 1])) /* Dest is remote host. */ + if ((targ = colon(argv[argc - 1]))) /* Dest is remote host. */ toremote(targ, argc, argv); else { tolocal(argc, argv); /* Dest is local host. */ @@ -238,7 +242,7 @@ toremote(targ, argc, argv) if (*targ == 0) targ = "."; - if (thost = strchr(argv[argc - 1], '@')) { + if ((thost = strchr(argv[argc - 1], '@'))) { /* user@host */ *thost++ = 0; tuser = argv[argc - 1]; @@ -499,7 +503,7 @@ rsource(name, statp) closedir(dirp); return; } - while (dp = readdir(dirp)) { + while ((dp = readdir(dirp)) != NULL) { if (dp->d_ino == 0) continue; if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) @@ -529,7 +533,7 @@ sink(argc, argv) BUF *bp; off_t i, j; int amt, count, exists, first, mask, mode, ofd, omode; - int setimes, size, targisdir, wrerrno; + int setimes, size, targisdir, wrerrno = 0; char ch, *cp, *np, *targ, *why, *vect[1], buf[BUFSIZ]; #define atime tv[0] diff --git a/bin/rm/rm.c b/bin/rm/rm.c index efef593945e..20facae1727 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rm.c,v 1.3 1996/08/02 12:41:05 deraadt Exp $ */ +/* $OpenBSD: rm.c,v 1.4 1996/12/14 12:18:15 mickey Exp $ */ /* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)rm.c 8.8 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: rm.c,v 1.3 1996/08/02 12:41:05 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rm.c,v 1.4 1996/12/14 12:18:15 mickey Exp $"; #endif #endif /* not lint */ @@ -60,6 +60,8 @@ static char rcsid[] = "$OpenBSD: rm.c,v 1.3 1996/08/02 12:41:05 deraadt Exp $"; #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <pwd.h> +#include <grp.h> int dflag, eval, fflag, iflag, Pflag, Wflag, stdin_ok; @@ -212,20 +214,22 @@ rm_tree(argv) switch (p->fts_info) { case FTS_DP: case FTS_DNR: - if (!rmdir(p->fts_accpath) || fflag && errno == ENOENT) + if (!rmdir(p->fts_accpath) || + (fflag && errno == ENOENT)) continue; break; case FTS_W: if (!undelete(p->fts_accpath) || - fflag && errno == ENOENT) + (fflag && errno == ENOENT)) continue; break; default: if (Pflag) rm_overwrite(p->fts_accpath, NULL); - if (!unlink(p->fts_accpath) || fflag && errno == ENOENT) + if (!unlink(p->fts_accpath) || + (fflag && errno == ENOENT)) continue; } warn("%s", p->fts_path); @@ -385,7 +389,7 @@ check(path, name, sp) * Since POSIX.2 defines basename as the final portion of a path after * trailing slashes have been removed, we'll remove them here. */ -#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || (a)[1] == '.' && !(a)[2])) +#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2]))) void checkdot(argv) char **argv; diff --git a/bin/rmail/rmail.c b/bin/rmail/rmail.c index 543b98b6c82..570d61e8e0a 100644 --- a/bin/rmail/rmail.c +++ b/bin/rmail/rmail.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rmail.c,v 1.3 1996/08/02 12:41:06 deraadt Exp $ */ +/* $OpenBSD: rmail.c,v 1.4 1996/12/14 12:18:17 mickey Exp $ */ /* $NetBSD: rmail.c,v 1.8 1995/09/07 06:51:50 jtc Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)rmail.c 8.3 (Berkeley) 5/15/95"; #else -static char rcsid[] = "$OpenBSD: rmail.c,v 1.3 1996/08/02 12:41:06 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rmail.c,v 1.4 1996/12/14 12:18:17 mickey Exp $"; #endif #endif /* not lint */ @@ -108,6 +108,11 @@ main(argc, argv) char *from_path, *from_sys, *from_user; char *args[100], buf[2048], lbuf[2048]; +#ifdef lint + fplen = fptlen = 0; + addrp = NULL; +#endif + debug = 0; domain = "UUCP"; /* Default "domain". */ while ((ch = getopt(argc, argv, "D:T")) != EOF) diff --git a/bin/sh/arith.y b/bin/sh/arith.y index a5e832d1f48..a3ba441230b 100644 --- a/bin/sh/arith.y +++ b/bin/sh/arith.y @@ -1,4 +1,4 @@ -/* $OpenBSD: arith.y,v 1.2 1996/06/23 14:21:08 deraadt Exp $ */ +/* $OpenBSD: arith.y,v 1.3 1996/12/14 12:18:19 mickey Exp $ */ %token ARITH_NUM ARITH_LPAREN ARITH_RPAREN %left ARITH_OR @@ -96,7 +96,7 @@ expr: ARITH_LPAREN expr ARITH_RPAREN = { $$ = $2; } #if 0 static char sccsid[] = "@(#)arith.y 8.3 (Berkeley) 5/4/95"; #else -static char sccsid[] = "$OpenBSD: arith.y,v 1.2 1996/06/23 14:21:08 deraadt Exp $"; +static char sccsid[] = "$OpenBSD: arith.y,v 1.3 1996/12/14 12:18:19 mickey Exp $"; #endif #endif /* not lint */ @@ -107,6 +107,9 @@ static char sccsid[] = "$OpenBSD: arith.y,v 1.2 1996/06/23 14:21:08 deraadt Exp char *arith_buf, *arith_startbuf; +int yyparse __P((void)); +int yylex __P((void)); + int arith(s) char *s; diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index 8b483e92e3c..f5efe2e9db5 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: miscbltin.c,v 1.2 1996/06/23 14:21:22 deraadt Exp $ */ +/* $OpenBSD: miscbltin.c,v 1.3 1996/12/14 12:18:20 mickey Exp $ */ /* $NetBSD: miscbltin.c,v 1.15 1995/06/12 19:44:16 jtc Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: miscbltin.c,v 1.2 1996/06/23 14:21:22 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: miscbltin.c,v 1.3 1996/12/14 12:18:20 mickey Exp $"; #endif #endif /* not lint */ @@ -295,7 +295,7 @@ ulimitcmd(argc, argv) char **argv; { register int c; - rlim_t val; + rlim_t val = 0; enum { SOFT = 0x1, HARD = 0x2 } how = SOFT | HARD; const struct limits *l; diff --git a/bin/sh/options.c b/bin/sh/options.c index 1d54c05451b..3f109a3f1b1 100644 --- a/bin/sh/options.c +++ b/bin/sh/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.6 1996/11/24 23:18:44 millert Exp $ */ +/* $OpenBSD: options.c,v 1.7 1996/12/14 12:18:21 mickey Exp $ */ /* $NetBSD: options.c,v 1.19 1996/11/06 01:17:11 christos Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: options.c,v 1.6 1996/11/24 23:18:44 millert Exp $"; +static char rcsid[] = "$OpenBSD: options.c,v 1.7 1996/12/14 12:18:21 mickey Exp $"; #endif #endif /* not lint */ @@ -381,12 +381,10 @@ getoptscmd(argc, argv) int argc; char **argv; { - char **optbase; + char **optbase = shellparam.p; if (argc < 3) error("Usage: getopts optstring var [arg]"); - else if (argc == 3) - optbase = shellparam.p; else optbase = &argv[3]; diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 5205429be43..04eabad0f17 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.6 1996/12/01 05:09:51 millert Exp $ */ +/* $OpenBSD: parser.c,v 1.7 1996/12/14 12:18:23 mickey Exp $ */ /* $NetBSD: parser.c,v 1.31 1996/11/25 20:22:00 christos Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95"; #else -static char rcsid[] = "$OpenBSD: parser.c,v 1.6 1996/12/01 05:09:51 millert Exp $"; +static char rcsid[] = "$OpenBSD: parser.c,v 1.7 1996/12/14 12:18:23 mickey Exp $"; #endif #endif /* not lint */ @@ -1258,7 +1258,9 @@ parsebackq: { struct jmploc *volatile savehandler; int savelen; int saveprompt; - +#ifdef lint + saveprompt = 0; +#endif savepbq = parsebackquote; if (setjmp(jmploc.loc)) { if (str) diff --git a/bin/sh/redir.c b/bin/sh/redir.c index 1bad4d0246c..e2659ba25ab 100644 --- a/bin/sh/redir.c +++ b/bin/sh/redir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: redir.c,v 1.3 1996/10/20 00:55:03 millert Exp $ */ +/* $OpenBSD: redir.c,v 1.4 1996/12/14 12:18:24 mickey Exp $ */ /* $NetBSD: redir.c,v 1.12 1995/05/11 21:30:10 christos Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)redir.c 8.2 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: redir.c,v 1.3 1996/10/20 00:55:03 millert Exp $"; +static char rcsid[] = "$OpenBSD: redir.c,v 1.4 1996/12/14 12:18:24 mickey Exp $"; #endif #endif /* not lint */ @@ -108,8 +108,10 @@ redirect(redir, flags) struct redirtab *sv; int i; int fd; - char memory[10]; /* file descriptors to write to memory */ - + char memory[10]; /* file descriptors to write to memory */ +#ifdef lint + sv = NULL; +#endif for (i = 10 ; --i >= 0 ; ) memory[i] = 0; memory[1] = flags & REDIR_BACKQ; diff --git a/bin/sh/var.c b/bin/sh/var.c index 1f020ccccf2..5b350c6d445 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.3 1996/10/20 00:55:08 millert Exp $ */ +/* $OpenBSD: var.c,v 1.4 1996/12/14 12:18:25 mickey Exp $ */ /* $NetBSD: var.c,v 1.13 1995/05/11 21:30:39 christos Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: var.c,v 1.3 1996/10/20 00:55:08 millert Exp $"; +static char rcsid[] = "$OpenBSD: var.c,v 1.4 1996/12/14 12:18:25 mickey Exp $"; #endif #endif /* not lint */ @@ -201,11 +201,12 @@ setvarsafe(name, val, flags) { struct jmploc jmploc; struct jmploc *volatile savehandler = handler; - int err = 0; + int err; if (setjmp(jmploc.loc)) err = 1; else { + err = 0; handler = &jmploc; setvar(name, val, flags); } diff --git a/bin/test/test.c b/bin/test/test.c index 4014964d5b7..e09631af08c 100644 --- a/bin/test/test.c +++ b/bin/test/test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: test.c,v 1.2 1996/06/23 14:21:58 deraadt Exp $ */ +/* $OpenBSD: test.c,v 1.3 1996/12/14 12:18:27 mickey Exp $ */ /* $NetBSD: test.c,v 1.15 1995/03/21 07:04:06 cgd Exp $ */ /* @@ -12,7 +12,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: test.c,v 1.2 1996/06/23 14:21:58 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: test.c,v 1.3 1996/12/14 12:18:27 mickey Exp $"; #endif #include <sys/types.h> @@ -208,7 +208,7 @@ main(argc, argv) return res; } -static void +static __dead void syntax(op, msg) char *op; char *msg; |