diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-21 17:27:44 +0400 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-21 17:27:44 +0400 |
commit | 091965768da4175d3763e61db56bba058d68ae3b (patch) | |
tree | 011719c7b70c58099641d98244ea1aad9b2a8e5d /coreutils | |
parent | 557fb713e0f943ac9b87c9f3804ba24e73d55bb0 (diff) |
libbb: nuke BB_GETOPT_ERROR, always die if there are mutually exclusive options
find_pair 164 180 +16
passwd_main 1222 1230 +8
display_speed 91 96 +5
msh_main 1335 1339 +4
qrealloc 38 36 -2
refresh 1190 1182 -8
cut_main 543 532 -11
sendCgi 1807 1794 -13
getopt32 1063 1045 -18
arith 2077 2030 -47
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/6 up/down: 33/-99) Total: -66 bytes
text data bss dec hex filename
781548 1168 11900 794616 c1ff8 busybox_old
781452 1168 11900 794520 c1f98 busybox_unstripped
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/cp.c | 2 | ||||
-rw-r--r-- | coreutils/cut.c | 2 | ||||
-rw-r--r-- | coreutils/date.c | 2 | ||||
-rw-r--r-- | coreutils/dos2unix.c | 22 | ||||
-rw-r--r-- | coreutils/id.c | 2 | ||||
-rw-r--r-- | coreutils/install.c | 2 | ||||
-rw-r--r-- | coreutils/sort.c | 2 |
7 files changed, 15 insertions, 19 deletions
diff --git a/coreutils/cp.c b/coreutils/cp.c index f98f281b5..78bd73c0f 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -44,7 +44,7 @@ int cp_main(int argc, char **argv) // -P and -d are the same (-P is POSIX, -d is GNU) // -r and -R are the same // -a = -pdR - opt_complementary = "?:l--s:s--l:Pd:rR:apdR"; + opt_complementary = "l--s:s--l:Pd:rR:apdR"; flags = getopt32(argc, argv, FILEUTILS_CP_OPTSTR "arPHL"); /* Default behavior of cp is to dereference, so we don't have to do * anything special when we are given -L. diff --git a/coreutils/cut.c b/coreutils/cut.c index 084f7be37..435b21070 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -176,8 +176,6 @@ int cut_main(int argc, char **argv) argv += optind; if (!(option_mask32 & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) bb_error_msg_and_die("expected a list of bytes, characters, or fields"); - if (option_mask32 & BB_GETOPT_ERROR) - bb_error_msg_and_die("only one type of list may be specified"); if (option_mask32 & CUT_OPT_DELIM_FLGS) { if (strlen(ltok) > 1) { diff --git a/coreutils/date.c b/coreutils/date.c index 1b20cd443..5e2bcee3b 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -51,7 +51,7 @@ int date_main(int argc, char **argv) char *isofmt_arg; char *hintfmt_arg; - opt_complementary = "?:d--s:s--d" + opt_complementary = "d--s:s--d" USE_FEATURE_DATE_ISOFMT(":R--I:I--R"); opt = getopt32(argc, argv, "Rs:ud:r:" USE_FEATURE_DATE_ISOFMT("I::D:"), diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index 86adcd91f..115632f75 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -20,7 +20,7 @@ enum { }; /* if fn is NULL then input is stdin and output is stdout */ -static int convert(char *fn, int ConvType) +static int convert(char *fn, int conv_type) { FILE *in, *out; int i; @@ -52,7 +52,7 @@ static int convert(char *fn, int ConvType) if (i == '\r') continue; if (i == '\n') { - if (ConvType == CT_UNIX2DOS) + if (conv_type == CT_UNIX2DOS) fputc('\r', out); fputc('\n', out); continue; @@ -81,29 +81,27 @@ static int convert(char *fn, int ConvType) int dos2unix_main(int argc, char **argv); int dos2unix_main(int argc, char **argv) { - int o, ConvType; + int o, conv_type; /* See if we are supposed to be doing dos2unix or unix2dos */ if (applet_name[0] == 'd') { - ConvType = CT_DOS2UNIX; /* 2 */ + conv_type = CT_DOS2UNIX; /* 2 */ } else { - ConvType = CT_UNIX2DOS; /* 1 */ + conv_type = CT_UNIX2DOS; /* 1 */ } - /* -u and -d are mutally exclusive */ - opt_complementary = "?:u--d:d--u"; - /* process parameters */ - /* -u convert to unix */ - /* -d convert to dos */ + + /* -u convert to unix, -d convert to dos */ + opt_complementary = "u--d:d--u"; /* mutally exclusive */ o = getopt32(argc, argv, "du"); /* Do the conversion requested by an argument else do the default * conversion depending on our name. */ if (o) - ConvType = o; + conv_type = o; do { /* might be convert(NULL) if there is no filename given */ - o = convert(argv[optind], ConvType); + o = convert(argv[optind], conv_type); if (o < 0) break; optind++; diff --git a/coreutils/id.c b/coreutils/id.c index 9dd5b48d3..27fb26e77 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -49,7 +49,7 @@ int id_main(int argc, char **argv) #endif /* Don't allow -n -r -nr -ug -rug -nug -rnug */ /* Don't allow more than one username */ - opt_complementary = "?1:?:u--g:g--u:r?ug:n?ug" USE_SELINUX(":u--Z:Z--u:g--Z:Z--g"); + opt_complementary = "?1:u--g:g--u:r?ug:n?ug" USE_SELINUX(":u--Z:Z--u:g--Z:Z--g"); flags = getopt32(argc, argv, "rnug" USE_SELINUX("Z")); /* This values could be overwritten later */ diff --git a/coreutils/install.c b/coreutils/install.c index 5503b55cd..8d71fa070 100644 --- a/coreutils/install.c +++ b/coreutils/install.c @@ -99,7 +99,7 @@ int install_main(int argc, char **argv) #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS applet_long_options = install_long_options; #endif - opt_complementary = "?:s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z"); + opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z"); /* -c exists for backwards compatibility, it's needed */ flags = getopt32(argc, argv, "cdpsg:m:o:" USE_SELINUX("Z:"), diff --git a/coreutils/sort.c b/coreutils/sort.c index f41bd6329..6371139cb 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -288,7 +288,7 @@ int sort_main(int argc, char **argv) /* Parse command line options */ /* -o and -t can be given at most once */ - opt_complementary = "?:o--o:t--t:" /* -t, -o: maximum one of each */ + opt_complementary = "o--o:t--t:" /* -t, -o: maximum one of each */ "k::"; /* -k takes list */ getopt32(argc, argv, OPT_STR, &str_ignored, &str_ignored, &str_o, &lst_k, &str_t); #if ENABLE_FEATURE_SORT_BIG |