diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2001-11-21 09:58:29 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2001-11-21 09:58:29 +0000 |
commit | 1477ad8e8319a3ef4623b699083295a0fd560adf (patch) | |
tree | 925f31ac295f91cb6471afdc17a7f6afdad9c7cc | |
parent | 02d090d3d2623047009a17d47bf09df83285a75e (diff) | |
download | busybox-1477ad8e8319a3ef4623b699083295a0fd560adf.tar.gz |
Simplify print function, prints an extra space if no filename, but saves 4 bytes
-rw-r--r-- | coreutils/wc.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/coreutils/wc.c b/coreutils/wc.c index 03dd3c3af..728d725a3 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c @@ -39,24 +39,21 @@ enum print_e { static void print_counts(int lines, int words, int chars, int length, const char *name) { - char const *space = ""; - if (print_type & print_lines) { - printf("%7d", lines); - space = " "; + printf("%7d ", lines); } if (print_type & print_words) { - printf("%s%7d", space, words); - space = " "; + printf("%7d ", words); } if (print_type & print_chars) { - printf("%s%7d", space, chars); - space = " "; + printf("%7d ", chars); + } + if (print_type & print_length) { + printf("%7d ", length); + } + if (*name) { + printf("%s", name); } - if (print_type & print_length) - printf("%s%7d", space, length); - if (*name) - printf(" %s", name); putchar('\n'); } @@ -142,7 +139,7 @@ int wc_main(int argc, char **argv) } if (argv[optind] == NULL || strcmp(argv[optind], "-") == 0) { - wc_file(stdin, ""); + wc_file(stdin, NULL); return EXIT_SUCCESS; } else { while (optind < argc) { |