aboutsummaryrefslogtreecommitdiff
path: root/coreutils/wc.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-12-20 21:11:59 +0000
committerMatt Kraai <kraai@debian.org>2001-12-20 21:11:59 +0000
commit38c15becf659ca4860ccb280da13a6bc8d4e3de0 (patch)
treebded2b469ab9008b69ba87ab54d58e4c19b9a822 /coreutils/wc.c
parent5a841adf5d359679be47645e730e5333caf929b9 (diff)
downloadbusybox-w32-38c15becf659ca4860ccb280da13a6bc8d4e3de0.tar.gz
busybox-w32-38c15becf659ca4860ccb280da13a6bc8d4e3de0.tar.bz2
busybox-w32-38c15becf659ca4860ccb280da13a6bc8d4e3de0.zip
Avoid printing a trailing blank character.
Diffstat (limited to 'coreutils/wc.c')
-rw-r--r--coreutils/wc.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/coreutils/wc.c b/coreutils/wc.c
index fb81c0a8f..8e3b5bbf4 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -42,20 +42,29 @@ static char print_type = 0;
42static void print_counts(const unsigned int lines, const unsigned int words, 42static void print_counts(const unsigned int lines, const unsigned int words,
43 const unsigned int chars, const unsigned int length, const char *name) 43 const unsigned int chars, const unsigned int length, const char *name)
44{ 44{
45 int output = 0;
46
45 if (print_type & print_lines) { 47 if (print_type & print_lines) {
46 printf("%7d ", lines); 48 printf("%7d", lines);
49 output++;
47 } 50 }
48 if (print_type & print_words) { 51 if (print_type & print_words) {
49 printf("%7d ", words); 52 if (output++)
53 putchar(' ');
54 printf("%7d", words);
50 } 55 }
51 if (print_type & print_chars) { 56 if (print_type & print_chars) {
52 printf("%7d ", chars); 57 if (output++)
58 putchar(' ');
59 printf("%7d", chars);
53 } 60 }
54 if (print_type & print_length) { 61 if (print_type & print_length) {
55 printf("%7d ", length); 62 if (output++)
63 putchar(' ');
64 printf("%7d", length);
56 } 65 }
57 if (*name) { 66 if (*name) {
58 printf("%s", name); 67 printf(" %s", name);
59 } 68 }
60 putchar('\n'); 69 putchar('\n');
61} 70}