summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2001-03-29 00:57:20 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2001-03-29 00:57:20 +0000
commited7a77653847c72bfe22879cea5f976fa9defb24 (patch)
tree6f87e5d57a3c9fd4ec4a5816e904e41cc15e85c1 /archival
parentae8ad35590ad2b82232920c94a0e2317e4008552 (diff)
downloadbusybox-w32-ed7a77653847c72bfe22879cea5f976fa9defb24.tar.gz
busybox-w32-ed7a77653847c72bfe22879cea5f976fa9defb24.tar.bz2
busybox-w32-ed7a77653847c72bfe22879cea5f976fa9defb24.zip
gunzip -c works again
Diffstat (limited to 'archival')
-rw-r--r--archival/gunzip.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c
index 93f7c351e..d457b750c 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -1080,32 +1080,31 @@ extern int gunzip_main(int argc, char **argv)
1080 if (argc != 2) { 1080 if (argc != 2) {
1081 show_usage(); 1081 show_usage();
1082 } 1082 }
1083 flags |= gunzip_force; 1083 flags |= (gunzip_force | gunzip_to_stdout);
1084 flags |= gunzip_to_stdout;
1085 } else 1084 } else
1086#endif 1085#endif
1087 { 1086 if (strcmp(applet_name, "gunzip") == 0) {
1088 /* workout flags as regular gunzip */ 1087 /* workout flags as regular gunzip */
1089 /* set default flags */ 1088 /* set default flags */
1090 if (argc == 1) { 1089 if (argc == 1) {
1091 flags |= (gunzip_from_stdin | gunzip_to_stdout); 1090 flags |= (gunzip_from_stdin | gunzip_to_stdout);
1092 } 1091 } else {
1093 1092 /* Parse any options */
1094 /* Parse any options */ 1093 while ((opt = getopt(argc, argv, "ctfh")) != -1) {
1095 while ((opt = getopt(argc, argv, "ctfh")) != -1) { 1094 switch (opt) {
1096 switch (opt) { 1095 case 'c':
1097 case 'c': 1096 flags |= gunzip_to_stdout;
1098 flags |= gunzip_to_stdout; 1097 break;
1099 break; 1098 case 'f':
1100 case 'f': 1099 flags |= gunzip_force;
1101 flags |= gunzip_force; 1100 break;
1102 break; 1101 case 't':
1103 case 't': 1102 flags |= gunzip_test;
1104 flags |= gunzip_test; 1103 break;
1105 break; 1104 case 'h':
1106 case 'h': 1105 default:
1107 default: 1106 show_usage(); /* exit's inside usage */
1108 show_usage(); /* exit's inside usage */ 1107 }
1109 } 1108 }
1110 } 1109 }
1111 } 1110 }
@@ -1116,7 +1115,6 @@ extern int gunzip_main(int argc, char **argv)
1116 if ((flags & gunzip_force) == 0) { 1115 if ((flags & gunzip_force) == 0) {
1117 error_msg_and_die("data not written to terminal. Use -f to force it."); 1116 error_msg_and_die("data not written to terminal. Use -f to force it.");
1118 } 1117 }
1119 strcpy(if_name, "stdin");
1120 } else { 1118 } else {
1121 if_name = strdup(argv[optind]); 1119 if_name = strdup(argv[optind]);
1122 /* Open input file */ 1120 /* Open input file */
@@ -1135,8 +1133,6 @@ extern int gunzip_main(int argc, char **argv)
1135 if (isatty(fileno(out_file)) && ((flags & gunzip_force) == 0)) { 1133 if (isatty(fileno(out_file)) && ((flags & gunzip_force) == 0)) {
1136 error_msg_and_die("data not written to terminal. Use -f to force it."); 1134 error_msg_and_die("data not written to terminal. Use -f to force it.");
1137 } 1135 }
1138
1139 strcpy(of_name, "stdout");
1140 } else if (flags & gunzip_test) { 1136 } else if (flags & gunzip_test) {
1141 out_file = xfopen("/dev/null", "w"); /* why does test use filenum 2 ? */ 1137 out_file = xfopen("/dev/null", "w"); /* why does test use filenum 2 ? */
1142 } else { 1138 } else {