mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 00:31:16 +00:00
wc: optionally support very large files in wc
This commit is contained in:
parent
3ed001ff26
commit
70210168fc
@ -704,6 +704,13 @@ config CONFIG_WC
|
|||||||
wc is used to print the number of bytes, words, and lines,
|
wc is used to print the number of bytes, words, and lines,
|
||||||
in specified files.
|
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
|
config CONFIG_WHO
|
||||||
bool "who"
|
bool "who"
|
||||||
default n
|
default n
|
||||||
|
@ -55,10 +55,13 @@
|
|||||||
#define isspace_given_isprint(c) ((c) == ' ')
|
#define isspace_given_isprint(c) ((c) == ' ')
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define COUNT_T unsigned long long
|
#if ENABLE_FEATURE_WC_LARGE
|
||||||
//#define COUNT_FMT "llu"
|
#define COUNT_T unsigned long long
|
||||||
|
#define COUNT_FMT "llu"
|
||||||
|
#else
|
||||||
#define COUNT_T unsigned
|
#define COUNT_T unsigned
|
||||||
#define COUNT_FMT "u"
|
#define COUNT_FMT "u"
|
||||||
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
WC_LINES = 0,
|
WC_LINES = 0,
|
||||||
@ -82,7 +85,7 @@ int wc_main(int argc, char **argv)
|
|||||||
int c;
|
int c;
|
||||||
char status = EXIT_SUCCESS;
|
char status = EXIT_SUCCESS;
|
||||||
char in_word;
|
char in_word;
|
||||||
char print_type;
|
unsigned print_type;
|
||||||
|
|
||||||
print_type = bb_getopt_ulflags(argc, argv, "lwcL");
|
print_type = bb_getopt_ulflags(argc, argv, "lwcL");
|
||||||
|
|
||||||
@ -115,6 +118,8 @@ int wc_main(int argc, char **argv)
|
|||||||
in_word = 0;
|
in_word = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
/* Our -w doesn't match GNU wc exactly... oh well */
|
||||||
|
|
||||||
++counts[WC_CHARS];
|
++counts[WC_CHARS];
|
||||||
c = getc(fp);
|
c = getc(fp);
|
||||||
if (isprint(c)) {
|
if (isprint(c)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user