diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-09-05 14:46:07 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-09-05 14:46:07 +0000 |
commit | 27421a1878847389391c1a43420baaccf57057a7 (patch) | |
tree | 73e57d430a5828d242b78deb0a591a99f0df44a9 /coreutils | |
parent | bef14d7a878049a01f1fb9b412611a2d64c2b154 (diff) | |
download | busybox-27421a1878847389391c1a43420baaccf57057a7.tar.gz |
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
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cut.c | 2 | ||||
-rw-r--r-- | coreutils/date.c | 4 | ||||
-rw-r--r-- | coreutils/df.c | 2 | ||||
-rw-r--r-- | coreutils/du.c | 4 | ||||
-rw-r--r-- | coreutils/env.c | 2 | ||||
-rw-r--r-- | coreutils/id.c | 5 | ||||
-rw-r--r-- | coreutils/install.c | 7 | ||||
-rw-r--r-- | coreutils/mv.c | 2 | ||||
-rw-r--r-- | coreutils/rm.c | 2 |
9 files changed, 11 insertions, 19 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c index e5fb5aff7..f65754e63 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -295,7 +295,7 @@ extern int cut_main(int argc, char **argv) unsigned long opt; char *sopt, *sdopt; - bb_opt_complementaly = "b~bcf:c~bcf:f~bcf"; + bb_opt_complementally = "b~bcf:c~bcf:f~bcf"; opt = bb_getopt_ulflags(argc, argv, optstring, &sopt, &sopt, &sopt, &sdopt); part = opt & (OPT_BYTE_FLGS|OPT_CHAR_FLGS|OPT_FIELDS_FLGS); if(part == 0) diff --git a/coreutils/date.c b/coreutils/date.c index 70484e2cd..0488b2de3 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -152,7 +152,7 @@ int date_main(int argc, char **argv) #else # define GETOPT_ISOFMT #endif - bb_opt_complementaly = "d~ds:s~ds"; + bb_opt_complementally = "!d~ds:s~ds"; opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" GETOPT_ISOFMT, &date_str, &date_str, &filename #ifdef CONFIG_FEATURE_DATE_ISOFMT @@ -165,8 +165,6 @@ int date_main(int argc, char **argv) bb_error_msg_and_die(bb_msg_memory_exhausted); } use_arg = opt & DATE_OPT_DATE; - if(opt & BB_GETOPT_ERROR) - bb_show_usage(); #ifdef CONFIG_FEATURE_DATE_ISOFMT if(opt & DATE_OPT_TIMESPEC) { if (!isofmt_arg) { diff --git a/coreutils/df.c b/coreutils/df.c index 9233fbbf1..51d3cc632 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -62,7 +62,7 @@ extern int df_main(int argc, char **argv) const char *disp_units_hdr = hdr_1k; #ifdef CONFIG_FEATURE_HUMAN_READABLE - bb_opt_complementaly = "h-km:k-hm:m-hk"; + bb_opt_complementally = "h-km:k-hm:m-hk"; opt = bb_getopt_ulflags(argc, argv, "hmk"); if(opt & 1) { df_disp_hr = 0; diff --git a/coreutils/du.c b/coreutils/du.c index bfa44034a..3778f0895 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -191,7 +191,7 @@ int du_main(int argc, char **argv) * ignore -a. This is consistent with -s being equivalent to -d 0. */ #ifdef CONFIG_FEATURE_HUMAN_READABLE - bb_opt_complementaly = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; + bb_opt_complementally = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth); if((opt & (1 << 9))) { /* -h opt */ @@ -206,7 +206,7 @@ int du_main(int argc, char **argv) disp_hr = KILOBYTE; } #else - bb_opt_complementaly = "H-L:L-H:s-d:d-s"; + bb_opt_complementally = "H-L:L-H:s-d:d-s"; opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth); #if !defined CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K if((opt & (1 << 2))) { diff --git a/coreutils/env.c b/coreutils/env.c index 87ab30cdd..70cef6588 100644 --- a/coreutils/env.c +++ b/coreutils/env.c @@ -65,7 +65,7 @@ extern int env_main(int argc, char** argv) llist_t *unset_env = NULL; extern char **environ; - bb_opt_complementaly = "u*"; + bb_opt_complementally = "u*"; bb_applet_long_options = env_long_options; opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env); diff --git a/coreutils/id.c b/coreutils/id.c index 636049168..03c6a6d2a 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -61,12 +61,11 @@ extern int id_main(int argc, char **argv) unsigned long flags; short status; - bb_opt_complementaly = "u~g:g~u"; + bb_opt_complementally = "!u~g:g~u"; flags = bb_getopt_ulflags(argc, argv, "rnug"); - if ((flags & BB_GETOPT_ERROR) /* Don't allow -n -r -nr */ - || (flags <= 3 && flags > 0) + if ((flags <= 3 && flags > 0) /* Don't allow more than one username */ || (argc > optind + 1)) bb_show_usage(); diff --git a/coreutils/install.c b/coreutils/install.c index 345e75af0..e22dda6f9 100644 --- a/coreutils/install.c +++ b/coreutils/install.c @@ -64,15 +64,10 @@ extern int install_main(int argc, char **argv) int i; bb_applet_long_options = install_long_options; - bb_opt_complementaly = "s~d:d~s"; + bb_opt_complementally = "!s~d:d~s"; /* -c exists for backwards compatability, its needed */ flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ - /* Check valid options were given */ - if(flags & BB_GETOPT_ERROR) { - bb_show_usage(); - } - /* preserve access and modification time, this is GNU behaviour, BSD only preserves modification time */ if (flags & INSTALL_OPT_PRESERVE_TIME) { copy_flags |= FILEUTILS_PRESERVE_STATUS; diff --git a/coreutils/mv.c b/coreutils/mv.c index e1c4529ad..43a8e6d7d 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c @@ -56,7 +56,7 @@ extern int mv_main(int argc, char **argv) int status = 0; bb_applet_long_options = mv_long_options; - bb_opt_complementaly = "f-i:i-f"; + bb_opt_complementally = "f-i:i-f"; flags = bb_getopt_ulflags(argc, argv, "fi"); if (optind + 2 > argc) { bb_show_usage(); diff --git a/coreutils/rm.c b/coreutils/rm.c index 39609e7b8..e4e9bb0be 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c @@ -38,7 +38,7 @@ extern int rm_main(int argc, char **argv) int flags = 0; unsigned long opt; - bb_opt_complementaly = "f-i:i-f"; + bb_opt_complementally = "f-i:i-f"; opt = bb_getopt_ulflags(argc, argv, "fiRr"); if(opt & 1) flags |= FILEUTILS_FORCE; |