[BusyBox] globbing problem with gzip/gunzip
Martin Sieper
msi at ngi-box.de
Tue Feb 5 14:40:30 UTC 2002
Hello Giulio,
am Tuesday 5 February 2002 um 20:07:53 +0100 schrieben Sie:
> latest cvs
>
> gzip/gunzip only process the first file:
I haved the same problem with BusyBox 0.60.2.
See attachment for fix this.
-Martin
-------------- next part --------------
--- gzip.c.orig Tue Nov 20 00:57:54 2001
+++ gzip.c Fri Jan 18 00:13:33 2002
@@ -1222,6 +1222,7 @@
int fromstdin = 0;
int force = 0;
int opt;
+ int file_count; /* number of files to process */
while ((opt = getopt(argc, argv, "cf123456789dq")) != -1) {
switch (opt) {
@@ -1269,6 +1270,7 @@
}
#endif
+ file_count = argc - optind;
strncpy(z_suffix, Z_SUFFIX, sizeof(z_suffix) - 1);
z_len = strlen(z_suffix);
@@ -1279,15 +1281,18 @@
ALLOC(uch, window, 2L * WSIZE);
ALLOC(ush, tab_prefix, 1L << BITS);
+if (file_count != 0) {
+while (optind < argc) {
if (fromstdin == 1) {
strcpy(ofname, "stdin");
inFileNum = fileno(stdin);
time_stamp = 0; /* time unknown by default */
ifile_size = -1L; /* convention for unknown size */
+ optind++;
} else {
/* Open up the input file */
- strncpy(ifname, argv[optind], MAX_PATH_LEN);
+ strncpy(ifname, argv[optind++], MAX_PATH_LEN);
/* Open input file */
inFileNum = open(ifname, O_RDONLY);
@@ -1346,6 +1351,8 @@
if (unlink(delFileName) < 0)
perror_msg_and_die("%s", delFileName);
}
+} /* while () */
+} /* if () */
return(exit_code);
}
More information about the busybox
mailing list