diff options
author | imp <imp@FreeBSD.org> | 1998-09-11 05:48:06 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1998-09-11 05:48:06 +0000 |
commit | 484b9ba5881ec721979dd06376c6f1a7e42e744b (patch) | |
tree | 6ee7291fd1d84ddb049f085ee4c34e84bb1b3381 /bin/cat/cat.c | |
parent | d904438e7bbdfb41e35287581356b474b5adf158 (diff) | |
download | FreeBSD-src-484b9ba5881ec721979dd06376c6f1a7e42e744b.zip FreeBSD-src-484b9ba5881ec721979dd06376c6f1a7e42e744b.tar.gz |
Silence -Wall -W -Wkitchen-sink. Use ssize_t in preference to int,
make a char * const that should have been. Use new style function
declaration for main. Mostly a Bruce Filter[tm] test commit.
Diffstat (limited to 'bin/cat/cat.c')
-rw-r--r-- | bin/cat/cat.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c index 81f611f..c52ae8b 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -45,7 +45,7 @@ static char const copyright[] = static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95"; #endif static const char rcsid[] = - "$Id: cat.c,v 1.10 1998/05/06 06:49:16 charnier Exp $"; + "$Id: cat.c,v 1.11 1998/05/13 07:16:37 charnier Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -61,7 +61,7 @@ static const char rcsid[] = int bflag, eflag, nflag, sflag, tflag, vflag; int rval; -char *filename; +const char *filename; void cook_args __P((char *argv[])); void cook_buf __P((FILE *)); @@ -69,11 +69,8 @@ void raw_args __P((char *argv[])); void raw_cat __P((int)); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char **argv) { - extern int optind; int ch; setlocale(LC_CTYPE, ""); @@ -237,8 +234,9 @@ void raw_cat(rfd) register int rfd; { - register int nr, nw, off, wfd; - static int bsize; + register int off, wfd; + ssize_t nr, nw; + static size_t bsize; static char *buf; struct stat sbuf; @@ -252,7 +250,7 @@ raw_cat(rfd) } while ((nr = read(rfd, buf, bsize)) > 0) for (off = 0; nr; nr -= nw, off += nw) - if ((nw = write(wfd, buf + off, nr)) < 0) + if ((nw = write(wfd, buf + off, (size_t) nr)) < 0) err(1, "stdout"); if (nr < 0) { warn("%s", filename); |