commit 571b6c73e02c889cdae599724ee73a082f2d384d
parent 98f9bd9e154f4faaa9cefa6b1b8d792e798b4145
Author: qorg11 <qorg@vxempire.xyz>
Date: Mon, 24 Aug 2020 02:31:35 +0200
Is this ok, POSIX?
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git 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;