aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqorg11 <qorg@vxempire.xyz>2020-08-24 02:31:35 +0200
committerqorg11 <qorg@vxempire.xyz>2020-08-24 02:31:35 +0200
commit571b6c73e02c889cdae599724ee73a082f2d384d (patch)
treeec89a8cd603b47e420f8ec184a21fe07edf53e4e
parent98f9bd9e154f4faaa9cefa6b1b8d792e798b4145 (diff)
downloadk9core-571b6c73e02c889cdae599724ee73a082f2d384d.tar.gz
k9core-571b6c73e02c889cdae599724ee73a082f2d384d.zip
Is this ok, POSIX?
-rw-r--r--src/wc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wc.c b/src/wc.c
index 58def69..355e740 100644
--- a/src/wc.c
+++ b/src/wc.c
@@ -79,9 +79,9 @@ main(int argc, char *argv[])
show_words = 0;
break;
case 'c':
- case 'm':
+ case 'm':
show_bytes = 0;
- break;
+ break;
}
}
@@ -93,7 +93,10 @@ main(int argc, char *argv[])
}
else for(int i = optind; i<argc; i++)
{
- data = wc(fopen(argv[i],"r"));
+ if(argv[i][0] == '-')
+ data = wc(stdin);
+ else
+ data = wc(fopen(argv[i],"r"));
print_values();
}
return 0;