1) bb_opt_complementaly -> bb_opt_complementally

2) better support long options
3) new flag '!' for bb_opt_complementally: produce bb_show_usage() if BB_GETOPT_ERROR internally
This commit is contained in:
"Vladimir N. Oleynik"
2005-09-05 14:46:07 +00:00
parent bef14d7a87
commit 27421a1878
20 changed files with 176 additions and 167 deletions

View File

@@ -67,10 +67,10 @@ extern int ar_main(int argc, char **argv)
archive_handle = init_handle();
bb_opt_complementaly = "p~tx:t~px:x~pt";
bb_opt_complementally = "!p~tx:t~px:x~pt";
opt = bb_getopt_ulflags(argc, argv, "ptxovcr");
if ((opt & BB_GETOPT_ERROR) || (opt == 0) || (optind == argc)) {
if ((opt == 0) || (optind == argc)) {
bb_show_usage();
}

View File

@@ -56,7 +56,7 @@ extern int dpkg_deb_main(int argc, char **argv)
control_tar_llist = llist_add_to(control_tar_llist, "control.tar.bz2");
#endif
bb_opt_complementaly = "c~efXx:e~cfXx:f~ceXx:X~cefx:x~cefX";
bb_opt_complementally = "!c~efXx:e~cfXx:f~ceXx:X~cefx:x~cefX";
opt = bb_getopt_ulflags(argc, argv, "cefXx");
if (opt & DPKG_DEB_OPT_CONTENTS) {
@@ -88,7 +88,7 @@ extern int dpkg_deb_main(int argc, char **argv)
argcount = 2;
}
if ((optind + argcount != argc) || (opt & BB_GETOPT_ERROR)) {
if ((optind + argcount) != argc) {
bb_show_usage();
}

View File

@@ -706,7 +706,7 @@ int tar_main(int argc, char **argv)
tar_handle = init_handle();
tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL;
bb_opt_complementaly = "c~tx:t~cx:x~ct:X*:T*";
bb_opt_complementally = "!c~tx:t~cx:x~ct:X*:T*";
#ifdef CONFIG_FEATURE_TAR_LONG_OPTIONS
bb_applet_long_options = tar_long_options;
#endif
@@ -720,10 +720,6 @@ int tar_main(int argc, char **argv)
#endif
);
/* Check one and only one context option was given */
if(opt & BB_GETOPT_ERROR) {
bb_show_usage();
}
#ifdef CONFIG_FEATURE_TAR_CREATE
ctx_flag = opt & (CTX_CREATE | CTX_TEST | CTX_EXTRACT);
#else