From 685f5fd6f473f802b465500d5ec7c1baba0ec357 Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Sun, 15 Apr 2001 12:51:59 +0000 Subject: untar changed to allow deb_extract to extract to memory, allows better operation of dpkg-deb -f --- libbb/deb_extract.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'libbb/deb_extract.c') diff --git a/libbb/deb_extract.c b/libbb/deb_extract.c index 0f5a570b6..b95dfa4d4 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); -- cgit v1.2.3