X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/b1098fedcb27f9133115fb92ae0df6b42ed61a24..c2714ef59c9198e2c0d7aaf2cb07b9daddbf4490:/usr.bin/wc/wc.c diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c index 91c8b90637..2480b48a1a 100644 --- a/usr.bin/wc/wc.c +++ b/usr.bin/wc/wc.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)wc.c 5.7 (Berkeley) 3/2/91";*/ -static char rcsid[] = "$Id: wc.c,v 1.8 1993/11/04 05:43:30 jtc Exp $"; +static char rcsid[] = "$Id: wc.c,v 1.3 1994/02/25 22:24:42 phk Exp $"; #endif /* not lint */ /* wc line, word and char count */ @@ -179,6 +179,14 @@ cnt(file) if (ifmt == S_IFREG || ifmt == S_IFLNK || ifmt == S_IFDIR) { charct = sbuf.st_size; + } else { + while((len = read(fd, buf, MAXBSIZE)) > 0) { + charct += len; + } + if (len == -1) { + warn ("%s", file); + rval = 1; + } } } }