commit: 730f35fe541fa7537fdd4cf73405d65e763b6ad1
parent c0981071dddab9ab3aee51815f2045e191a8355e
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 5 May 2024 02:44:42 +0200
cmd/wc: Print correct total when only -c is passed
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/cmd/wc.c b/cmd/wc.c
@@ -239,6 +239,7 @@ main(int argc, char *argv[])
}
printf("%ld %s\n", status.st_size, path);
+ total_bytes += status.st_size;
continue;
}
diff --git a/test-cmd/wc.t b/test-cmd/wc.t
@@ -81,7 +81,14 @@ Total when multiple files are specified
0 0 0 empty
1 2 8 total
- $ rm foobar
- $ rm empty
+ $ printf 'foot bart\n' > footbart
+ $ wc -c foobar footbart empty
+ 8 foobar
+ 10 footbart
+ 0 empty
+ 18 total
+
+ $ rm foobar footbart empty
+
$ find .
.