aboutsummaryrefslogtreecommitdiff
path: root/dpkg_deb.c
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-04-16 04:52:19 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-04-16 04:52:19 +0000
commit085a08c884513c3861201988e836e933afcc5b3a (patch)
tree514459eccbc4927b00c0493badb7f12575c9147d /dpkg_deb.c
parent86f02ff6a829c21a8e32cad0ce46e51e94c679dd (diff)
downloadbusybox-w32-085a08c884513c3861201988e836e933afcc5b3a.tar.gz
busybox-w32-085a08c884513c3861201988e836e933afcc5b3a.tar.bz2
busybox-w32-085a08c884513c3861201988e836e933afcc5b3a.zip
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 git-svn-id: svn://busybox.net/trunk/busybox@2350 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'dpkg_deb.c')
-rw-r--r--dpkg_deb.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/dpkg_deb.c b/dpkg_deb.c
index 7c5a5de58..d08882885 100644
--- a/dpkg_deb.c
+++ b/dpkg_deb.c
@@ -15,12 +15,14 @@
15 */ 15 */
16 16
17#include <stdlib.h> 17#include <stdlib.h>
18#include <string.h>
18#include <getopt.h> 19#include <getopt.h>
19#include "busybox.h" 20#include "busybox.h"
20 21
21extern int dpkg_deb_main(int argc, char **argv) 22extern int dpkg_deb_main(int argc, char **argv)
22{ 23{
23 char *argument = NULL; 24 char *argument = NULL;
25 char *output_buffer = NULL;
24 int opt = 0; 26 int opt = 0;
25 int optflag = 0; 27 int optflag = 0;
26 28
@@ -86,7 +88,22 @@ extern int dpkg_deb_main(int argc, char **argv)
86 default: 88 default:
87 } 89 }
88 90
89 deb_extract(argv[optind], optflag, argument); 91 output_buffer = deb_extract(argv[optind], optflag, argument, NULL);
92
93 if (optflag & extract_field) {
94 char *field = NULL;
95 int field_length = 0;
96 int field_start = 0;
97
98 while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
99 field_length = strlen(field);
100 field_start += (field_length + 1);
101 if (strstr(field, argument) == field) {
102 printf("%s\n", field + strlen(argument) + 2);
103 }
104 free(field);
105 }
106 }
90 107
91 return(EXIT_SUCCESS); 108 return(EXIT_SUCCESS);
92} 109}