Is this ok, POSIX?

This commit is contained in:
qorg11 2020-08-24 02:31:35 +02:00
parent 98f9bd9e15
commit 571b6c73e0
No known key found for this signature in database
GPG Key ID: 343FC20A4ACA62B9
1 changed files with 6 additions and 3 deletions

View File

@ -79,9 +79,9 @@ main(int argc, char *argv[])
show_words = 0; show_words = 0;
break; break;
case 'c': case 'c':
case 'm': case 'm':
show_bytes = 0; show_bytes = 0;
break; break;
} }
} }
@ -93,7 +93,10 @@ main(int argc, char *argv[])
} }
else for(int i = optind; i<argc; i++) 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(); print_values();
} }
return 0; return 0;