a bit more IPv6-ization work
[oweals/busybox.git] / archival / uncompress.c
index 8c466ebdf9d7df3597ef932c2ac82fa0638bb9e8..4611790168dc9de568f5361b2d26928f9f7dcb84 100644 (file)
@@ -16,16 +16,16 @@ int uncompress_main(int argc, char **argv)
        int status = EXIT_SUCCESS;
        unsigned long flags;
 
-       flags = bb_getopt_ulflags(argc, argv, "cf");
+       flags = getopt32(argc, argv, "cf");
 
        while (optind < argc) {
-               const char *compressed_file = argv[optind++];
-               const char *delete_path = NULL;
+               char *compressed_file = argv[optind++];
+               char *delete_path = NULL;
                char *uncompressed_file = NULL;
                int src_fd;
                int dst_fd;
 
-               if (strcmp(compressed_file, "-") == 0) {
+               if (LONE_DASH(compressed_file)) {
                        src_fd = STDIN_FILENO;
                        flags |= GUNZIP_TO_STDOUT;
                } else {
@@ -49,7 +49,7 @@ int uncompress_main(int argc, char **argv)
 
                        extension = strrchr(uncompressed_file, '.');
                        if (!extension || (strcmp(extension, ".Z") != 0)) {
-                               bb_error_msg_and_die("Invalid extension");
+                               bb_error_msg_and_die("invalid extension");
                        }
                        *extension = '\0';
 
@@ -65,7 +65,7 @@ int uncompress_main(int argc, char **argv)
 
                /* do the decompression, and cleanup */
                if ((xread_char(src_fd) != 0x1f) || (xread_char(src_fd) != 0x9d)) {
-                       bb_error_msg_and_die("Invalid magic");
+                       bb_error_msg_and_die("invalid magic");
                }
 
                status = uncompress(src_fd, dst_fd);
@@ -84,7 +84,7 @@ int uncompress_main(int argc, char **argv)
 
                /* delete_path will be NULL if in test mode or from stdin */
                if (delete_path && (unlink(delete_path) == -1)) {
-                       bb_error_msg_and_die("Couldn't remove %s", delete_path);
+                       bb_error_msg_and_die("cannot remove %s", delete_path);
                }
 
                free(uncompressed_file);