summaryrefslogtreecommitdiff
path: root/src/wc.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-01-01 22:42:36 +0000
committerJim Meyering <jim@meyering.net>1999-01-01 22:42:36 +0000
commitf3ade72018002a21c32618af5300d9682f9d698a (patch)
treee02753dfd5a4e8c851d0732bdfc561ecd0a13065 /src/wc.c
parent59998135d08d667353977036c6d532d88373f767 (diff)
downloadcoreutils-f3ade72018002a21c32618af5300d9682f9d698a.tar.xz
(wc): Use binary mode for input.
Diffstat (limited to 'src/wc.c')
-rw-r--r--src/wc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wc.c b/src/wc.c
index 3590bf54a..9571fd9da 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -1,5 +1,5 @@
/* wc - print the number of bytes, words, and lines in files
- Copyright (C) 85, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 85, 91, 1995-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -143,6 +143,9 @@ wc (int fd, const char *file)
lines = words = chars = linelength = 0;
+ /* We need binary input, since `wc' relies on `lseek' and byte counts. */
+ SET_BINARY (fd);
+
/* When counting only bytes, save some line- and word-counting
overhead. If FD is a `regular' Unix file, using lseek is enough
to get its `size' in bytes. Otherwise, read blocks of BUFFER_SIZE