summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-09-01 00:41:10 +0000
committerEric Andersen <andersen@codepoet.org>2000-09-01 00:41:10 +0000
commite99674a70fa444e2b6e5d4db9e66113c7df76508 (patch)
tree23221f25390d9e63d8b69b06f83261b652a8bfdf
parent5eb5912790b32df1dcf3ed91652d0c373c735bb0 (diff)
Correct the stdin/stdout behavior when no args are provided.
-Erik
-rw-r--r--archival/gunzip.c10
-rw-r--r--gunzip.c10
2 files changed, 10 insertions, 10 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c
index 20af97aed..9032852ed 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -581,10 +581,7 @@ int gunzip_main(int argc, char **argv)
char ofname[MAX_PATH_LEN + 1]; /* output file name */
if (strcmp(applet_name, "zcat") == 0) {
- tostdout = 1;
- if (argc == 1) {
- fromstdin = 1;
- }
+ force = 1;
}
/* Parse any options */
@@ -608,8 +605,11 @@ int gunzip_main(int argc, char **argv)
}
}
}
- if (argc <= 0)
+
+ if (argc <= 0) {
+ tostdout = 1;
fromstdin = 1;
+ }
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
fatalError( "data not read from terminal. Use -f to force it.\n");
diff --git a/gunzip.c b/gunzip.c
index 20af97aed..9032852ed 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -581,10 +581,7 @@ int gunzip_main(int argc, char **argv)
char ofname[MAX_PATH_LEN + 1]; /* output file name */
if (strcmp(applet_name, "zcat") == 0) {
- tostdout = 1;
- if (argc == 1) {
- fromstdin = 1;
- }
+ force = 1;
}
/* Parse any options */
@@ -608,8 +605,11 @@ int gunzip_main(int argc, char **argv)
}
}
}
- if (argc <= 0)
+
+ if (argc <= 0) {
+ tostdout = 1;
fromstdin = 1;
+ }
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
fatalError( "data not read from terminal. Use -f to force it.\n");