svn commit: trunk/busybox/coreutils

vda at busybox.net vda at busybox.net
Fri Sep 29 23:41:59 UTC 2006


Author: vda
Date: 2006-09-29 16:41:59 -0700 (Fri, 29 Sep 2006)
New Revision: 16267

Log:
wc: optionally support very large files in wc


Modified:
   trunk/busybox/coreutils/Config.in
   trunk/busybox/coreutils/wc.c


Changeset:
Modified: trunk/busybox/coreutils/Config.in
===================================================================
--- trunk/busybox/coreutils/Config.in	2006-09-29 23:41:04 UTC (rev 16266)
+++ trunk/busybox/coreutils/Config.in	2006-09-29 23:41:59 UTC (rev 16267)
@@ -704,6 +704,13 @@
 	  wc is used to print the number of bytes, words, and lines,
 	  in specified files.
 
+config CONFIG_FEATURE_WC_LARGE
+	bool "Support very large files in wc"
+	default n
+	depends on CONFIG_WC
+	help
+	  Use "unsigned long long" in wc for count variables
+
 config CONFIG_WHO
 	bool "who"
 	default n

Modified: trunk/busybox/coreutils/wc.c
===================================================================
--- trunk/busybox/coreutils/wc.c	2006-09-29 23:41:04 UTC (rev 16266)
+++ trunk/busybox/coreutils/wc.c	2006-09-29 23:41:59 UTC (rev 16267)
@@ -55,10 +55,13 @@
 #define isspace_given_isprint(c) ((c) == ' ')
 #endif
 
-//#define COUNT_T unsigned long long
-//#define COUNT_FMT "llu"
+#if ENABLE_FEATURE_WC_LARGE
+#define COUNT_T unsigned long long
+#define COUNT_FMT "llu"
+#else
 #define COUNT_T unsigned
 #define COUNT_FMT "u"
+#endif
 
 enum {
 	WC_LINES	= 0,
@@ -82,7 +85,7 @@
 	int c;
 	char status = EXIT_SUCCESS;
 	char in_word;
-	char print_type;
+	unsigned print_type;
 
 	print_type = bb_getopt_ulflags(argc, argv, "lwcL");
 
@@ -115,6 +118,8 @@
 		in_word = 0;
 
 		do {
+			/* Our -w doesn't match GNU wc exactly... oh well */
+
 			++counts[WC_CHARS];
 			c = getc(fp);
 			if (isprint(c)) {




More information about the busybox-cvs mailing list