aboutsummaryrefslogtreecommitdiff
path: root/archival/dpkg_deb.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2001-04-12 10:19:08 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2001-04-12 10:19:08 +0000
commit359c1068719c295b25b2d8b81a6aded5aeb6e23d (patch)
tree680864ee0a5e6782c4fdfa9906ff902a44411524 /archival/dpkg_deb.c
parent46079a1d7792dc3848667ddc875bd2467be1ddc1 (diff)
downloadbusybox-w32-359c1068719c295b25b2d8b81a6aded5aeb6e23d.tar.gz
busybox-w32-359c1068719c295b25b2d8b81a6aded5aeb6e23d.tar.bz2
busybox-w32-359c1068719c295b25b2d8b81a6aded5aeb6e23d.zip
Fix dpkg-deb, enum's are cool
Diffstat (limited to 'archival/dpkg_deb.c')
-rw-r--r--archival/dpkg_deb.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 3cdd4ffae..fbdb14e26 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -20,12 +20,6 @@
20 20
21extern int dpkg_deb_main(int argc, char **argv) 21extern int dpkg_deb_main(int argc, char **argv)
22{ 22{
23 const int dpkg_deb_contents = 1;
24 const int dpkg_deb_control = 2;
25// const int dpkg_deb_info = 4;
26 const int dpkg_deb_extract = 8;
27 const int dpkg_deb_verbose_extract = 16;
28 const int dpkg_deb_list = 32;
29 char *target_dir = NULL; 23 char *target_dir = NULL;
30 int opt = 0; 24 int opt = 0;
31 int optflag = 0; 25 int optflag = 0;
@@ -33,22 +27,22 @@ extern int dpkg_deb_main(int argc, char **argv)
33 while ((opt = getopt(argc, argv, "cexXl")) != -1) { 27 while ((opt = getopt(argc, argv, "cexXl")) != -1) {
34 switch (opt) { 28 switch (opt) {
35 case 'c': 29 case 'c':
36 optflag |= dpkg_deb_contents; 30 optflag |= extract_contents;
37 break; 31 break;
38 case 'e': 32 case 'e':
39 optflag |= dpkg_deb_control; 33 optflag |= extract_control;
40 break; 34 break;
41 case 'X': 35 case 'X':
42 optflag |= dpkg_deb_verbose_extract; 36 optflag |= extract_verbose_extract;
43 break; 37 break;
44 case 'x': 38 case 'x':
45 optflag |= dpkg_deb_extract; 39 optflag |= extract_extract;
46 break; 40 break;
47 case 'l': 41 case 'l':
48 optflag |= dpkg_deb_list; 42 optflag |= extract_list;
49 break; 43 break;
50/* case 'I': 44/* case 'I':
51 optflag |= dpkg_deb_info; 45 optflag |= extract_info;
52 break; 46 break;
53*/ 47*/
54 default: 48 default:
@@ -59,14 +53,19 @@ extern int dpkg_deb_main(int argc, char **argv)
59 if (((optind + 1 ) > argc) || (optflag == 0)) { 53 if (((optind + 1 ) > argc) || (optflag == 0)) {
60 show_usage(); 54 show_usage();
61 } 55 }
62 if ((optflag & dpkg_deb_control) || (optflag & dpkg_deb_extract) || (optflag & dpkg_deb_verbose_extract)) { 56 switch (optflag) {
63 if ( (optind + 1) == argc ) { 57 case (extract_control):
64 target_dir = (char *) xmalloc(7); 58 case (extract_extract):
65 strcpy(target_dir, "DEBIAN"); 59 case (extract_verbose_extract):
66 } else { 60 if ( (optind + 1) == argc ) {
61 target_dir = (char *) xmalloc(7);
62 strcpy(target_dir, "DEBIAN");
63 }
64 break;
65 default: {
67 target_dir = (char *) xmalloc(strlen(argv[optind + 1])); 66 target_dir = (char *) xmalloc(strlen(argv[optind + 1]));
68 strcpy(target_dir, argv[optind + 1]); 67 strcpy(target_dir, argv[optind + 1]);
69 } 68 }
70 } 69 }
71 deb_extract(argv[optind], optflag, target_dir); 70 deb_extract(argv[optind], optflag, target_dir);
72/* else if (optflag & dpkg_deb_info) { 71/* else if (optflag & dpkg_deb_info) {