summaryrefslogtreecommitdiff
path: root/libbb/deb_extract.c
diff options
context:
space:
mode:
authorGlenn L McGrath2001-04-15 12:51:59 +0000
committerGlenn L McGrath2001-04-15 12:51:59 +0000
commit685f5fd6f473f802b465500d5ec7c1baba0ec357 (patch)
tree1afa19b480add8d7c3a582b93b31971c23d5594f /libbb/deb_extract.c
parenta529d885d2ac3f0830764f70253e172bbb439133 (diff)
downloadbusybox-685f5fd6f473f802b465500d5ec7c1baba0ec357.zip
busybox-685f5fd6f473f802b465500d5ec7c1baba0ec357.tar.gz
untar changed to allow deb_extract to extract to memory, allows better operation of dpkg-deb -f
Diffstat (limited to 'libbb/deb_extract.c')
-rw-r--r--libbb/deb_extract.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/libbb/deb_extract.c b/libbb/deb_extract.c
index 0f5a570..b95dfa4 100644
--- a/libbb/deb_extract.c
+++ b/libbb/deb_extract.c
@@ -75,11 +75,24 @@ extern int deb_extract(const char *package_filename, int function, char *argumen
if (function & extract_fsys_tarfile) {
copy_file_chunk(uncompressed_file, stdout, -1);
} else {
- untar(uncompressed_file, function, argument);
+ char *output_buffer = NULL;
+ output_buffer = untar(uncompressed_file, stdout, function, argument);
+ if (function & extract_field) {
+ char *field = NULL;
+ int field_length = 0;
+ int field_start = 0;
+ while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
+ field_length = strlen(field);
+ field_start += (field_length + 1);
+ if (strstr(field, argument) == field) {
+ printf("%s\n", field + strlen(argument) + 2);
+ }
+ free(field);
+ }
+ }
}
- /* we are deliberately terminating the child so we can safely ignore this */
- gz_close(gunzip_pid);
+ gz_close(gunzip_pid);
fclose(deb_file);
fclose(uncompressed_file);
free(ared_file);