commit: 104244c9d81efd49e8445283eb4f0782eddb6ad9
parent 4a4e526bd4c551b145f564292902446bb73a4c76
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 .
.