summaryrefslogtreecommitdiff
path: root/archival/dpkg_deb.c
diff options
context:
space:
mode:
authorGlenn L McGrath2001-04-16 04:52:19 +0000
committerGlenn L McGrath2001-04-16 04:52:19 +0000
commit33431ebb9ace3fba76138198596f8155c2e14354 (patch)
tree514459eccbc4927b00c0493badb7f12575c9147d /archival/dpkg_deb.c
parent3136904ff69b3f67096dbaf2afd9ac77256c4bae (diff)
downloadbusybox-33431ebb9ace3fba76138198596f8155c2e14354.zip
busybox-33431ebb9ace3fba76138198596f8155c2e14354.tar.gz
dpkg improvements, use full package struct, avoid extracting to tmp dir, rename variable.
deb_extract, untar and dpkg_deb modified to make the above possible
Diffstat (limited to 'archival/dpkg_deb.c')
-rw-r--r--archival/dpkg_deb.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 7c5a5de..d088828 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -15,12 +15,14 @@
*/
#include <stdlib.h>
+#include <string.h>
#include <getopt.h>
#include "busybox.h"
extern int dpkg_deb_main(int argc, char **argv)
{
char *argument = NULL;
+ char *output_buffer = NULL;
int opt = 0;
int optflag = 0;
@@ -86,7 +88,22 @@ extern int dpkg_deb_main(int argc, char **argv)
default:
}
- deb_extract(argv[optind], optflag, argument);
+ output_buffer = deb_extract(argv[optind], optflag, argument, NULL);
+
+ if (optflag & 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);
+ }
+ }
return(EXIT_SUCCESS);
}