]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(wc): Use binary mode for input.
authorJim Meyering <jim@meyering.net>
Fri, 1 Jan 1999 22:42:36 +0000 (22:42 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 1 Jan 1999 22:42:36 +0000 (22:42 +0000)
src/wc.c

index 3590bf54ae1c17bbd9cf080f55cc67b6a27b14b3..9571fd9da0d8e23c4ed5656b07b2fce20b02c876 100644 (file)
--- 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