Allow unarchive to redirect stdout (tobe used by dpkg applet)
authorGlenn L McGrath <bug1@ihug.co.nz>
Wed, 11 Jul 2001 17:32:14 +0000 (17:32 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Wed, 11 Jul 2001 17:32:14 +0000 (17:32 -0000)
ar.c
archival/ar.c
archival/cpio.c
cpio.c
include/libbb.h
libbb/libbb.h
libbb/unarchive.c

diff --git a/ar.c b/ar.c
index 09a4a88948bfeb011fffaff85fcde4dc81d040f7..2a764ff5e9b158d6ef1c397aabc64860a2ece659 100644 (file)
--- a/ar.c
+++ b/ar.c
@@ -84,6 +84,6 @@ extern int ar_main(int argc, char **argv)
                optind++;
        }
 
-       unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names);
+       unarchive(src_stream, stdout, &get_header_ar, extract_function, "./", extract_names);
        return EXIT_SUCCESS;
 }
index 09a4a88948bfeb011fffaff85fcde4dc81d040f7..2a764ff5e9b158d6ef1c397aabc64860a2ece659 100644 (file)
@@ -84,6 +84,6 @@ extern int ar_main(int argc, char **argv)
                optind++;
        }
 
-       unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names);
+       unarchive(src_stream, stdout, &get_header_ar, extract_function, "./", extract_names);
        return EXIT_SUCCESS;
 }
index 101d6ec49bb65a7a10e7fce4e5f583e94e918713..12a4340bd8b3735d1997a1c899fbe013a6a0af91 100644 (file)
@@ -85,7 +85,7 @@ extern int cpio_main(int argc, char **argv)
                optind++;
        }
 
-       unarchive(src_stream, &get_header_cpio, extract_function, "./", extract_names);
+       unarchive(src_stream, stdout, &get_header_cpio, extract_function, "./", extract_names);
        if (oldmask) umask(oldmask); /* Restore umask if we changed it */
        return EXIT_SUCCESS;
 }
diff --git a/cpio.c b/cpio.c
index 101d6ec49bb65a7a10e7fce4e5f583e94e918713..12a4340bd8b3735d1997a1c899fbe013a6a0af91 100644 (file)
--- a/cpio.c
+++ b/cpio.c
@@ -85,7 +85,7 @@ extern int cpio_main(int argc, char **argv)
                optind++;
        }
 
-       unarchive(src_stream, &get_header_cpio, extract_function, "./", extract_names);
+       unarchive(src_stream, stdout, &get_header_cpio, extract_function, "./", extract_names);
        if (oldmask) umask(oldmask); /* Restore umask if we changed it */
        return EXIT_SUCCESS;
 }
index 0fc70450157d557e9ce38f4333f29bc482fa0f5c..4a4b9191c094a8ec9b2785f46bc29715820a1bfa 100644 (file)
@@ -239,7 +239,7 @@ enum extract_functions_e {
        extract_unconditional = 512,
        extract_create_leading_dirs = 1024
 };
-char *unarchive(FILE *src_stream, file_header_t *(*get_header)(FILE *),
+char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_header)(FILE *),
        const int extract_function, const char *prefix, char **extract_names);
 char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
        const char *prefix, const char *filename);
index 0fc70450157d557e9ce38f4333f29bc482fa0f5c..4a4b9191c094a8ec9b2785f46bc29715820a1bfa 100644 (file)
@@ -239,7 +239,7 @@ enum extract_functions_e {
        extract_unconditional = 512,
        extract_create_leading_dirs = 1024
 };
-char *unarchive(FILE *src_stream, file_header_t *(*get_header)(FILE *),
+char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_header)(FILE *),
        const int extract_function, const char *prefix, char **extract_names);
 char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
        const char *prefix, const char *filename);
index 067e78b846a32d98e2c13d6230240cd5228a6d14..d95f2cfc70e5e776a40d48cd48131d796b778c34 100644 (file)
@@ -211,7 +211,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
 #endif
 
 #ifdef L_unarchive
-char *unarchive(FILE *src_stream, file_header_t *(*get_headers)(FILE *),
+char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers)(FILE *),
        const int extract_function, const char *prefix, char **extract_names)
 {
        file_header_t *file_entry;
@@ -237,7 +237,7 @@ char *unarchive(FILE *src_stream, file_header_t *(*get_headers)(FILE *),
                                continue;
                        }
                }
-               buffer = extract_archive(src_stream, stdout, file_entry, extract_function, prefix);
+               buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix);
        }
        return(buffer);
 }
@@ -568,7 +568,7 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
                        /* open a stream of decompressed data */
                        uncompressed_stream = gz_open(deb_stream, &gunzip_pid);
                        archive_offset = 0;
-                       output_buffer = unarchive(uncompressed_stream, get_header_tar, extract_function, prefix, file_list);
+                       output_buffer = unarchive(uncompressed_stream, out_stream, get_header_tar, extract_function, prefix, file_list);
                }
                seek_sub_file(deb_stream, ar_header->size);
        }