commit e4192c61551919801d710567ae1cfd0685250f3c
parent dc61ade11352c8d73a7f810bca35d34e64281d6f
Author: qorg11 <qorg@vxempire.xyz>
Date: Sat, 5 Dec 2020 15:26:36 +0100
don't take - as stdin if it is a flag (solves musl getopt() bullshit)
gnu, please add to your FUCKING MANPAGE THAT RESORTING argv IS A
FUCKING EXTENSION OF YOUR SHIT, GODDAMN
jk, love you GNU, but please, i don't use man 3p that often
t. spurdo
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/wc.c b/src/wc.c
@@ -18,8 +18,7 @@ wc(FILE *file)
{
if(file == NULL)
{
- fprintf(stderr,"error\n");
- exit(1);
+ fprintf(stderr,"error opening file\n");
}
struct wc_values foobar;
char c;
@@ -92,7 +91,7 @@ main(int argc, char *argv[])
}
else for(int i = optind; i<argc; i++)
{
- if(argv[i][0] == '-')
+ if(argv[i][0] == '-' && argv[i][1] == '\0')
data = wc(stdin);
else
data = wc(fopen(argv[i],"r"));