tar: fix multiple -t and/or -v options handling.
[oweals/busybox.git] / archival / unzip.c
index f639257396b1a224636250939f00b7370c252ba9..8b1c281c4e0c16582fa6067a280f32dc973d3dc1 100644 (file)
@@ -55,7 +55,7 @@ static void unzip_skip(int fd, off_t skip)
 {
        if (lseek(fd, skip, SEEK_CUR) == (off_t)-1) {
                if ((errno != ESPIPE) || (bb_copyfd_size(fd, -1, skip) != skip)) {
-                       bb_error_msg_and_die("Seek failure");
+                       bb_error_msg_and_die("seek failure");
                }
        }
 }
@@ -65,7 +65,7 @@ static void unzip_create_leading_dirs(char *fn)
        /* Create all leading directories */
        char *name = xstrdup(fn);
        if (bb_make_directory(dirname(name), 0777, FILEUTILS_RECUR)) {
-               bb_error_msg_and_die("Exiting"); /* bb_make_directory is noisy */
+               bb_error_msg_and_die("exiting"); /* bb_make_directory is noisy */
        }
        free(name);
 }
@@ -74,9 +74,9 @@ static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
 {
        if (zip_header->formatted.method == 0) {
                /* Method 0 - stored (not compressed) */
-               int size = zip_header->formatted.ucmpsize;
+               off_t size = zip_header->formatted.ucmpsize;
                if (size && (bb_copyfd_size(src_fd, dst_fd, size) != size)) {
-                       bb_error_msg_and_die("Cannot complete extraction");
+                       bb_error_msg_and_die("cannot complete extraction");
                }
 
        } else {
@@ -86,12 +86,12 @@ static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
                inflate_cleanup();
                /* Validate decompression - crc */
                if (zip_header->formatted.crc32 != (gunzip_crc ^ 0xffffffffL)) {
-                       bb_error_msg("Invalid compressed data--crc error");
+                       bb_error_msg("invalid compressed data--%s error", "crc");
                        return 1;
                }
                /* Validate decompression - size */
                if (zip_header->formatted.ucmpsize != gunzip_bytes_out) {
-                       bb_error_msg("Invalid compressed data--length error");
+                       bb_error_msg("invalid compressed data--%s error", "length");
                        return 1;
                }
        }
@@ -201,7 +201,7 @@ int unzip_main(int argc, char **argv)
                }
                if (src_fd == -1) {
                        src_fn[orig_src_fn_len] = 0;
-                       bb_error_msg_and_die("Cannot open %s, %s.zip, %s.ZIP", src_fn, src_fn, src_fn);
+                       bb_error_msg_and_die("cannot open %s, %s.zip, %s.ZIP", src_fn, src_fn, src_fn);
                }
        }
 
@@ -222,7 +222,7 @@ int unzip_main(int argc, char **argv)
                if (magic == ZIP_CDS_MAGIC) {
                        break;
                } else if (magic != ZIP_FILEHEADER_MAGIC) {
-                       bb_error_msg_and_die("Invalid zip magic %08X", magic);
+                       bb_error_msg_and_die("invalid zip magic %08X", magic);
                }
 
                /* Read the file header */
@@ -238,7 +238,7 @@ int unzip_main(int argc, char **argv)
                zip_header.formatted.filename_len = SWAP_LE32(zip_header.formatted.filename_len);
                zip_header.formatted.extra_len = SWAP_LE32(zip_header.formatted.extra_len);
                if ((zip_header.formatted.method != 0) && (zip_header.formatted.method != 8)) {
-                       bb_error_msg_and_die("Unsupported compression method %d", zip_header.formatted.method);
+                       bb_error_msg_and_die("unsupported compression method %d", zip_header.formatted.method);
                }
 
                /* Read filename */
@@ -251,7 +251,7 @@ int unzip_main(int argc, char **argv)
 
                if ((verbosity == v_list) && !list_header_done){
                        printf("  Length     Date   Time    Name\n"
-                                  " --------    ----   ----    ----\n");
+                              " --------    ----   ----    ----\n");
                        list_header_done = 1;
                }
 
@@ -282,14 +282,14 @@ int unzip_main(int argc, char **argv)
                        } else if (last_char_is(dst_fn, '/')) { /* Extract directory */
                                if (stat(dst_fn, &stat_buf) == -1) {
                                        if (errno != ENOENT) {
-                                               bb_perror_msg_and_die("Cannot stat '%s'",dst_fn);
+                                               bb_perror_msg_and_die("cannot stat '%s'",dst_fn);
                                        }
                                        if (verbosity == v_normal) {
                                                printf("   creating: %s\n", dst_fn);
                                        }
                                        unzip_create_leading_dirs(dst_fn);
                                        if (bb_make_directory(dst_fn, 0777, 0)) {
-                                               bb_error_msg_and_die("Exiting");
+                                               bb_error_msg_and_die("exiting");
                                        }
                                } else {
                                        if (!S_ISDIR(stat_buf.st_mode)) {
@@ -302,7 +302,7 @@ int unzip_main(int argc, char **argv)
                        _check_file:
                                if (stat(dst_fn, &stat_buf) == -1) { /* File does not exist */
                                        if (errno != ENOENT) {
-                                               bb_perror_msg_and_die("Cannot stat '%s'",dst_fn);
+                                               bb_perror_msg_and_die("cannot stat '%s'",dst_fn);
                                        }
                                        i = 'y';
 
@@ -316,7 +316,7 @@ int unzip_main(int argc, char **argv)
                                                } else {
                                                        printf("replace %s? [y]es, [n]o, [A]ll, [N]one, [r]ename: ", dst_fn);
                                                        if (!fgets(key_buf, 512, stdin)) {
-                                                               bb_perror_msg_and_die("Cannot read input");
+                                                               bb_perror_msg_and_die("cannot read input");
                                                        }
                                                        i = key_buf[0];
                                                }
@@ -358,7 +358,7 @@ int unzip_main(int argc, char **argv)
                        /* Prompt for new name */
                        printf("new name: ");
                        if (!fgets(key_buf, 512, stdin)) {
-                               bb_perror_msg_and_die("Cannot read input");
+                               bb_perror_msg_and_die("cannot read input");
                        }
                        free(dst_fn);
                        dst_fn = xstrdup(key_buf);