aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqorg11 <qorg@vxempire.xyz>2020-12-05 15:26:36 +0100
committerqorg11 <qorg@vxempire.xyz>2020-12-05 15:26:36 +0100
commite4192c61551919801d710567ae1cfd0685250f3c (patch)
treeb3fa51b3427026c05a01714801bf6955a0bc5c49
parentdc61ade11352c8d73a7f810bca35d34e64281d6f (diff)
downloadk9core-e4192c61551919801d710567ae1cfd0685250f3c.tar.gz
k9core-e4192c61551919801d710567ae1cfd0685250f3c.zip
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
-rw-r--r--src/wc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/wc.c b/src/wc.c
index b9b48d6..397da12 100644
--- 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"));