It now should print even without files specified

This commit is contained in:
Gitea 2020-12-11 07:28:29 -06:00
parent f510192587
commit 0ed15dd266

9
tee.c
View file

@ -33,11 +33,6 @@ int main(int argc, char * argv[]) {
start_arg++;
}
if(start_arg >= argc) {
fprintf(stderr, "%s: no file operands provided\n", argv[0]);
return 1;
}
FILE * files[27] = { 0 };
char * mode = append_mode == 1 ? "a+" : "w+";
@ -47,7 +42,7 @@ int main(int argc, char * argv[]) {
files[j++] = fopen(argv[i], mode);
if(files == NULL) {
fprintf(stderr, "%s: could not open/create file %s\n", argv[0], argv[i]);
return 2;
return 1;
}
}
@ -67,5 +62,5 @@ int main(int argc, char * argv[]) {
}
}
return file_failed == 0 ? 0 : 3;
return file_failed == 0 ? 0 : 2;
}