Correct the stdin/stdout behavior when no args are provided.

-Erik
This commit is contained in:
Eric Andersen 2000-09-01 00:41:10 +00:00
parent 5eb5912790
commit e99674a70f
2 changed files with 10 additions and 10 deletions

View File

@ -581,10 +581,7 @@ int gunzip_main(int argc, char **argv)
char ofname[MAX_PATH_LEN + 1]; /* output file name */ char ofname[MAX_PATH_LEN + 1]; /* output file name */
if (strcmp(applet_name, "zcat") == 0) { if (strcmp(applet_name, "zcat") == 0) {
tostdout = 1; force = 1;
if (argc == 1) {
fromstdin = 1;
}
} }
/* Parse any options */ /* Parse any options */
@ -608,8 +605,11 @@ int gunzip_main(int argc, char **argv)
} }
} }
} }
if (argc <= 0)
if (argc <= 0) {
tostdout = 1;
fromstdin = 1; fromstdin = 1;
}
if (isatty(fileno(stdin)) && fromstdin==1 && force==0) if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
fatalError( "data not read from terminal. Use -f to force it.\n"); fatalError( "data not read from terminal. Use -f to force it.\n");

View File

@ -581,10 +581,7 @@ int gunzip_main(int argc, char **argv)
char ofname[MAX_PATH_LEN + 1]; /* output file name */ char ofname[MAX_PATH_LEN + 1]; /* output file name */
if (strcmp(applet_name, "zcat") == 0) { if (strcmp(applet_name, "zcat") == 0) {
tostdout = 1; force = 1;
if (argc == 1) {
fromstdin = 1;
}
} }
/* Parse any options */ /* Parse any options */
@ -608,8 +605,11 @@ int gunzip_main(int argc, char **argv)
} }
} }
} }
if (argc <= 0)
if (argc <= 0) {
tostdout = 1;
fromstdin = 1; fromstdin = 1;
}
if (isatty(fileno(stdin)) && fromstdin==1 && force==0) if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
fatalError( "data not read from terminal. Use -f to force it.\n"); fatalError( "data not read from terminal. Use -f to force it.\n");