aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerass El Hafidi <vitali64pmemail@protonmail.com>2023-04-10 19:48:30 +0200
committerFerass El Hafidi <vitali64pmemail@protonmail.com>2023-04-10 19:48:30 +0200
commitdca72f124dc3eaf9d8982ad0c1677c0123cb7ef2 (patch)
treec7001141e3aedb006c2548b910ef38499441fd8e
parent76f38c2977e21e2c786d22e67ef7e9b7f938acaf (diff)
downloadfases-dca72f124dc3eaf9d8982ad0c1677c0123cb7ef2.tar.gz
fases-dca72f124dc3eaf9d8982ad0c1677c0123cb7ef2.zip
core/wc: rewind(file) won't work with stdin
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
-rw-r--r--core/wc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/wc.c b/core/wc.c
index 2c1f7b4..d975231 100644
--- a/core/wc.c
+++ b/core/wc.c
@@ -46,7 +46,7 @@ int main(int argc, char *const argv[]) {
while ((length = getline(&line, &len_getd, file)) != -1) {
if (param['l']) newlines++;
if (param['c'] || param['m']) bytes += length;
- } rewind(file);
+ } rewind(file); /* XXX: Won't work with standard input */
if (errno) return errprint(argv0, argv[i], errno);
if (param['w']) while ((length = getdelim(&line, &len_getd, (int)' ', file)) != -1) {
words++;