diff options
author | Glenn L McGrath | 2001-04-13 04:02:57 +0000 |
---|---|---|
committer | Glenn L McGrath | 2001-04-13 04:02:57 +0000 |
commit | 445fb952b8becc78889d3079e3053f76aa2eba9c (patch) | |
tree | feda0730549303c7fadd259741bea57207e46431 /archival/dpkg_deb.c | |
parent | 1e04ea388f5f673f44503052d0f8873e4017abc3 (diff) | |
download | busybox-445fb952b8becc78889d3079e3053f76aa2eba9c.zip busybox-445fb952b8becc78889d3079e3053f76aa2eba9c.tar.gz |
dpkg-deb -f and partial -I commands, adds 600 bytes
Diffstat (limited to 'archival/dpkg_deb.c')
-rw-r--r-- | archival/dpkg_deb.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 3bec8cf..7c5a5de 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -20,11 +20,11 @@ extern int dpkg_deb_main(int argc, char **argv) { - char *target_dir; + char *argument = NULL; int opt = 0; int optflag = 0; - while ((opt = getopt(argc, argv, "cetXxl")) != -1) { + while ((opt = getopt(argc, argv, "ceftXxI")) != -1) { switch (opt) { case 'c': optflag |= extract_contents; @@ -32,6 +32,9 @@ extern int dpkg_deb_main(int argc, char **argv) case 'e': optflag |= extract_control; break; + case 'f': + optflag |= extract_field; + break; case 't': optflag |= extract_fsys_tarfile; break; @@ -41,13 +44,9 @@ extern int dpkg_deb_main(int argc, char **argv) case 'x': optflag |= extract_extract; break; - case 'l': - optflag |= extract_list; - break; -/* case 'I': + case 'I': optflag |= extract_info; break; -*/ default: show_usage(); } @@ -61,26 +60,33 @@ extern int dpkg_deb_main(int argc, char **argv) case (extract_control): case (extract_extract): case (extract_verbose_extract): + /* argument is a dir name */ if ( (optind + 1) == argc ) { - target_dir = (char *) xmalloc(7); - strcpy(target_dir, "DEBIAN"); + argument = xstrdup("DEBIAN"); } else { - target_dir = (char *) xmalloc(strlen(argv[optind + 1]) + 1); - strcpy(target_dir, argv[optind + 1]); + argument = xstrdup(argv[optind + 1]); } break; + case (extract_field): + /* argument is a control field name */ + if ((optind + 1) != argc) { + argument = xstrdup(argv[optind + 1]); + } + break; + case (extract_info): + /* argument is a control field name */ + if ((optind + 1) != argc) { + argument = xstrdup(argv[optind + 1]); + break; + } else { + error_msg("-I currently requires a filename to be specifies"); + return(EXIT_FAILURE); + } + /* argument is a filename */ default: - target_dir = NULL; } - deb_extract(argv[optind], optflag, target_dir); -/* else if (optflag & dpkg_deb_info) { - extract_flag = TRUE; - extract_to_stdout = TRUE; - strcpy(ar_filename, "control.tar.gz"); - extract_list = argv+optind+1; - printf("list one is [%s]\n",extract_list[0]); - } -*/ + deb_extract(argv[optind], optflag, argument); + return(EXIT_SUCCESS); } |