summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2001-07-11 17:32:14 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2001-07-11 17:32:14 +0000
commitc1270088401f1e3f4f8a6bfa2ff5b7228c4a8da0 (patch)
tree06b6690e1666bbdccc2b7bb809f3c1bbd8ce2ac3
parent481d19b38e068e7db8459cb0e108f8049ce5919d (diff)
Allow unarchive to redirect stdout (tobe used by dpkg applet)
-rw-r--r--ar.c2
-rw-r--r--archival/ar.c2
-rw-r--r--archival/cpio.c2
-rw-r--r--cpio.c2
-rw-r--r--include/libbb.h2
-rw-r--r--libbb/libbb.h2
-rw-r--r--libbb/unarchive.c6
7 files changed, 9 insertions, 9 deletions
diff --git a/ar.c b/ar.c
index 09a4a8894..2a764ff5e 100644
--- 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;
}
diff --git a/archival/ar.c b/archival/ar.c
index 09a4a8894..2a764ff5e 100644
--- a/archival/ar.c
+++ b/archival/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;
}
diff --git a/archival/cpio.c b/archival/cpio.c
index 101d6ec49..12a4340bd 100644
--- a/archival/cpio.c
+++ b/archival/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;
}
diff --git a/cpio.c b/cpio.c
index 101d6ec49..12a4340bd 100644
--- 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;
}
diff --git a/include/libbb.h b/include/libbb.h
index 0fc704501..4a4b9191c 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -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);
diff --git a/libbb/libbb.h b/libbb/libbb.h
index 0fc704501..4a4b9191c 100644
--- a/libbb/libbb.h
+++ b/libbb/libbb.h
@@ -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);
diff --git a/libbb/unarchive.c b/libbb/unarchive.c
index 067e78b84..d95f2cfc7 100644
--- a/libbb/unarchive.c
+++ b/libbb/unarchive.c
@@ -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);
}