xgethostbyname: more readable
[oweals/busybox.git] / archival / gzip.c
index bb58158f4b507ecc06431b9c1f6e374ebf718e26..ef3724c3419b8eddfac624aa2a2af158006ef50e 100644 (file)
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
-// TODO: full support for -v for DESKTOP
+/* TODO: full support for -v for DESKTOP
+/usr/bin/gzip -v a bogus aa
+a:       85.1% -- replaced with a.gz
+gzip: bogus: No such file or directory
+aa:      85.1% -- replaced with aa.gz
+*/
 
 #define SMALL_MEM
 
@@ -125,8 +130,8 @@ typedef int file_t;         /* Do not use stdio */
 #define ASCII   1
 
 #ifndef WSIZE
-#  define WSIZE 0x8000 /* window size--must be a power of two, and */
-#endif                                                 /*  at least 32K for zip's deflate method */
+#  define WSIZE 0x8000  /* window size--must be a power of two, and */
+#endif                  /*  at least 32K for zip's deflate method */
 
 #define MIN_MATCH  3
 #define MAX_MATCH  258
@@ -1129,14 +1134,14 @@ int gzip_main(int argc, char **argv)
                OPT_force = 0x2,
        };
 
-       unsigned long opt;
+       unsigned opt;
        int result;
        int inFileNum;
        int outFileNum;
        struct stat statBuf;
        char *delFileName;
 
-       opt = bb_getopt_ulflags(argc, argv, "cf123456789qv" USE_GUNZIP("d"));
+       opt = getopt32(argc, argv, "cf123456789qv" USE_GUNZIP("d"));
        //if (opt & 0x1) // -c
        //if (opt & 0x2) // -f
        /* Ignore 1-9 (compression level) options */
@@ -1152,7 +1157,7 @@ int gzip_main(int argc, char **argv)
        //if (opt & 0x800) // -q
        //if (opt & 0x1000) // -v
        if (ENABLE_GUNZIP && (opt & 0x2000)) { // -d
-               /* FIXME: bb_getopt_ulflags should not depend on optind */
+               /* FIXME: getopt32 should not depend on optind */
                optind = 1;
                return gunzip_main(argc, argv);
        }
@@ -2402,7 +2407,6 @@ static int zip(int in, int out)
 
        /* Write the header to the gzip file. See algorithm.doc for the format */
 
-
        method = DEFLATED;
        put_header_byte(GZIP_MAGIC[0]); /* magic header */
        put_header_byte(GZIP_MAGIC[1]);