diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-11-16 06:09:13 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-11-16 06:09:13 +0000 |
commit | f0f016d8b74560415f91ee1d0b32935db8468c2b (patch) | |
tree | bb7b30f66c139df0e97fb0d11b8d6e63c6a43fd7 | |
parent | 92aade5b60df891377a0234b254faa6ebdbca104 (diff) |
more -Wall
-rw-r--r-- | usr.bin/join/join.c | 11 | ||||
-rw-r--r-- | usr.bin/paste/paste.c | 25 |
2 files changed, 24 insertions, 12 deletions
diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c index 7e467e1dc78..9e32a834bab 100644 --- a/usr.bin/join/join.c +++ b/usr.bin/join/join.c @@ -1,4 +1,4 @@ -/* $Id: join.c,v 1.10 1997/08/25 05:31:10 deraadt Exp $ +/* $Id: join.c,v 1.11 1998/11/16 06:09:12 deraadt Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -45,7 +45,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "@(#)join.c 8.6 (Berkeley) 5/4/95"; */ -static char rcsid[] = "$Id: join.c,v 1.10 1997/08/25 05:31:10 deraadt Exp $"; +static char rcsid[] = "$Id: join.c,v 1.11 1998/11/16 06:09:12 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -471,13 +471,13 @@ outtwoline(F1, lp1, F2, lp2) int cnt; /* Output a pair of lines according to the join list (if any). */ - if (olist) + if (olist) { for (cnt = 0; cnt < olistcnt; ++cnt) if (olist[cnt].filenum == 1) outfield(lp1, olist[cnt].fieldno, 0); else /* if (olist[cnt].filenum == 2) */ outfield(lp2, olist[cnt].fieldno, 0); - else { + } else { /* * Output the join field, then the remaining fields from F1 * and F2. @@ -504,7 +504,7 @@ outfield(lp, fieldno, out_empty) { if (needsep++) putchar((int)*tabchar); - if (!ferror(stdout)) + if (!ferror(stdout)) { if (lp->fieldcnt < fieldno || out_empty) { if (empty != NULL) fputs(empty, stdout); @@ -513,6 +513,7 @@ outfield(lp, fieldno, out_empty) return; fputs(lp->fields[fieldno], stdout); } + } if (ferror(stdout)) err(1, "stdout"); } diff --git a/usr.bin/paste/paste.c b/usr.bin/paste/paste.c index a63f6159c35..96fc92e8fd7 100644 --- a/usr.bin/paste/paste.c +++ b/usr.bin/paste/paste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paste.c,v 1.4 1997/01/17 07:13:02 millert Exp $ */ +/* $OpenBSD: paste.c,v 1.5 1998/11/16 06:09:12 deraadt Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -44,10 +44,11 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)paste.c 5.7 (Berkeley) 10/30/90";*/ -static char rcsid[] = "$OpenBSD: paste.c,v 1.4 1997/01/17 07:13:02 millert Exp $"; +static char rcsid[] = "$OpenBSD: paste.c,v 1.5 1998/11/16 06:09:12 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> +#include <unistd.h> #include <errno.h> #include <limits.h> #include <stdio.h> @@ -56,6 +57,12 @@ static char rcsid[] = "$OpenBSD: paste.c,v 1.4 1997/01/17 07:13:02 millert Exp $ char *delim; int delimcnt; +int tr __P((char *)); +void usage __P((void)); +void parallel __P((char **)); +void sequential __P((char **)); + +int main(argc, argv) int argc; char **argv; @@ -99,6 +106,7 @@ typedef struct _list { char *name; } LIST; +void parallel(argv) char **argv; { @@ -109,7 +117,7 @@ parallel(argv) int opencnt, output; char buf[_POSIX2_LINE_MAX + 1], *malloc(); - for (cnt = 0, head = NULL; p = *argv; ++argv, ++cnt) { + for (cnt = 0, head = NULL; (p = *argv); ++argv, ++cnt) { if (!(lp = (LIST *)malloc((u_int)sizeof(LIST)))) { (void)fprintf(stderr, "paste: %s.\n", strerror(ENOMEM)); exit(1); @@ -163,9 +171,9 @@ parallel(argv) if (!output) { output = 1; for (cnt = 0; cnt < lp->cnt; ++cnt) - if (ch = delim[cnt % delimcnt]) + if ((ch = delim[cnt % delimcnt])) putchar(ch); - } else if (ch = delim[(lp->cnt - 1) % delimcnt]) + } else if ((ch = delim[(lp->cnt - 1) % delimcnt])) putchar(ch); (void)printf("%s", buf); } @@ -174,6 +182,7 @@ parallel(argv) } } +void sequential(argv) char **argv; { @@ -182,7 +191,7 @@ sequential(argv) register char ch, *p, *dp; char buf[_POSIX2_LINE_MAX + 1]; - for (; p = *argv; ++argv) { + for (; (p = *argv); ++argv) { if (p[0] == '-' && !p[1]) fp = stdin; else if (!(fp = fopen(p, "r"))) { @@ -202,7 +211,7 @@ sequential(argv) (void)printf("%s", buf); if (!fgets(buf, sizeof(buf), fp)) break; - if (ch = *dp++) + if ((ch = *dp++)) putchar(ch); if (++cnt == delimcnt) { dp = delim; @@ -216,6 +225,7 @@ sequential(argv) } } +int tr(arg) char *arg; { @@ -247,6 +257,7 @@ tr(arg) return(cnt); } +void usage() { (void)fprintf(stderr, "paste: [-s] [-d delimiters] file ...\n"); |