aboutsummaryrefslogtreecommitdiff
path: root/coreutils/wc.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-29 23:41:59 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-29 23:41:59 +0000
commit70210168fcb1fb9bdbcd6fe92509cd9b1ef46eb9 (patch)
tree6a277dce1252ee2625563c718fdc60b4c3a5a91f /coreutils/wc.c
parent3ed001ff2631ad6911096148f47a2719a5b6d4f4 (diff)
downloadbusybox-w32-70210168fcb1fb9bdbcd6fe92509cd9b1ef46eb9.tar.gz
busybox-w32-70210168fcb1fb9bdbcd6fe92509cd9b1ef46eb9.tar.bz2
busybox-w32-70210168fcb1fb9bdbcd6fe92509cd9b1ef46eb9.zip
wc: optionally support very large files in wc
Diffstat (limited to 'coreutils/wc.c')
-rw-r--r--coreutils/wc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/coreutils/wc.c b/coreutils/wc.c
index 78a5105da..6ddac4dec 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -55,10 +55,13 @@
55#define isspace_given_isprint(c) ((c) == ' ') 55#define isspace_given_isprint(c) ((c) == ' ')
56#endif 56#endif
57 57
58//#define COUNT_T unsigned long long 58#if ENABLE_FEATURE_WC_LARGE
59//#define COUNT_FMT "llu" 59#define COUNT_T unsigned long long
60#define COUNT_FMT "llu"
61#else
60#define COUNT_T unsigned 62#define COUNT_T unsigned
61#define COUNT_FMT "u" 63#define COUNT_FMT "u"
64#endif
62 65
63enum { 66enum {
64 WC_LINES = 0, 67 WC_LINES = 0,
@@ -82,7 +85,7 @@ int wc_main(int argc, char **argv)
82 int c; 85 int c;
83 char status = EXIT_SUCCESS; 86 char status = EXIT_SUCCESS;
84 char in_word; 87 char in_word;
85 char print_type; 88 unsigned print_type;
86 89
87 print_type = bb_getopt_ulflags(argc, argv, "lwcL"); 90 print_type = bb_getopt_ulflags(argc, argv, "lwcL");
88 91
@@ -115,6 +118,8 @@ int wc_main(int argc, char **argv)
115 in_word = 0; 118 in_word = 0;
116 119
117 do { 120 do {
121 /* Our -w doesn't match GNU wc exactly... oh well */
122
118 ++counts[WC_CHARS]; 123 ++counts[WC_CHARS];
119 c = getc(fp); 124 c = getc(fp);
120 if (isprint(c)) { 125 if (isprint(c)) {