← Commit list

70210168f

Denis Vlasenko
Denis Vlasenko
2006-09-29
SOURCE BUG Duration: 39s

Subject

wc: optionally support very large files in wc

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/Config.in+7 -0
@@ -704,6 +704,13 @@ config CONFIG_WC
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
coreutils/wc.c+8 -3
@@ -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 wc_main(int argc, char **argv)
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 @@ int wc_main(int argc, char **argv)
in_word = 0;
do {
+ /* Our -w doesn't match GNU wc exactly... oh well */
+
++counts[WC_CHARS];
c = getc(fp);
if (isprint(c)) {