diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-18 15:32:12 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-18 15:32:12 +0000 |
commit | fe7cd642b0b732f5d41403c2f6983ad676b69dd9 (patch) | |
tree | e5962885cb72c976f44b178a350a92ba5f1aa02d | |
parent | d6cd9d7fe9eab19a9e36fdda729c78c40205b1e5 (diff) | |
download | busybox-w32-fe7cd642b0b732f5d41403c2f6983ad676b69dd9.tar.gz busybox-w32-fe7cd642b0b732f5d41403c2f6983ad676b69dd9.tar.bz2 busybox-w32-fe7cd642b0b732f5d41403c2f6983ad676b69dd9.zip |
don't pass argc in getopt32, it's superfluous
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
text data bss dec hex filename
773469 1058 11092 785619 bfcd3 busybox_old
772644 1058 11092 784794 bf99a busybox_unstripped
143 files changed, 174 insertions, 169 deletions
diff --git a/archival/ar.c b/archival/ar.c index 7b16c2b59..db23c2b73 100644 --- a/archival/ar.c +++ b/archival/ar.c | |||
@@ -52,7 +52,7 @@ int ar_main(int argc, char **argv) | |||
52 | 52 | ||
53 | /* Prepend '-' to the first argument if required */ | 53 | /* Prepend '-' to the first argument if required */ |
54 | opt_complementary = "--:p:t:x:-1:p--tx:t--px:x--pt"; | 54 | opt_complementary = "--:p:t:x:-1:p--tx:t--px:x--pt"; |
55 | opt = getopt32(argc, argv, "ptxovcr"); | 55 | opt = getopt32(argv, "ptxovcr"); |
56 | 56 | ||
57 | if (opt & AR_CTX_PRINT) { | 57 | if (opt & AR_CTX_PRINT) { |
58 | archive_handle->action_data = data_extract_to_stdout; | 58 | archive_handle->action_data = data_extract_to_stdout; |
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index f824fcf67..56c742a49 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -161,7 +161,7 @@ USE_DESKTOP(long long) int unpack_bunzip2(void) | |||
161 | int bunzip2_main(int argc, char **argv); | 161 | int bunzip2_main(int argc, char **argv); |
162 | int bunzip2_main(int argc, char **argv) | 162 | int bunzip2_main(int argc, char **argv) |
163 | { | 163 | { |
164 | getopt32(argc, argv, "cf"); | 164 | getopt32(argv, "cf"); |
165 | argv += optind; | 165 | argv += optind; |
166 | if (applet_name[2] == 'c') | 166 | if (applet_name[2] == 'c') |
167 | option_mask32 |= OPT_STDOUT; | 167 | option_mask32 |= OPT_STDOUT; |
@@ -260,7 +260,7 @@ USE_DESKTOP(long long) int unpack_gunzip(void) | |||
260 | int gunzip_main(int argc, char **argv); | 260 | int gunzip_main(int argc, char **argv); |
261 | int gunzip_main(int argc, char **argv) | 261 | int gunzip_main(int argc, char **argv) |
262 | { | 262 | { |
263 | getopt32(argc, argv, "cfvdt"); | 263 | getopt32(argv, "cfvdt"); |
264 | argv += optind; | 264 | argv += optind; |
265 | /* if called as zcat */ | 265 | /* if called as zcat */ |
266 | if (applet_name[1] == 'c') | 266 | if (applet_name[1] == 'c') |
@@ -298,7 +298,7 @@ USE_DESKTOP(long long) int unpack_unlzma(void) | |||
298 | int unlzma_main(int argc, char **argv); | 298 | int unlzma_main(int argc, char **argv); |
299 | int unlzma_main(int argc, char **argv) | 299 | int unlzma_main(int argc, char **argv) |
300 | { | 300 | { |
301 | getopt32(argc, argv, "c"); | 301 | getopt32(argv, "c"); |
302 | argv += optind; | 302 | argv += optind; |
303 | /* lzmacat? */ | 303 | /* lzmacat? */ |
304 | if (applet_name[4] == 'c') | 304 | if (applet_name[4] == 'c') |
@@ -340,7 +340,7 @@ USE_DESKTOP(long long) int unpack_uncompress(void) | |||
340 | int uncompress_main(int argc, char **argv); | 340 | int uncompress_main(int argc, char **argv); |
341 | int uncompress_main(int argc, char **argv) | 341 | int uncompress_main(int argc, char **argv) |
342 | { | 342 | { |
343 | getopt32(argc, argv, "cf"); | 343 | getopt32(argv, "cf"); |
344 | argv += optind; | 344 | argv += optind; |
345 | 345 | ||
346 | return bbunpack(argv, make_new_name_uncompress, unpack_uncompress); | 346 | return bbunpack(argv, make_new_name_uncompress, unpack_uncompress); |
diff --git a/archival/cpio.c b/archival/cpio.c index 72d31c35d..9188e09f1 100644 --- a/archival/cpio.c +++ b/archival/cpio.c | |||
@@ -35,7 +35,7 @@ int cpio_main(int argc, char **argv) | |||
35 | archive_handle->seek = seek_by_read; | 35 | archive_handle->seek = seek_by_read; |
36 | archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE; | 36 | archive_handle->flags = ARCHIVE_EXTRACT_NEWER | ARCHIVE_PRESERVE_DATE; |
37 | 37 | ||
38 | opt = getopt32(argc, argv, "ituvF:dm", &cpio_filename); | 38 | opt = getopt32(argv, "ituvF:dm", &cpio_filename); |
39 | 39 | ||
40 | /* One of either extract or test options must be given */ | 40 | /* One of either extract or test options must be given */ |
41 | if ((opt & (CPIO_OPT_TEST | CPIO_OPT_EXTRACT)) == 0) { | 41 | if ((opt & (CPIO_OPT_TEST | CPIO_OPT_EXTRACT)) == 0) { |
diff --git a/archival/dpkg.c b/archival/dpkg.c index b5fc06d3d..337576ccd 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -1579,7 +1579,7 @@ int dpkg_main(int argc, char **argv) | |||
1579 | OPT_unpack = 0x40, | 1579 | OPT_unpack = 0x40, |
1580 | }; | 1580 | }; |
1581 | 1581 | ||
1582 | opt = getopt32(argc, argv, "CF:ilPru", &str_f); | 1582 | opt = getopt32(argv, "CF:ilPru", &str_f); |
1583 | //if (opt & OPT_configure) ... // -C | 1583 | //if (opt & OPT_configure) ... // -C |
1584 | if (opt & OPT_force_ignore_depends) { // -F (--force in official dpkg) | 1584 | if (opt & OPT_force_ignore_depends) { // -F (--force in official dpkg) |
1585 | if (strcmp(str_f, "depends")) | 1585 | if (strcmp(str_f, "depends")) |
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 6dd817101..9781b54e5 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c | |||
@@ -42,7 +42,7 @@ int dpkg_deb_main(int argc, char **argv) | |||
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | opt_complementary = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; | 44 | opt_complementary = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; |
45 | opt = getopt32(argc, argv, "cefXx"); | 45 | opt = getopt32(argv, "cefXx"); |
46 | 46 | ||
47 | if (opt & DPKG_DEB_OPT_CONTENTS) { | 47 | if (opt & DPKG_DEB_OPT_CONTENTS) { |
48 | tar_archive->action_header = header_verbose_list; | 48 | tar_archive->action_header = header_verbose_list; |
diff --git a/archival/gzip.c b/archival/gzip.c index 83d78e47c..bda4ae102 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -2031,7 +2031,7 @@ int gzip_main(int argc, char **argv) | |||
2031 | unsigned opt; | 2031 | unsigned opt; |
2032 | 2032 | ||
2033 | /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ | 2033 | /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ |
2034 | opt = getopt32(argc, argv, "cfv" USE_GUNZIP("d") "q123456789" ); | 2034 | opt = getopt32(argv, "cfv" USE_GUNZIP("d") "q123456789" ); |
2035 | option_mask32 &= 0x7; /* Clear -d, ignore -q, -0..9 */ | 2035 | option_mask32 &= 0x7; /* Clear -d, ignore -q, -0..9 */ |
2036 | //if (opt & 0x1) // -c | 2036 | //if (opt & 0x1) // -c |
2037 | //if (opt & 0x2) // -f | 2037 | //if (opt & 0x2) // -f |
diff --git a/archival/tar.c b/archival/tar.c index bed8cf24c..9bf9058d8 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -788,7 +788,7 @@ int tar_main(int argc, char **argv) | |||
788 | #if ENABLE_FEATURE_TAR_LONG_OPTIONS | 788 | #if ENABLE_FEATURE_TAR_LONG_OPTIONS |
789 | applet_long_options = tar_longopts; | 789 | applet_long_options = tar_longopts; |
790 | #endif | 790 | #endif |
791 | opt = getopt32(argc, argv, | 791 | opt = getopt32(argv, |
792 | "txC:f:Opvk" | 792 | "txC:f:Opvk" |
793 | USE_FEATURE_TAR_CREATE( "ch" ) | 793 | USE_FEATURE_TAR_CREATE( "ch" ) |
794 | USE_FEATURE_TAR_BZIP2( "j" ) | 794 | USE_FEATURE_TAR_BZIP2( "j" ) |
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c index a9bbc78d5..32218ae8f 100644 --- a/console-tools/setconsole.c +++ b/console-tools/setconsole.c | |||
@@ -27,7 +27,7 @@ int setconsole_main(int argc, char **argv) | |||
27 | #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS | 27 | #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS |
28 | applet_long_options = setconsole_longopts; | 28 | applet_long_options = setconsole_longopts; |
29 | #endif | 29 | #endif |
30 | flags = getopt32(argc, argv, "r"); | 30 | flags = getopt32(argv, "r"); |
31 | 31 | ||
32 | if (argc - optind > 1) | 32 | if (argc - optind > 1) |
33 | bb_show_usage(); | 33 | bb_show_usage(); |
diff --git a/coreutils/cal.c b/coreutils/cal.c index 317099385..35a563145 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
@@ -86,7 +86,7 @@ int cal_main(int argc, char **argv) | |||
86 | char day_headings[28]; /* 28 for julian, 21 for nonjulian */ | 86 | char day_headings[28]; /* 28 for julian, 21 for nonjulian */ |
87 | char buf[40]; | 87 | char buf[40]; |
88 | 88 | ||
89 | flags = getopt32(argc, argv, "jy"); | 89 | flags = getopt32(argv, "jy"); |
90 | julian = flags & 1; | 90 | julian = flags & 1; |
91 | month = 0; | 91 | month = 0; |
92 | argv += optind; | 92 | argv += optind; |
diff --git a/coreutils/cat.c b/coreutils/cat.c index 64e697eb3..cd5277819 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
@@ -46,7 +46,7 @@ int bb_cat(char **argv) | |||
46 | int cat_main(int argc, char **argv); | 46 | int cat_main(int argc, char **argv); |
47 | int cat_main(int argc, char **argv) | 47 | int cat_main(int argc, char **argv) |
48 | { | 48 | { |
49 | getopt32(argc, argv, "u"); | 49 | getopt32(argv, "u"); |
50 | argv += optind; | 50 | argv += optind; |
51 | return bb_cat(argv); | 51 | return bb_cat(argv); |
52 | } | 52 | } |
diff --git a/coreutils/catv.c b/coreutils/catv.c index 0ca73a0c9..ce927465b 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c | |||
@@ -19,7 +19,7 @@ int catv_main(int argc, char **argv) | |||
19 | int fd; | 19 | int fd; |
20 | unsigned flags; | 20 | unsigned flags; |
21 | 21 | ||
22 | flags = getopt32(argc, argv, "etv"); | 22 | flags = getopt32(argv, "etv"); |
23 | #define CATV_OPT_e (1<<0) | 23 | #define CATV_OPT_e (1<<0) |
24 | #define CATV_OPT_t (1<<1) | 24 | #define CATV_OPT_t (1<<1) |
25 | #define CATV_OPT_v (1<<2) | 25 | #define CATV_OPT_v (1<<2) |
diff --git a/coreutils/chmod.c b/coreutils/chmod.c index 52cc40d97..8b214991a 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c | |||
@@ -93,7 +93,7 @@ int chmod_main(int argc, char **argv) | |||
93 | 93 | ||
94 | /* Parse options */ | 94 | /* Parse options */ |
95 | opt_complementary = "-2"; | 95 | opt_complementary = "-2"; |
96 | getopt32(argc, argv, ("-"OPT_STR) + 1); /* Reuse string */ | 96 | getopt32(argv, ("-"OPT_STR) + 1); /* Reuse string */ |
97 | argv += optind; | 97 | argv += optind; |
98 | 98 | ||
99 | /* Restore option-like mode if needed */ | 99 | /* Restore option-like mode if needed */ |
diff --git a/coreutils/chown.c b/coreutils/chown.c index eb8d8c450..cfd373456 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -69,7 +69,7 @@ int chown_main(int argc, char **argv) | |||
69 | chown_fptr chown_func; | 69 | chown_fptr chown_func; |
70 | 70 | ||
71 | opt_complementary = "-2"; | 71 | opt_complementary = "-2"; |
72 | getopt32(argc, argv, OPT_STR); | 72 | getopt32(argv, OPT_STR); |
73 | argv += optind; | 73 | argv += optind; |
74 | 74 | ||
75 | /* This matches coreutils behavior (almost - see below) */ | 75 | /* This matches coreutils behavior (almost - see below) */ |
diff --git a/coreutils/comm.c b/coreutils/comm.c index 3be6760dc..a4ab14826 100644 --- a/coreutils/comm.c +++ b/coreutils/comm.c | |||
@@ -47,7 +47,7 @@ int comm_main(int argc, char **argv) | |||
47 | unsigned flags; | 47 | unsigned flags; |
48 | 48 | ||
49 | opt_complementary = "=2"; | 49 | opt_complementary = "=2"; |
50 | flags = getopt32(argc, argv, "123"); | 50 | flags = getopt32(argv, "123"); |
51 | argv += optind; | 51 | argv += optind; |
52 | 52 | ||
53 | for (i = 0; i < 2; ++i) { | 53 | for (i = 0; i < 2; ++i) { |
diff --git a/coreutils/cp.c b/coreutils/cp.c index 78bd73c0f..884fbf70f 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
@@ -45,7 +45,7 @@ int cp_main(int argc, char **argv) | |||
45 | // -r and -R are the same | 45 | // -r and -R are the same |
46 | // -a = -pdR | 46 | // -a = -pdR |
47 | opt_complementary = "l--s:s--l:Pd:rR:apdR"; | 47 | opt_complementary = "l--s:s--l:Pd:rR:apdR"; |
48 | flags = getopt32(argc, argv, FILEUTILS_CP_OPTSTR "arPHL"); | 48 | flags = getopt32(argv, FILEUTILS_CP_OPTSTR "arPHL"); |
49 | /* Default behavior of cp is to dereference, so we don't have to do | 49 | /* Default behavior of cp is to dereference, so we don't have to do |
50 | * anything special when we are given -L. | 50 | * anything special when we are given -L. |
51 | * The behavior of -H is *almost* like -L, but not quite, so let's | 51 | * The behavior of -H is *almost* like -L, but not quite, so let's |
diff --git a/coreutils/cut.c b/coreutils/cut.c index 2598a9a7c..1cf49c2af 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -171,7 +171,7 @@ int cut_main(int argc, char **argv) | |||
171 | char *sopt, *ltok; | 171 | char *sopt, *ltok; |
172 | 172 | ||
173 | opt_complementary = "b--bcf:c--bcf:f--bcf"; | 173 | opt_complementary = "b--bcf:c--bcf:f--bcf"; |
174 | getopt32(argc, argv, optstring, &sopt, &sopt, &sopt, <ok); | 174 | getopt32(argv, optstring, &sopt, &sopt, &sopt, <ok); |
175 | // argc -= optind; | 175 | // argc -= optind; |
176 | argv += optind; | 176 | argv += optind; |
177 | if (!(option_mask32 & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) | 177 | if (!(option_mask32 & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) |
diff --git a/coreutils/date.c b/coreutils/date.c index 5ee70f703..e33a9777d 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -53,7 +53,7 @@ int date_main(int argc, char **argv) | |||
53 | 53 | ||
54 | opt_complementary = "d--s:s--d" | 54 | opt_complementary = "d--s:s--d" |
55 | USE_FEATURE_DATE_ISOFMT(":R--I:I--R"); | 55 | USE_FEATURE_DATE_ISOFMT(":R--I:I--R"); |
56 | opt = getopt32(argc, argv, "Rs:ud:r:" | 56 | opt = getopt32(argv, "Rs:ud:r:" |
57 | USE_FEATURE_DATE_ISOFMT("I::D:"), | 57 | USE_FEATURE_DATE_ISOFMT("I::D:"), |
58 | &date_str, &date_str, &filename | 58 | &date_str, &date_str, &filename |
59 | USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg)); | 59 | USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg)); |
diff --git a/coreutils/df.c b/coreutils/df.c index fba59e791..7eb82cd46 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -47,7 +47,7 @@ int df_main(int argc, char **argv) | |||
47 | 47 | ||
48 | #if ENABLE_FEATURE_HUMAN_READABLE | 48 | #if ENABLE_FEATURE_HUMAN_READABLE |
49 | opt_complementary = "h-km:k-hm:m-hk"; | 49 | opt_complementary = "h-km:k-hm:m-hk"; |
50 | opt = getopt32(argc, argv, "hmk"); | 50 | opt = getopt32(argv, "hmk"); |
51 | if (opt & 1) { | 51 | if (opt & 1) { |
52 | df_disp_hr = 0; | 52 | df_disp_hr = 0; |
53 | disp_units_hdr = " Size"; | 53 | disp_units_hdr = " Size"; |
@@ -57,7 +57,7 @@ int df_main(int argc, char **argv) | |||
57 | disp_units_hdr = "1M-blocks"; | 57 | disp_units_hdr = "1M-blocks"; |
58 | } | 58 | } |
59 | #else | 59 | #else |
60 | opt = getopt32(argc, argv, "k"); | 60 | opt = getopt32(argv, "k"); |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n", | 63 | printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n", |
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index 1bfdf0cde..28110980a 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c | |||
@@ -92,7 +92,7 @@ int dos2unix_main(int argc, char **argv) | |||
92 | 92 | ||
93 | /* -u convert to unix, -d convert to dos */ | 93 | /* -u convert to unix, -d convert to dos */ |
94 | opt_complementary = "u--d:d--u"; /* mutually exclusive */ | 94 | opt_complementary = "u--d:d--u"; /* mutually exclusive */ |
95 | o = getopt32(argc, argv, "du"); | 95 | o = getopt32(argv, "du"); |
96 | 96 | ||
97 | /* Do the conversion requested by an argument else do the default | 97 | /* Do the conversion requested by an argument else do the default |
98 | * conversion depending on our name. */ | 98 | * conversion depending on our name. */ |
diff --git a/coreutils/du.c b/coreutils/du.c index 19748719a..757fa14cc 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -170,7 +170,7 @@ int du_main(int argc, char **argv) | |||
170 | */ | 170 | */ |
171 | #if ENABLE_FEATURE_HUMAN_READABLE | 171 | #if ENABLE_FEATURE_HUMAN_READABLE |
172 | opt_complementary = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; | 172 | opt_complementary = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; |
173 | opt = getopt32(argc, argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth); | 173 | opt = getopt32(argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth); |
174 | if (opt & (1 << 9)) { | 174 | if (opt & (1 << 9)) { |
175 | /* -h opt */ | 175 | /* -h opt */ |
176 | disp_hr = 0; | 176 | disp_hr = 0; |
@@ -185,7 +185,7 @@ int du_main(int argc, char **argv) | |||
185 | } | 185 | } |
186 | #else | 186 | #else |
187 | opt_complementary = "H-L:L-H:s-d:d-s"; | 187 | opt_complementary = "H-L:L-H:s-d:d-s"; |
188 | opt = getopt32(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth); | 188 | opt = getopt32(argv, "aHkLsx" "d:" "lc", &smax_print_depth); |
189 | #if !ENABLE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K | 189 | #if !ENABLE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K |
190 | if (opt & (1 << 2)) { | 190 | if (opt & (1 << 2)) { |
191 | /* -k opt */ | 191 | /* -k opt */ |
diff --git a/coreutils/env.c b/coreutils/env.c index dc8667181..8d2d881fa 100644 --- a/coreutils/env.c +++ b/coreutils/env.c | |||
@@ -54,7 +54,7 @@ int env_main(int argc, char** argv) | |||
54 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS | 54 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS |
55 | applet_long_options = env_longopts; | 55 | applet_long_options = env_longopts; |
56 | #endif | 56 | #endif |
57 | opt = getopt32(argc, argv, "+iu:", &unset_env); | 57 | opt = getopt32(argv, "+iu:", &unset_env); |
58 | argv += optind; | 58 | argv += optind; |
59 | if (*argv && LONE_DASH(argv[0])) { | 59 | if (*argv && LONE_DASH(argv[0])) { |
60 | opt |= 1; | 60 | opt |= 1; |
diff --git a/coreutils/expand.c b/coreutils/expand.c index 4b5fa1038..274753fd4 100644 --- a/coreutils/expand.c +++ b/coreutils/expand.c | |||
@@ -153,12 +153,12 @@ int expand_main(int argc, char **argv) | |||
153 | 153 | ||
154 | if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e')) { | 154 | if (ENABLE_EXPAND && (!ENABLE_UNEXPAND || applet_name[0] == 'e')) { |
155 | USE_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts); | 155 | USE_FEATURE_EXPAND_LONG_OPTIONS(applet_long_options = expand_longopts); |
156 | opt = getopt32(argc, argv, "it:", &opt_t); | 156 | opt = getopt32(argv, "it:", &opt_t); |
157 | } else if (ENABLE_UNEXPAND) { | 157 | } else if (ENABLE_UNEXPAND) { |
158 | USE_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts); | 158 | USE_FEATURE_UNEXPAND_LONG_OPTIONS(applet_long_options = unexpand_longopts); |
159 | /* -t NUM sets also -a */ | 159 | /* -t NUM sets also -a */ |
160 | opt_complementary = "ta"; | 160 | opt_complementary = "ta"; |
161 | opt = getopt32(argc, argv, "ft:a", &opt_t); | 161 | opt = getopt32(argv, "ft:a", &opt_t); |
162 | /* -f --first-only is the default */ | 162 | /* -f --first-only is the default */ |
163 | if (!(opt & OPT_ALL)) opt |= OPT_INITIAL; | 163 | if (!(opt & OPT_ALL)) opt |= OPT_INITIAL; |
164 | } | 164 | } |
diff --git a/coreutils/fold.c b/coreutils/fold.c index 11b880969..01849615e 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c | |||
@@ -63,7 +63,7 @@ int fold_main(int argc, char **argv) | |||
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | flags = getopt32(argc, argv, "bsw:", &w_opt); | 66 | flags = getopt32(argv, "bsw:", &w_opt); |
67 | if (flags & FLAG_WIDTH) | 67 | if (flags & FLAG_WIDTH) |
68 | width = xatoul_range(w_opt, 1, 10000); | 68 | width = xatoul_range(w_opt, 1, 10000); |
69 | 69 | ||
diff --git a/coreutils/id.c b/coreutils/id.c index 614d6d064..1cc8c4d1d 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -50,7 +50,7 @@ int id_main(int argc, char **argv) | |||
50 | /* Don't allow -n -r -nr -ug -rug -nug -rnug */ | 50 | /* Don't allow -n -r -nr -ug -rug -nug -rnug */ |
51 | /* Don't allow more than one username */ | 51 | /* Don't allow more than one username */ |
52 | opt_complementary = "?1:u--g:g--u:r?ug:n?ug" USE_SELINUX(":u--Z:Z--u:g--Z:Z--g"); | 52 | opt_complementary = "?1:u--g:g--u:r?ug:n?ug" USE_SELINUX(":u--Z:Z--u:g--Z:Z--g"); |
53 | flags = getopt32(argc, argv, "rnug" USE_SELINUX("Z")); | 53 | flags = getopt32(argv, "rnug" USE_SELINUX("Z")); |
54 | 54 | ||
55 | /* This values could be overwritten later */ | 55 | /* This values could be overwritten later */ |
56 | uid = geteuid(); | 56 | uid = geteuid(); |
diff --git a/coreutils/install.c b/coreutils/install.c index 79cd02036..cf62a0022 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -101,7 +101,7 @@ int install_main(int argc, char **argv) | |||
101 | opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z"); | 101 | opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z"); |
102 | /* -c exists for backwards compatibility, it's needed */ | 102 | /* -c exists for backwards compatibility, it's needed */ |
103 | 103 | ||
104 | flags = getopt32(argc, argv, "cdpsg:m:o:" USE_SELINUX("Z:"), | 104 | flags = getopt32(argv, "cdpsg:m:o:" USE_SELINUX("Z:"), |
105 | &gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext)); | 105 | &gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext)); |
106 | 106 | ||
107 | #if ENABLE_SELINUX | 107 | #if ENABLE_SELINUX |
diff --git a/coreutils/libcoreutils/getopt_mk_fifo_nod.c b/coreutils/libcoreutils/getopt_mk_fifo_nod.c index 6fd2de73f..377621568 100644 --- a/coreutils/libcoreutils/getopt_mk_fifo_nod.c +++ b/coreutils/libcoreutils/getopt_mk_fifo_nod.c | |||
@@ -31,7 +31,7 @@ mode_t getopt_mk_fifo_nod(int argc, char **argv) | |||
31 | security_context_t scontext; | 31 | security_context_t scontext; |
32 | #endif | 32 | #endif |
33 | int opt; | 33 | int opt; |
34 | opt = getopt32(argc, argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); | 34 | opt = getopt32(argv, "m:" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); |
35 | if (opt & 1) { | 35 | if (opt & 1) { |
36 | if (bb_parse_mode(smode, &mode)) | 36 | if (bb_parse_mode(smode, &mode)) |
37 | umask(0); | 37 | umask(0); |
diff --git a/coreutils/ln.c b/coreutils/ln.c index cffd4fdb5..a6499039e 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -34,7 +34,7 @@ int ln_main(int argc, char **argv) | |||
34 | struct stat statbuf; | 34 | struct stat statbuf; |
35 | int (*link_func)(const char *, const char *); | 35 | int (*link_func)(const char *, const char *); |
36 | 36 | ||
37 | flag = getopt32(argc, argv, "sfnbS:", &suffix); | 37 | flag = getopt32(argv, "sfnbS:", &suffix); |
38 | 38 | ||
39 | if (argc == optind) { | 39 | if (argc == optind) { |
40 | bb_show_usage(); | 40 | bb_show_usage(); |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 2b2925557..4adf523d3 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -820,14 +820,14 @@ int ls_main(int argc, char **argv) | |||
820 | /* process options */ | 820 | /* process options */ |
821 | USE_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;) | 821 | USE_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;) |
822 | #if ENABLE_FEATURE_AUTOWIDTH | 822 | #if ENABLE_FEATURE_AUTOWIDTH |
823 | opt = getopt32(argc, argv, ls_options, &tabstops_str, &terminal_width_str | 823 | opt = getopt32(argv, ls_options, &tabstops_str, &terminal_width_str |
824 | USE_FEATURE_LS_COLOR(, &color_opt)); | 824 | USE_FEATURE_LS_COLOR(, &color_opt)); |
825 | if (tabstops_str) | 825 | if (tabstops_str) |
826 | tabstops = xatou(tabstops_str); | 826 | tabstops = xatou(tabstops_str); |
827 | if (terminal_width_str) | 827 | if (terminal_width_str) |
828 | terminal_width = xatou(terminal_width_str); | 828 | terminal_width = xatou(terminal_width_str); |
829 | #else | 829 | #else |
830 | opt = getopt32(argc, argv, ls_options USE_FEATURE_LS_COLOR(, &color_opt)); | 830 | opt = getopt32(argv, ls_options USE_FEATURE_LS_COLOR(, &color_opt)); |
831 | #endif | 831 | #endif |
832 | for (i = 0; opt_flags[i] != (1U<<31); i++) { | 832 | for (i = 0; opt_flags[i] != (1U<<31); i++) { |
833 | if (opt & (1 << i)) { | 833 | if (opt & (1 << i)) { |
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 8bc203486..7f8b08497 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -88,7 +88,7 @@ int md5_sha1_sum_main(int argc, char **argv) | |||
88 | : HASH_SHA1; | 88 | : HASH_SHA1; |
89 | 89 | ||
90 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) | 90 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) |
91 | flags = getopt32(argc, argv, "scw"); | 91 | flags = getopt32(argv, "scw"); |
92 | else optind = 1; | 92 | else optind = 1; |
93 | 93 | ||
94 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) { | 94 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) { |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 22a070c31..d1a4380ad 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -49,7 +49,7 @@ int mkdir_main(int argc, char **argv) | |||
49 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS | 49 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS |
50 | applet_long_options = mkdir_longopts; | 50 | applet_long_options = mkdir_longopts; |
51 | #endif | 51 | #endif |
52 | opt = getopt32(argc, argv, "m:p" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); | 52 | opt = getopt32(argv, "m:p" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); |
53 | if (opt & 1) { | 53 | if (opt & 1) { |
54 | mode = 0777; | 54 | mode = 0777; |
55 | if (!bb_parse_mode(smode, &mode)) { | 55 | if (!bb_parse_mode(smode, &mode)) { |
diff --git a/coreutils/mv.c b/coreutils/mv.c index 4cd0fcfba..553bb6ecb 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -48,7 +48,7 @@ int mv_main(int argc, char **argv) | |||
48 | applet_long_options = mv_longopts; | 48 | applet_long_options = mv_longopts; |
49 | #endif | 49 | #endif |
50 | opt_complementary = "f-i:i-f"; | 50 | opt_complementary = "f-i:i-f"; |
51 | flags = getopt32(argc, argv, "fi"); | 51 | flags = getopt32(argv, "fi"); |
52 | if (optind + 2 > argc) { | 52 | if (optind + 2 > argc) { |
53 | bb_show_usage(); | 53 | bb_show_usage(); |
54 | } | 54 | } |
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index d3c9f9a17..8174ab6c9 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -1259,7 +1259,7 @@ int od_main(int argc, char **argv) | |||
1259 | #if ENABLE_GETOPT_LONG | 1259 | #if ENABLE_GETOPT_LONG |
1260 | applet_long_options = od_longopts; | 1260 | applet_long_options = od_longopts; |
1261 | #endif | 1261 | #endif |
1262 | opt = getopt32(argc, argv, "A:N:abcdfhij:lot:vxsS:" | 1262 | opt = getopt32(argv, "A:N:abcdfhij:lot:vxsS:" |
1263 | "w::", // -w with optional param | 1263 | "w::", // -w with optional param |
1264 | // -S was -s and also had optional parameter | 1264 | // -S was -s and also had optional parameter |
1265 | // but in coreutils 6.3 it was renamed and now has | 1265 | // but in coreutils 6.3 it was renamed and now has |
diff --git a/coreutils/readlink.c b/coreutils/readlink.c index d454cbf19..39edc0569 100644 --- a/coreutils/readlink.c +++ b/coreutils/readlink.c | |||
@@ -21,7 +21,7 @@ int readlink_main(int argc, char **argv) | |||
21 | unsigned opt; | 21 | unsigned opt; |
22 | /* We need exactly one non-option argument. */ | 22 | /* We need exactly one non-option argument. */ |
23 | opt_complementary = "=1"; | 23 | opt_complementary = "=1"; |
24 | opt = getopt32(argc, argv, "f"); | 24 | opt = getopt32(argv, "f"); |
25 | fname = argv[optind]; | 25 | fname = argv[optind]; |
26 | ) | 26 | ) |
27 | SKIP_FEATURE_READLINK_FOLLOW( | 27 | SKIP_FEATURE_READLINK_FOLLOW( |
diff --git a/coreutils/rm.c b/coreutils/rm.c index cc2264770..ba37762a8 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -27,7 +27,7 @@ int rm_main(int argc, char **argv) | |||
27 | unsigned opt; | 27 | unsigned opt; |
28 | 28 | ||
29 | opt_complementary = "f-i:i-f"; | 29 | opt_complementary = "f-i:i-f"; |
30 | opt = getopt32(argc, argv, "fiRr"); | 30 | opt = getopt32(argv, "fiRr"); |
31 | argv += optind; | 31 | argv += optind; |
32 | if (opt & 1) | 32 | if (opt & 1) |
33 | flags |= FILEUTILS_FORCE; | 33 | flags |= FILEUTILS_FORCE; |
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index c1b89e427..315401e0e 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -24,7 +24,7 @@ int rmdir_main(int argc, char **argv) | |||
24 | int do_dot; | 24 | int do_dot; |
25 | char *path; | 25 | char *path; |
26 | 26 | ||
27 | flags = getopt32(argc, argv, "p"); | 27 | flags = getopt32(argv, "p"); |
28 | argv += optind; | 28 | argv += optind; |
29 | 29 | ||
30 | if (!*argv) { | 30 | if (!*argv) { |
diff --git a/coreutils/sort.c b/coreutils/sort.c index 98c1bc34a..311c774ae 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -290,7 +290,7 @@ int sort_main(int argc, char **argv) | |||
290 | /* -o and -t can be given at most once */ | 290 | /* -o and -t can be given at most once */ |
291 | opt_complementary = "o--o:t--t:" /* -t, -o: maximum one of each */ | 291 | opt_complementary = "o--o:t--t:" /* -t, -o: maximum one of each */ |
292 | "k::"; /* -k takes list */ | 292 | "k::"; /* -k takes list */ |
293 | getopt32(argc, argv, OPT_STR, &str_ignored, &str_ignored, &str_o, &lst_k, &str_t); | 293 | getopt32(argv, OPT_STR, &str_ignored, &str_ignored, &str_o, &lst_k, &str_t); |
294 | #if ENABLE_FEATURE_SORT_BIG | 294 | #if ENABLE_FEATURE_SORT_BIG |
295 | if (option_mask32 & FLAG_o) outfile = xfopen(str_o, "w"); | 295 | if (option_mask32 & FLAG_o) outfile = xfopen(str_o, "w"); |
296 | if (option_mask32 & FLAG_t) { | 296 | if (option_mask32 & FLAG_t) { |
diff --git a/coreutils/split.c b/coreutils/split.c index d1eb82955..3ec539a6a 100644 --- a/coreutils/split.c +++ b/coreutils/split.c | |||
@@ -69,7 +69,7 @@ int split_main(int argc, char **argv) | |||
69 | char *src; | 69 | char *src; |
70 | 70 | ||
71 | opt_complementary = "?2"; | 71 | opt_complementary = "?2"; |
72 | opt = getopt32(argc, argv, "l:b:a:", &count_p, &count_p, &sfx); | 72 | opt = getopt32(argv, "l:b:a:", &count_p, &count_p, &sfx); |
73 | 73 | ||
74 | if (opt & SPLIT_OPT_l) | 74 | if (opt & SPLIT_OPT_l) |
75 | cnt = xatoul(count_p); | 75 | cnt = xatoul(count_p); |
diff --git a/coreutils/stat.c b/coreutils/stat.c index 0fddea2bb..18e8e076c 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -614,7 +614,7 @@ int stat_main(int argc, char **argv) | |||
614 | int ok = 1; | 614 | int ok = 1; |
615 | bool (*statfunc)(char const *, char const *) = do_stat; | 615 | bool (*statfunc)(char const *, char const *) = do_stat; |
616 | 616 | ||
617 | getopt32(argc, argv, "ftL" | 617 | getopt32(argv, "ftL" |
618 | USE_SELINUX("Z") | 618 | USE_SELINUX("Z") |
619 | USE_FEATURE_STAT_FORMAT("c:", &format) | 619 | USE_FEATURE_STAT_FORMAT("c:", &format) |
620 | ); | 620 | ); |
diff --git a/coreutils/sum.c b/coreutils/sum.c index 5799d142d..4a3760bb4 100644 --- a/coreutils/sum.c +++ b/coreutils/sum.c | |||
@@ -80,7 +80,7 @@ int sum_main(int argc, char **argv) | |||
80 | unsigned n; | 80 | unsigned n; |
81 | unsigned type = SUM_BSD; | 81 | unsigned type = SUM_BSD; |
82 | 82 | ||
83 | n = getopt32(argc, argv, "sr"); | 83 | n = getopt32(argv, "sr"); |
84 | if (n & 1) type = SUM_SYSV; | 84 | if (n & 1) type = SUM_SYSV; |
85 | /* give the bsd priority over sysv func */ | 85 | /* give the bsd priority over sysv func */ |
86 | if (n & 2) type = SUM_BSD; | 86 | if (n & 2) type = SUM_BSD; |
diff --git a/coreutils/tail.c b/coreutils/tail.c index ec21c4234..74e14232d 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -107,7 +107,7 @@ int tail_main(int argc, char **argv) | |||
107 | } | 107 | } |
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | opt = getopt32(argc, argv, "fc:n:" USE_FEATURE_FANCY_TAIL("qs:v"), | 110 | opt = getopt32(argv, "fc:n:" USE_FEATURE_FANCY_TAIL("qs:v"), |
111 | &str_c, &str_n USE_FEATURE_FANCY_TAIL(,&str_s)); | 111 | &str_c, &str_n USE_FEATURE_FANCY_TAIL(,&str_s)); |
112 | #define FOLLOW (opt & 0x1) | 112 | #define FOLLOW (opt & 0x1) |
113 | #define COUNT_BYTES (opt & 0x2) | 113 | #define COUNT_BYTES (opt & 0x2) |
diff --git a/coreutils/tee.c b/coreutils/tee.c index 2160141c9..d253028cc 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -28,7 +28,7 @@ int tee_main(int argc, char **argv) | |||
28 | #else | 28 | #else |
29 | int c; | 29 | int c; |
30 | #endif | 30 | #endif |
31 | retval = getopt32(argc, argv, "ia"); /* 'a' must be 2nd */ | 31 | retval = getopt32(argv, "ia"); /* 'a' must be 2nd */ |
32 | argc -= optind; | 32 | argc -= optind; |
33 | argv += optind; | 33 | argv += optind; |
34 | 34 | ||
diff --git a/coreutils/touch.c b/coreutils/touch.c index 7b82339fc..7a1dd3599 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -26,7 +26,7 @@ int touch_main(int argc, char **argv) | |||
26 | { | 26 | { |
27 | int fd; | 27 | int fd; |
28 | int status = EXIT_SUCCESS; | 28 | int status = EXIT_SUCCESS; |
29 | int flags = getopt32(argc, argv, "c"); | 29 | int flags = getopt32(argv, "c"); |
30 | 30 | ||
31 | argv += optind; | 31 | argv += optind; |
32 | 32 | ||
diff --git a/coreutils/tty.c b/coreutils/tty.c index 2c77c9960..d8ce78c00 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c | |||
@@ -21,7 +21,7 @@ int tty_main(int argc, char **argv) | |||
21 | 21 | ||
22 | xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */ | 22 | xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */ |
23 | 23 | ||
24 | USE_INCLUDE_SUSv2(silent = getopt32(argc, argv, "s");) | 24 | USE_INCLUDE_SUSv2(silent = getopt32(argv, "s");) |
25 | 25 | ||
26 | /* gnu tty outputs a warning that it is ignoring all args. */ | 26 | /* gnu tty outputs a warning that it is ignoring all args. */ |
27 | bb_warn_ignoring_args(argc - optind); | 27 | bb_warn_ignoring_args(argc - optind); |
diff --git a/coreutils/uname.c b/coreutils/uname.c index 8f07f1960..e4724c8f1 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c | |||
@@ -58,7 +58,7 @@ int uname_main(int argc, char **argv) | |||
58 | const unsigned short int *delta; | 58 | const unsigned short int *delta; |
59 | char toprint; | 59 | char toprint; |
60 | 60 | ||
61 | toprint = getopt32(argc, argv, options); | 61 | toprint = getopt32(argv, options); |
62 | 62 | ||
63 | if (argc != optind) { | 63 | if (argc != optind) { |
64 | bb_show_usage(); | 64 | bb_show_usage(); |
diff --git a/coreutils/uniq.c b/coreutils/uniq.c index a7caef991..719bbb5e3 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c | |||
@@ -45,7 +45,7 @@ int uniq_main(int argc, char **argv) | |||
45 | 45 | ||
46 | skip_fields = skip_chars = 0; | 46 | skip_fields = skip_chars = 0; |
47 | 47 | ||
48 | opt = getopt32(argc, argv, "cduf:s:", &s0, &s1); | 48 | opt = getopt32(argv, "cduf:s:", &s0, &s1); |
49 | if (opt & OPT_f) | 49 | if (opt & OPT_f) |
50 | skip_fields = xatoul(s0); | 50 | skip_fields = xatoul(s0); |
51 | if (opt & OPT_s) | 51 | if (opt & OPT_s) |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 2dd8f9457..4c918ff02 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -134,7 +134,7 @@ int uudecode_main(int argc, char **argv) | |||
134 | char *line; | 134 | char *line; |
135 | 135 | ||
136 | opt_complementary = "?1"; /* 1 argument max */ | 136 | opt_complementary = "?1"; /* 1 argument max */ |
137 | getopt32(argc, argv, "o:", &outname); | 137 | getopt32(argv, "o:", &outname); |
138 | argv += optind; | 138 | argv += optind; |
139 | 139 | ||
140 | if (argv[0]) | 140 | if (argv[0]) |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index c1458f7fb..56d68820e 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -28,7 +28,7 @@ int uuencode_main(int argc, char **argv) | |||
28 | tbl = bb_uuenc_tbl_std; | 28 | tbl = bb_uuenc_tbl_std; |
29 | mode = 0666 & ~umask(0666); | 29 | mode = 0666 & ~umask(0666); |
30 | opt_complementary = "-1:?2"; /* must have 1 or 2 args */ | 30 | opt_complementary = "-1:?2"; /* must have 1 or 2 args */ |
31 | if (getopt32(argc, argv, "m")) { | 31 | if (getopt32(argv, "m")) { |
32 | tbl = bb_uuenc_tbl_base64; | 32 | tbl = bb_uuenc_tbl_base64; |
33 | } | 33 | } |
34 | argv += optind; | 34 | argv += optind; |
diff --git a/coreutils/wc.c b/coreutils/wc.c index 627267d42..e86b7d4d2 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -86,7 +86,7 @@ int wc_main(int argc, char **argv) | |||
86 | smallint in_word; | 86 | smallint in_word; |
87 | unsigned print_type; | 87 | unsigned print_type; |
88 | 88 | ||
89 | print_type = getopt32(argc, argv, "lwcL"); | 89 | print_type = getopt32(argv, "lwcL"); |
90 | 90 | ||
91 | if (print_type == 0) { | 91 | if (print_type == 0) { |
92 | print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); | 92 | print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); |
diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c index 9e7ef7b4c..1c71c2e43 100644 --- a/debianutils/mktemp.c +++ b/debianutils/mktemp.c | |||
@@ -14,7 +14,7 @@ | |||
14 | int mktemp_main(int argc, char **argv); | 14 | int mktemp_main(int argc, char **argv); |
15 | int mktemp_main(int argc, char **argv) | 15 | int mktemp_main(int argc, char **argv) |
16 | { | 16 | { |
17 | unsigned long flags = getopt32(argc, argv, "dqt"); | 17 | unsigned long flags = getopt32(argv, "dqt"); |
18 | char *chp; | 18 | char *chp; |
19 | 19 | ||
20 | if (optind + 1 != argc) | 20 | if (optind + 1 != argc) |
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index 5066742cf..0104eb111 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c | |||
@@ -121,7 +121,7 @@ int run_parts_main(int argc, char **argv) | |||
121 | #if ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS | 121 | #if ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS |
122 | applet_long_options = runparts_longopts; | 122 | applet_long_options = runparts_longopts; |
123 | #endif | 123 | #endif |
124 | tmp = getopt32(argc, argv, "a:u:t"USE_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p); | 124 | tmp = getopt32(argv, "a:u:t"USE_FEATURE_RUN_PARTS_FANCY("l"), &arg_list, &umask_p); |
125 | G.mode = tmp &~ (RUN_PARTS_OPT_a|RUN_PARTS_OPT_u); | 125 | G.mode = tmp &~ (RUN_PARTS_OPT_a|RUN_PARTS_OPT_u); |
126 | if (tmp & RUN_PARTS_OPT_u) { | 126 | if (tmp & RUN_PARTS_OPT_u) { |
127 | /* Check and set the umask of the program executed. | 127 | /* Check and set the umask of the program executed. |
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index f24168e33..7633cb057 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c | |||
@@ -252,7 +252,7 @@ int start_stop_daemon_main(int argc, char **argv) | |||
252 | 252 | ||
253 | /* Check required one context option was given */ | 253 | /* Check required one context option was given */ |
254 | opt_complementary = "K:S:K--S:S--K:m?p:K?xpun:S?xa"; | 254 | opt_complementary = "K:S:K--S:S--K:m?p:K?xpun:S?xa"; |
255 | opt = getopt32(argc, argv, "KSbqma:n:s:u:c:x:p:" | 255 | opt = getopt32(argv, "KSbqma:n:s:u:c:x:p:" |
256 | USE_FEATURE_START_STOP_DAEMON_FANCY("ovN:"), | 256 | USE_FEATURE_START_STOP_DAEMON_FANCY("ovN:"), |
257 | // USE_FEATURE_START_STOP_DAEMON_FANCY("ovN:R:"), | 257 | // USE_FEATURE_START_STOP_DAEMON_FANCY("ovN:R:"), |
258 | &startas, &cmdname, &signame, &userspec, &chuid, &execname, &pidfile | 258 | &startas, &cmdname, &signame, &userspec, &chuid, &execname, &pidfile |
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c index fbfbea2bc..dd6efc812 100644 --- a/e2fsprogs/lsattr.c +++ b/e2fsprogs/lsattr.c | |||
@@ -98,7 +98,7 @@ static void lsattr_args(const char *name) | |||
98 | int lsattr_main(int argc, char **argv); | 98 | int lsattr_main(int argc, char **argv); |
99 | int lsattr_main(int argc, char **argv) | 99 | int lsattr_main(int argc, char **argv) |
100 | { | 100 | { |
101 | getopt32(argc, argv, "Radlv"); | 101 | getopt32(argv, "Radlv"); |
102 | argv += optind; | 102 | argv += optind; |
103 | 103 | ||
104 | if (!*argv) | 104 | if (!*argv) |
diff --git a/e2fsprogs/old_e2fsprogs/lsattr.c b/e2fsprogs/old_e2fsprogs/lsattr.c index b418f6bad..920146496 100644 --- a/e2fsprogs/old_e2fsprogs/lsattr.c +++ b/e2fsprogs/old_e2fsprogs/lsattr.c | |||
@@ -117,7 +117,7 @@ int lsattr_main(int argc, char **argv) | |||
117 | { | 117 | { |
118 | int i; | 118 | int i; |
119 | 119 | ||
120 | flags = getopt32(argc, argv, "Radlv"); | 120 | flags = getopt32(argv, "Radlv"); |
121 | 121 | ||
122 | if (optind > argc - 1) | 122 | if (optind > argc - 1) |
123 | lsattr_args("."); | 123 | lsattr_args("."); |
diff --git a/editors/awk.c b/editors/awk.c index 4ec3d4652..a820c7a17 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -2817,7 +2817,7 @@ int awk_main(int argc, char **argv) | |||
2817 | } | 2817 | } |
2818 | } | 2818 | } |
2819 | opt_complementary = "v::"; | 2819 | opt_complementary = "v::"; |
2820 | opt = getopt32(argc, argv, "F:v:f:W:", &opt_F, &opt_v, &g_progname, &opt_W); | 2820 | opt = getopt32(argv, "F:v:f:W:", &opt_F, &opt_v, &g_progname, &opt_W); |
2821 | argv += optind; | 2821 | argv += optind; |
2822 | argc -= optind; | 2822 | argc -= optind; |
2823 | if (opt & 0x1) | 2823 | if (opt & 0x1) |
diff --git a/editors/cmp.c b/editors/cmp.c index ffdfb9103..34a0de50a 100644 --- a/editors/cmp.c +++ b/editors/cmp.c | |||
@@ -61,7 +61,7 @@ int cmp_main(int argc, char **argv) | |||
61 | USE_DESKTOP(":?4") | 61 | USE_DESKTOP(":?4") |
62 | SKIP_DESKTOP(":?2") | 62 | SKIP_DESKTOP(":?2") |
63 | ":l--s:s--l"; | 63 | ":l--s:s--l"; |
64 | opt = getopt32(argc, argv, opt_chars); | 64 | opt = getopt32(argv, opt_chars); |
65 | argv += optind; | 65 | argv += optind; |
66 | 66 | ||
67 | filename1 = *argv; | 67 | filename1 = *argv; |
diff --git a/editors/diff.c b/editors/diff.c index 41808b1ac..3a694e087 100644 --- a/editors/diff.c +++ b/editors/diff.c | |||
@@ -1219,7 +1219,7 @@ int diff_main(int argc, char **argv) | |||
1219 | 1219 | ||
1220 | /* exactly 2 params; collect multiple -L <label> */ | 1220 | /* exactly 2 params; collect multiple -L <label> */ |
1221 | opt_complementary = "=2:L::"; | 1221 | opt_complementary = "=2:L::"; |
1222 | getopt32(argc, argv, "abdiL:NqrsS:tTU:wu" | 1222 | getopt32(argv, "abdiL:NqrsS:tTU:wu" |
1223 | "p" /* ignored (for compatibility) */, | 1223 | "p" /* ignored (for compatibility) */, |
1224 | &L_arg, &start, &U_opt); | 1224 | &L_arg, &start, &U_opt); |
1225 | /*argc -= optind;*/ | 1225 | /*argc -= optind;*/ |
diff --git a/editors/patch.c b/editors/patch.c index f071a0854..94f664115 100644 --- a/editors/patch.c +++ b/editors/patch.c | |||
@@ -87,7 +87,7 @@ int patch_main(int argc, char **argv) | |||
87 | 87 | ||
88 | { | 88 | { |
89 | char *p, *i; | 89 | char *p, *i; |
90 | ret = getopt32(argc, argv, "p:i:", &p, &i); | 90 | ret = getopt32(argv, "p:i:", &p, &i); |
91 | if (ret & 1) | 91 | if (ret & 1) |
92 | patch_level = xatol_range(p, -1, USHRT_MAX); | 92 | patch_level = xatol_range(p, -1, USHRT_MAX); |
93 | if (ret & 2) { | 93 | if (ret & 2) { |
diff --git a/editors/sed.c b/editors/sed.c index 01ef93c6c..26fdeafdd 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -1248,7 +1248,7 @@ int sed_main(int argc, char **argv) | |||
1248 | opt_e = opt_f = NULL; | 1248 | opt_e = opt_f = NULL; |
1249 | opt_complementary = "e::f::" /* can occur multiple times */ | 1249 | opt_complementary = "e::f::" /* can occur multiple times */ |
1250 | "nn"; /* count -n */ | 1250 | "nn"; /* count -n */ |
1251 | opt = getopt32(argc, argv, "irne:f:", &opt_e, &opt_f, | 1251 | opt = getopt32(argv, "irne:f:", &opt_e, &opt_f, |
1252 | &G.be_quiet); /* counter for -n */ | 1252 | &G.be_quiet); /* counter for -n */ |
1253 | argc -= optind; | 1253 | argc -= optind; |
1254 | argv += optind; | 1254 | argv += optind; |
diff --git a/findutils/grep.c b/findutils/grep.c index e543ee07f..c45d0ed89 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -389,7 +389,7 @@ int grep_main(int argc, char **argv) | |||
389 | char *Copt; | 389 | char *Copt; |
390 | 390 | ||
391 | opt_complementary = "H-h:e::f::C-AB"; | 391 | opt_complementary = "H-h:e::f::C-AB"; |
392 | getopt32(argc, argv, | 392 | getopt32(argv, |
393 | OPTSTR_GREP, | 393 | OPTSTR_GREP, |
394 | &pattern_head, &fopt, &mopt, | 394 | &pattern_head, &fopt, &mopt, |
395 | &slines_after, &slines_before, &Copt); | 395 | &slines_after, &slines_before, &Copt); |
@@ -419,7 +419,7 @@ int grep_main(int argc, char **argv) | |||
419 | #else | 419 | #else |
420 | /* with auto sanity checks */ | 420 | /* with auto sanity checks */ |
421 | opt_complementary = "H-h:e::f::c-n:q-n:l-n"; | 421 | opt_complementary = "H-h:e::f::c-n:q-n:l-n"; |
422 | getopt32(argc, argv, OPTSTR_GREP, | 422 | getopt32(argv, OPTSTR_GREP, |
423 | &pattern_head, &fopt, &mopt); | 423 | &pattern_head, &fopt, &mopt); |
424 | #endif | 424 | #endif |
425 | if (option_mask32 & OPT_m) { | 425 | if (option_mask32 & OPT_m) { |
diff --git a/findutils/xargs.c b/findutils/xargs.c index 4ca95639a..7a8899631 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -394,7 +394,7 @@ int xargs_main(int argc, char **argv) | |||
394 | #define read_args process_stdin | 394 | #define read_args process_stdin |
395 | #endif | 395 | #endif |
396 | 396 | ||
397 | opt = getopt32(argc, argv, OPTION_STR, &max_args, &max_chars, &eof_str); | 397 | opt = getopt32(argv, OPTION_STR, &max_args, &max_chars, &eof_str); |
398 | 398 | ||
399 | if (opt & OPT_ZEROTERM) | 399 | if (opt & OPT_ZEROTERM) |
400 | USE_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin); | 400 | USE_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin); |
diff --git a/init/halt.c b/init/halt.c index ca5c15340..e21ad57cc 100644 --- a/init/halt.c +++ b/init/halt.c | |||
@@ -35,7 +35,7 @@ RB_AUTOBOOT | |||
35 | for (which = 0; "hpr"[which] != *applet_name; which++); | 35 | for (which = 0; "hpr"[which] != *applet_name; which++); |
36 | 36 | ||
37 | /* Parse and handle arguments */ | 37 | /* Parse and handle arguments */ |
38 | flags = getopt32(argc, argv, "d:nf", &delay); | 38 | flags = getopt32(argv, "d:nf", &delay); |
39 | if (flags & 1) sleep(xatou(delay)); | 39 | if (flags & 1) sleep(xatou(delay)); |
40 | if (!(flags & 2)) sync(); | 40 | if (!(flags & 2)) sync(); |
41 | 41 | ||
diff --git a/ipsvd/tcpudp.c b/ipsvd/tcpudp.c index e46b3c60e..b5c35cc66 100644 --- a/ipsvd/tcpudp.c +++ b/ipsvd/tcpudp.c | |||
@@ -152,12 +152,12 @@ int tcpudpsvd_main(int argc, char **argv) | |||
152 | /* 3+ args, -i at most once, -p implies -h, -v is counter */ | 152 | /* 3+ args, -i at most once, -p implies -h, -v is counter */ |
153 | opt_complementary = "-3:i--i:ph:vv"; | 153 | opt_complementary = "-3:i--i:ph:vv"; |
154 | #ifdef SSLSVD | 154 | #ifdef SSLSVD |
155 | getopt32(argc, argv, "+c:C:i:x:u:l:Eb:hpt:vU:/:Z:K:", | 155 | getopt32(argv, "+c:C:i:x:u:l:Eb:hpt:vU:/:Z:K:", |
156 | &str_c, &str_C, &instructs, &instructs, &user, &local_hostname, | 156 | &str_c, &str_C, &instructs, &instructs, &user, &local_hostname, |
157 | &str_b, &str_t, &ssluser, &root, &cert, &key, &verbose | 157 | &str_b, &str_t, &ssluser, &root, &cert, &key, &verbose |
158 | ); | 158 | ); |
159 | #else | 159 | #else |
160 | getopt32(argc, argv, "+c:C:i:x:u:l:Eb:hpt:v", | 160 | getopt32(argv, "+c:C:i:x:u:l:Eb:hpt:v", |
161 | &str_c, &str_C, &instructs, &instructs, &user, &local_hostname, | 161 | &str_c, &str_C, &instructs, &instructs, &user, &local_hostname, |
162 | &str_b, &str_t, &verbose | 162 | &str_b, &str_t, &verbose |
163 | ); | 163 | ); |
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index 3e1299fc3..3033bf11e 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c | |||
@@ -13,12 +13,12 @@ | |||
13 | /* Documentation | 13 | /* Documentation |
14 | 14 | ||
15 | uint32_t | 15 | uint32_t |
16 | getopt32(int argc, char **argv, const char *applet_opts, ...) | 16 | getopt32(char **argv, const char *applet_opts, ...) |
17 | 17 | ||
18 | The command line options must be declared in const char | 18 | The command line options must be declared in const char |
19 | *applet_opts as a string of chars, for example: | 19 | *applet_opts as a string of chars, for example: |
20 | 20 | ||
21 | flags = getopt32(argc, argv, "rnug"); | 21 | flags = getopt32(argv, "rnug"); |
22 | 22 | ||
23 | If one of the given options is found, a flag value is added to | 23 | If one of the given options is found, a flag value is added to |
24 | the return value (an unsigned long). | 24 | the return value (an unsigned long). |
@@ -26,7 +26,7 @@ getopt32(int argc, char **argv, const char *applet_opts, ...) | |||
26 | The flag value is determined by the position of the char in | 26 | The flag value is determined by the position of the char in |
27 | applet_opts string. For example, in the above case: | 27 | applet_opts string. For example, in the above case: |
28 | 28 | ||
29 | flags = getopt32(argc, argv, "rnug"); | 29 | flags = getopt32(argv, "rnug"); |
30 | 30 | ||
31 | "r" will add 1 (bit 0) | 31 | "r" will add 1 (bit 0) |
32 | "n" will add 2 (bit 1) | 32 | "n" will add 2 (bit 1) |
@@ -52,7 +52,7 @@ getopt32(int argc, char **argv, const char *applet_opts, ...) | |||
52 | char *pointer_to_arg_for_c; | 52 | char *pointer_to_arg_for_c; |
53 | char *pointer_to_arg_for_d; | 53 | char *pointer_to_arg_for_d; |
54 | 54 | ||
55 | flags = getopt32(argc, argv, "a:b:c:d:", | 55 | flags = getopt32(argv, "a:b:c:d:", |
56 | &pointer_to_arg_for_a, &pointer_to_arg_for_b, | 56 | &pointer_to_arg_for_a, &pointer_to_arg_for_b, |
57 | &pointer_to_arg_for_c, &pointer_to_arg_for_d); | 57 | &pointer_to_arg_for_c, &pointer_to_arg_for_d); |
58 | 58 | ||
@@ -105,7 +105,7 @@ const char *opt_complementary | |||
105 | if they are not specifed on the command line. For example: | 105 | if they are not specifed on the command line. For example: |
106 | 106 | ||
107 | opt_complementary = "abc"; | 107 | opt_complementary = "abc"; |
108 | flags = getopt32(argc, argv, "abcd") | 108 | flags = getopt32(argv, "abcd") |
109 | 109 | ||
110 | If getopt() finds "-a" on the command line, then | 110 | If getopt() finds "-a" on the command line, then |
111 | getopt32's return value will be as if "-a -b -c" were | 111 | getopt32's return value will be as if "-a -b -c" were |
@@ -119,7 +119,7 @@ const char *opt_complementary | |||
119 | 119 | ||
120 | int w_counter = 0; | 120 | int w_counter = 0; |
121 | opt_complementary = "ww"; | 121 | opt_complementary = "ww"; |
122 | getopt32(argc, argv, "w", &w_counter); | 122 | getopt32(argv, "w", &w_counter); |
123 | if (w_counter) | 123 | if (w_counter) |
124 | width = (w_counter == 1) ? 132 : INT_MAX; | 124 | width = (w_counter == 1) ? 132 : INT_MAX; |
125 | else | 125 | else |
@@ -135,7 +135,7 @@ const char *opt_complementary | |||
135 | llist_t *my_b = NULL; | 135 | llist_t *my_b = NULL; |
136 | int verbose_level = 0; | 136 | int verbose_level = 0; |
137 | opt_complementary = "vv:b::b-c:c-b"; | 137 | opt_complementary = "vv:b::b-c:c-b"; |
138 | f = getopt32(argc, argv, "vb:c", &my_b, &verbose_level); | 138 | f = getopt32(argv, "vb:c", &my_b, &verbose_level); |
139 | if (f & 2) // -c after -b unsets -b flag | 139 | if (f & 2) // -c after -b unsets -b flag |
140 | while (my_b) { dosomething_with(my_b->data); my_b = my_b->link; } | 140 | while (my_b) { dosomething_with(my_b->data); my_b = my_b->link; } |
141 | if (my_b) // but llist is stored if -b is specified | 141 | if (my_b) // but llist is stored if -b is specified |
@@ -150,7 +150,7 @@ Special characters: | |||
150 | use ':' or end of line. For example: | 150 | use ':' or end of line. For example: |
151 | 151 | ||
152 | opt_complementary = "-:w-x:x-w"; | 152 | opt_complementary = "-:w-x:x-w"; |
153 | getopt32(argc, argv, "wx"); | 153 | getopt32(argv, "wx"); |
154 | 154 | ||
155 | Allows any arguments to be given without a dash (./program w x) | 155 | Allows any arguments to be given without a dash (./program w x) |
156 | as well as with a dash (./program -x). | 156 | as well as with a dash (./program -x). |
@@ -197,7 +197,7 @@ Special characters: | |||
197 | char *smax_print_depth; | 197 | char *smax_print_depth; |
198 | 198 | ||
199 | opt_complementary = "s-d:d-s:x-x"; | 199 | opt_complementary = "s-d:d-s:x-x"; |
200 | opt = getopt32(argc, argv, "sd:x", &smax_print_depth); | 200 | opt = getopt32(argv, "sd:x", &smax_print_depth); |
201 | 201 | ||
202 | if (opt & 2) | 202 | if (opt & 2) |
203 | max_print_depth = atoi(smax_print_depth); | 203 | max_print_depth = atoi(smax_print_depth); |
@@ -235,7 +235,7 @@ Special characters: | |||
235 | 235 | ||
236 | opt_complementary = "e::"; | 236 | opt_complementary = "e::"; |
237 | 237 | ||
238 | getopt32(argc, argv, "e:", &patterns); | 238 | getopt32(argv, "e:", &patterns); |
239 | $ grep -e user -e root /etc/passwd | 239 | $ grep -e user -e root /etc/passwd |
240 | root:x:0:0:root:/root:/bin/bash | 240 | root:x:0:0:root:/root:/bin/bash |
241 | user:x:500:500::/home/user:/bin/bash | 241 | user:x:500:500::/home/user:/bin/bash |
@@ -248,7 +248,7 @@ Special characters: | |||
248 | 248 | ||
249 | // Don't allow -n -r -rn -ug -rug -nug -rnug | 249 | // Don't allow -n -r -rn -ug -rug -nug -rnug |
250 | opt_complementary = "r?ug:n?ug:?u--g:g--u"; | 250 | opt_complementary = "r?ug:n?ug:?u--g:g--u"; |
251 | flags = getopt32(argc, argv, "rnug"); | 251 | flags = getopt32(argv, "rnug"); |
252 | 252 | ||
253 | This example allowed only: | 253 | This example allowed only: |
254 | $ id; id -u; id -g; id -ru; id -nu; id -rg; id -ng; id -rnu; id -rng | 254 | $ id; id -u; id -g; id -ru; id -nu; id -rg; id -ng; id -rnu; id -rng |
@@ -260,7 +260,7 @@ Special characters: | |||
260 | 260 | ||
261 | // Don't allow -KS -SK, but -S or -K is required | 261 | // Don't allow -KS -SK, but -S or -K is required |
262 | opt_complementary = "K:S:?K--S:S--K"; | 262 | opt_complementary = "K:S:?K--S:S--K"; |
263 | flags = getopt32(argc, argv, "KS...); | 263 | flags = getopt32(argv, "KS...); |
264 | 264 | ||
265 | 265 | ||
266 | Don't forget to use ':'. For example, "?322-22-23X-x-a" | 266 | Don't forget to use ':'. For example, "?322-22-23X-x-a" |
@@ -296,8 +296,9 @@ const char *applet_long_options; | |||
296 | uint32_t option_mask32; | 296 | uint32_t option_mask32; |
297 | 297 | ||
298 | uint32_t | 298 | uint32_t |
299 | getopt32(int argc, char **argv, const char *applet_opts, ...) | 299 | getopt32(char **argv, const char *applet_opts, ...) |
300 | { | 300 | { |
301 | int argc; | ||
301 | unsigned flags = 0; | 302 | unsigned flags = 0; |
302 | unsigned requires = 0; | 303 | unsigned requires = 0; |
303 | t_complementary complementary[33]; | 304 | t_complementary complementary[33]; |
@@ -320,6 +321,10 @@ getopt32(int argc, char **argv, const char *applet_opts, ...) | |||
320 | #define FREE_FIRST_ARGV_IS_OPT 8 | 321 | #define FREE_FIRST_ARGV_IS_OPT 8 |
321 | int spec_flgs = 0; | 322 | int spec_flgs = 0; |
322 | 323 | ||
324 | argc = 0; | ||
325 | while (argv[argc]) | ||
326 | argc++; | ||
327 | |||
323 | va_start(p, applet_opts); | 328 | va_start(p, applet_opts); |
324 | 329 | ||
325 | c = 0; | 330 | c = 0; |
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c index cf7cca907..b213074a6 100644 --- a/loginutils/addgroup.c +++ b/loginutils/addgroup.c | |||
@@ -139,7 +139,7 @@ int addgroup_main(int argc, char **argv) | |||
139 | * addgroup user group | 139 | * addgroup user group |
140 | * Check for min, max and missing args */ | 140 | * Check for min, max and missing args */ |
141 | opt_complementary = "-1:?2"; | 141 | opt_complementary = "-1:?2"; |
142 | if (getopt32(argc, argv, "g:", &group)) { | 142 | if (getopt32(argv, "g:", &group)) { |
143 | gid = xatoul_range(group, 0, ((unsigned long)(gid_t)ULONG_MAX) >> 1); | 143 | gid = xatoul_range(group, 0, ((unsigned long)(gid_t)ULONG_MAX) >> 1); |
144 | } | 144 | } |
145 | /* move past the commandline options */ | 145 | /* move past the commandline options */ |
diff --git a/loginutils/adduser.c b/loginutils/adduser.c index 79cd2f4f7..eee4a000d 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c | |||
@@ -182,7 +182,7 @@ int adduser_main(int argc, char **argv) | |||
182 | 182 | ||
183 | /* exactly one non-option arg */ | 183 | /* exactly one non-option arg */ |
184 | opt_complementary = "=1"; | 184 | opt_complementary = "=1"; |
185 | getopt32(argc, argv, "h:g:s:G:DSH", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup); | 185 | getopt32(argv, "h:g:s:G:DSH", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup); |
186 | argv += optind; | 186 | argv += optind; |
187 | 187 | ||
188 | /* create a passwd struct */ | 188 | /* create a passwd struct */ |
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index e2a717a02..61f9b896a 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c | |||
@@ -33,7 +33,7 @@ int chpasswd_main(int argc, char **argv) | |||
33 | 33 | ||
34 | opt_complementary = "m--e:e--m"; | 34 | opt_complementary = "m--e:e--m"; |
35 | USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;) | 35 | USE_GETOPT_LONG(applet_long_options = chpasswd_longopts;) |
36 | opt = getopt32(argc, argv, "em"); | 36 | opt = getopt32(argv, "em"); |
37 | 37 | ||
38 | while ((name = xmalloc_getline(stdin)) != NULL) { | 38 | while ((name = xmalloc_getline(stdin)) != NULL) { |
39 | pass = strchr(name, ':'); | 39 | pass = strchr(name, ':'); |
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c index 1c3059198..0847857de 100644 --- a/loginutils/cryptpw.c +++ b/loginutils/cryptpw.c | |||
@@ -12,7 +12,7 @@ int cryptpw_main(int argc, char **argv) | |||
12 | { | 12 | { |
13 | char salt[sizeof("$N$XXXXXXXX")]; | 13 | char salt[sizeof("$N$XXXXXXXX")]; |
14 | 14 | ||
15 | if (!getopt32(argc, argv, "a:", NULL) || argv[optind - 1][0] != 'd') { | 15 | if (!getopt32(argv, "a:", NULL) || argv[optind - 1][0] != 'd') { |
16 | strcpy(salt, "$1$"); | 16 | strcpy(salt, "$1$"); |
17 | /* Too ugly, and needs even more magic to handle endianness: */ | 17 | /* Too ugly, and needs even more magic to handle endianness: */ |
18 | //((uint32_t*)&salt)[0] = '$' + '1'*0x100 + '$'*0x10000; | 18 | //((uint32_t*)&salt)[0] = '$' + '1'*0x100 + '$'*0x10000; |
diff --git a/loginutils/getty.c b/loginutils/getty.c index 8b78856a2..0c000666e 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -180,7 +180,7 @@ static void parse_args(int argc, char **argv, struct options *op) | |||
180 | { | 180 | { |
181 | char *ts; | 181 | char *ts; |
182 | 182 | ||
183 | op->flags = getopt32(argc, argv, opt_string, | 183 | op->flags = getopt32(argv, opt_string, |
184 | &(op->initstring), &fakehost, &(op->issue), | 184 | &(op->initstring), &fakehost, &(op->issue), |
185 | &(op->login), &ts); | 185 | &(op->login), &ts); |
186 | if (op->flags & F_INITSTRING) { | 186 | if (op->flags & F_INITSTRING) { |
diff --git a/loginutils/login.c b/loginutils/login.c index d69e3ce51..7b60fd017 100644 --- a/loginutils/login.c +++ b/loginutils/login.c | |||
@@ -239,7 +239,7 @@ int login_main(int argc, char **argv) | |||
239 | * (The name of the function is misleading. Not daemonizing here.) */ | 239 | * (The name of the function is misleading. Not daemonizing here.) */ |
240 | bb_daemonize_or_rexec(DAEMON_ONLY_SANITIZE | DAEMON_CLOSE_EXTRA_FDS, NULL); | 240 | bb_daemonize_or_rexec(DAEMON_ONLY_SANITIZE | DAEMON_CLOSE_EXTRA_FDS, NULL); |
241 | 241 | ||
242 | opt = getopt32(argc, argv, "f:h:p", &opt_user, &opt_host); | 242 | opt = getopt32(argv, "f:h:p", &opt_user, &opt_host); |
243 | if (opt & LOGIN_OPT_f) { | 243 | if (opt & LOGIN_OPT_f) { |
244 | if (!amroot) | 244 | if (!amroot) |
245 | bb_error_msg_and_die("-f is for root only"); | 245 | bb_error_msg_and_die("-f is for root only"); |
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index 4f7094aec..ce333b49e 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -103,7 +103,7 @@ int passwd_main(int argc, char **argv) | |||
103 | 103 | ||
104 | logmode = LOGMODE_BOTH; | 104 | logmode = LOGMODE_BOTH; |
105 | openlog(applet_name, LOG_NOWAIT, LOG_AUTH); | 105 | openlog(applet_name, LOG_NOWAIT, LOG_AUTH); |
106 | opt = getopt32(argc, argv, "a:lud", &opt_a); | 106 | opt = getopt32(argv, "a:lud", &opt_a); |
107 | //argc -= optind; | 107 | //argc -= optind; |
108 | argv += optind; | 108 | argv += optind; |
109 | 109 | ||
diff --git a/loginutils/su.c b/loginutils/su.c index fd17319da..b4681fb6a 100644 --- a/loginutils/su.c +++ b/loginutils/su.c | |||
@@ -23,7 +23,7 @@ int su_main(int argc, char **argv) | |||
23 | const char *tty; | 23 | const char *tty; |
24 | char *old_user; | 24 | char *old_user; |
25 | 25 | ||
26 | flags = getopt32(argc, argv, "mplc:s:", &opt_command, &opt_shell); | 26 | flags = getopt32(argv, "mplc:s:", &opt_command, &opt_shell); |
27 | argc -= optind; | 27 | argc -= optind; |
28 | argv += optind; | 28 | argv += optind; |
29 | 29 | ||
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 5638c4bc9..5f0a4081d 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c | |||
@@ -53,7 +53,7 @@ int sulogin_main(int argc, char **argv) | |||
53 | logmode = LOGMODE_BOTH; | 53 | logmode = LOGMODE_BOTH; |
54 | openlog(applet_name, 0, LOG_AUTH); | 54 | openlog(applet_name, 0, LOG_AUTH); |
55 | 55 | ||
56 | if (getopt32(argc, argv, "t:", &timeout_arg)) { | 56 | if (getopt32(argv, "t:", &timeout_arg)) { |
57 | timeout = xatoi_u(timeout_arg); | 57 | timeout = xatoi_u(timeout_arg); |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/loginutils/vlock.c b/loginutils/vlock.c index 665ebd83a..d18a9f272 100644 --- a/loginutils/vlock.c +++ b/loginutils/vlock.c | |||
@@ -58,7 +58,7 @@ int vlock_main(int argc, char **argv) | |||
58 | bb_show_usage(); | 58 | bb_show_usage(); |
59 | } | 59 | } |
60 | 60 | ||
61 | o_lock_all = getopt32(argc, argv, "a"); | 61 | o_lock_all = getopt32(argv, "a"); |
62 | 62 | ||
63 | vfd = xopen(CURRENT_TTY, O_RDWR); | 63 | vfd = xopen(CURRENT_TTY, O_RDWR); |
64 | 64 | ||
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index 1e6d15fa7..b11807d75 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c | |||
@@ -56,7 +56,7 @@ int adjtimex_main(int argc, char **argv) | |||
56 | const char *descript; | 56 | const char *descript; |
57 | txc.modes=0; | 57 | txc.modes=0; |
58 | 58 | ||
59 | opt = getopt32(argc, argv, "qo:f:p:t:", | 59 | opt = getopt32(argv, "qo:f:p:t:", |
60 | &opt_o, &opt_f, &opt_p, &opt_t); | 60 | &opt_o, &opt_f, &opt_p, &opt_t); |
61 | //if (opt & 0x1) // -q | 61 | //if (opt & 0x1) // -q |
62 | if (opt & 0x2) { // -o | 62 | if (opt & 0x2) { // -o |
diff --git a/miscutils/chrt.c b/miscutils/chrt.c index d549708b4..98399cedb 100644 --- a/miscutils/chrt.c +++ b/miscutils/chrt.c | |||
@@ -52,7 +52,7 @@ int chrt_main(int argc, char** argv) | |||
52 | int prio = 0, policy = SCHED_RR; | 52 | int prio = 0, policy = SCHED_RR; |
53 | 53 | ||
54 | opt_complementary = "r--fo:f--ro:r--fo"; /* only one policy accepted */ | 54 | opt_complementary = "r--fo:f--ro:r--fo"; /* only one policy accepted */ |
55 | opt = getopt32(argc, argv, "+mp:rfo", &p_opt); | 55 | opt = getopt32(argv, "+mp:rfo", &p_opt); |
56 | if (opt & OPT_r) | 56 | if (opt & OPT_r) |
57 | policy = SCHED_RR; | 57 | policy = SCHED_RR; |
58 | if (opt & OPT_f) | 58 | if (opt & OPT_f) |
diff --git a/miscutils/eject.c b/miscutils/eject.c index 8d062d1bb..e66d74e70 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c | |||
@@ -33,7 +33,7 @@ int eject_main(int argc, char **argv) | |||
33 | int dev, cmd; | 33 | int dev, cmd; |
34 | 34 | ||
35 | opt_complementary = "?1:t--T:T--t"; | 35 | opt_complementary = "?1:t--T:T--t"; |
36 | flags = getopt32(argc, argv, "tT"); | 36 | flags = getopt32(argv, "tT"); |
37 | device = argv[optind] ? : "/dev/cdrom"; | 37 | device = argv[optind] ? : "/dev/cdrom"; |
38 | 38 | ||
39 | // We used to do "umount <device>" here, but it was buggy | 39 | // We used to do "umount <device>" here, but it was buggy |
diff --git a/miscutils/less.c b/miscutils/less.c index 046a3c459..a2221cfca 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -1321,7 +1321,7 @@ int less_main(int argc, char **argv) | |||
1321 | /* TODO: -x: do not interpret backspace, -xx: tab also */ | 1321 | /* TODO: -x: do not interpret backspace, -xx: tab also */ |
1322 | /* -xxx: newline also */ | 1322 | /* -xxx: newline also */ |
1323 | /* -w N: assume width N (-xxx -w 32: hex viewer of sorts) */ | 1323 | /* -w N: assume width N (-xxx -w 32: hex viewer of sorts) */ |
1324 | getopt32(argc, argv, "EMmN~"); | 1324 | getopt32(argv, "EMmN~"); |
1325 | argc -= optind; | 1325 | argc -= optind; |
1326 | argv += optind; | 1326 | argv += optind; |
1327 | num_files = argc; | 1327 | num_files = argc; |
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index 6a3e80883..d36c6956a 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c | |||
@@ -78,7 +78,7 @@ int makedevs_main(int argc, char **argv) | |||
78 | int linenum = 0; | 78 | int linenum = 0; |
79 | int ret = EXIT_SUCCESS; | 79 | int ret = EXIT_SUCCESS; |
80 | 80 | ||
81 | getopt32(argc, argv, "d:", &line); | 81 | getopt32(argv, "d:", &line); |
82 | if (line) | 82 | if (line) |
83 | table = xfopen(line, "r"); | 83 | table = xfopen(line, "r"); |
84 | 84 | ||
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index b5ce35cf1..1f17adadc 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c | |||
@@ -16,7 +16,7 @@ int mountpoint_main(int argc, char **argv) | |||
16 | { | 16 | { |
17 | struct stat st; | 17 | struct stat st; |
18 | char *arg; | 18 | char *arg; |
19 | int opt = getopt32(argc, argv, "qdx"); | 19 | int opt = getopt32(argv, "qdx"); |
20 | #define OPT_q (1) | 20 | #define OPT_q (1) |
21 | #define OPT_d (2) | 21 | #define OPT_d (2) |
22 | #define OPT_x (4) | 22 | #define OPT_x (4) |
diff --git a/miscutils/strings.c b/miscutils/strings.c index f0ef2a2e9..835880214 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c | |||
@@ -28,7 +28,7 @@ int strings_main(int argc, char **argv) | |||
28 | const char *fmt = "%s: "; | 28 | const char *fmt = "%s: "; |
29 | const char *n_arg = "4"; | 29 | const char *n_arg = "4"; |
30 | 30 | ||
31 | opt = getopt32(argc, argv, "afon:", &n_arg); | 31 | opt = getopt32(argv, "afon:", &n_arg); |
32 | /* -a is our default behaviour */ | 32 | /* -a is our default behaviour */ |
33 | /*argc -= optind;*/ | 33 | /*argc -= optind;*/ |
34 | argv += optind; | 34 | argv += optind; |
diff --git a/miscutils/taskset.c b/miscutils/taskset.c index cd8ffc840..0c4bad7ed 100644 --- a/miscutils/taskset.c +++ b/miscutils/taskset.c | |||
@@ -50,7 +50,7 @@ int taskset_main(int argc, char** argv) | |||
50 | const char *state = "current\0new"; | 50 | const char *state = "current\0new"; |
51 | char *p_opt = NULL, *aff = NULL; | 51 | char *p_opt = NULL, *aff = NULL; |
52 | 52 | ||
53 | opt = getopt32(argc, argv, "+p:", &p_opt); | 53 | opt = getopt32(argv, "+p:", &p_opt); |
54 | 54 | ||
55 | if (opt & OPT_p) { | 55 | if (opt & OPT_p) { |
56 | if (argc == optind+1) { /* -p <aff> <pid> */ | 56 | if (argc == optind+1) { /* -p <aff> <pid> */ |
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index b64291b32..aa367d5ab 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c | |||
@@ -30,7 +30,7 @@ int watchdog_main(int argc, char **argv) | |||
30 | char *t_arg; | 30 | char *t_arg; |
31 | 31 | ||
32 | opt_complementary = "=1"; /* must have 1 argument */ | 32 | opt_complementary = "=1"; /* must have 1 argument */ |
33 | opts = getopt32(argc, argv, "Ft:", &t_arg); | 33 | opts = getopt32(argv, "Ft:", &t_arg); |
34 | 34 | ||
35 | if (opts & OPT_TIMER) | 35 | if (opts & OPT_TIMER) |
36 | timer_duration = xatou(t_arg); | 36 | timer_duration = xatou(t_arg); |
diff --git a/modutils/insmod.c b/modutils/insmod.c index c0bc0eb1b..503367298 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -3980,7 +3980,7 @@ int insmod_main( int argc, char **argv) | |||
3980 | struct utsname myuname; | 3980 | struct utsname myuname; |
3981 | 3981 | ||
3982 | /* Parse any options */ | 3982 | /* Parse any options */ |
3983 | getopt32(argc, argv, OPTION_STR, &opt_o); | 3983 | getopt32(argv, OPTION_STR, &opt_o); |
3984 | arg1 = argv[optind]; | 3984 | arg1 = argv[optind]; |
3985 | if (option_mask32 & OPT_o) { // -o /* name the output module */ | 3985 | if (option_mask32 & OPT_o) { // -o /* name the output module */ |
3986 | free(m_name); | 3986 | free(m_name); |
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index fe399acfc..36a3c3535 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -868,7 +868,7 @@ int modprobe_main(int argc, char** argv) | |||
868 | char *unused; | 868 | char *unused; |
869 | 869 | ||
870 | opt_complementary = "?V-:q-v:v-q"; | 870 | opt_complementary = "?V-:q-v:v-q"; |
871 | main_opts = getopt32(argc, argv, "acdklnqrst:vVC:", | 871 | main_opts = getopt32(argv, "acdklnqrst:vVC:", |
872 | &unused, &unused); | 872 | &unused, &unused); |
873 | if (main_opts & (DUMP_CONF_EXIT | LIST_ALL)) | 873 | if (main_opts & (DUMP_CONF_EXIT | LIST_ALL)) |
874 | return EXIT_SUCCESS; | 874 | return EXIT_SUCCESS; |
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index 26bad7d7e..4a38e35a5 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
@@ -47,7 +47,7 @@ int rmmod_main(int argc, char **argv) | |||
47 | #define misc_buf bb_common_bufsiz1 | 47 | #define misc_buf bb_common_bufsiz1 |
48 | 48 | ||
49 | /* Parse command line. */ | 49 | /* Parse command line. */ |
50 | n = getopt32(argc, argv, "wfa"); | 50 | n = getopt32(argv, "wfa"); |
51 | if (n & 1) // --wait | 51 | if (n & 1) // --wait |
52 | flags &= ~O_NONBLOCK; | 52 | flags &= ~O_NONBLOCK; |
53 | if (n & 2) // --force | 53 | if (n & 2) // --force |
diff --git a/networking/arp.c b/networking/arp.c index a5a737349..8cdee1832 100644 --- a/networking/arp.c +++ b/networking/arp.c | |||
@@ -445,7 +445,7 @@ int arp_main(int argc, char **argv) | |||
445 | if (!ap) | 445 | if (!ap) |
446 | bb_error_msg_and_die("%s: %s not supported", DFLT_AF, "address family"); | 446 | bb_error_msg_and_die("%s: %s not supported", DFLT_AF, "address family"); |
447 | 447 | ||
448 | getopt32(argc, argv, "A:p:H:t:i:adnDsv", &protocol, &protocol, | 448 | getopt32(argv, "A:p:H:t:i:adnDsv", &protocol, &protocol, |
449 | &hw_type, &hw_type, &device); | 449 | &hw_type, &hw_type, &device); |
450 | argv += optind; | 450 | argv += optind; |
451 | if (option_mask32 & ARP_OPT_A || option_mask32 & ARP_OPT_p) { | 451 | if (option_mask32 & ARP_OPT_A || option_mask32 & ARP_OPT_p) { |
diff --git a/networking/arping.c b/networking/arping.c index 8e457b13a..a2c4c2247 100644 --- a/networking/arping.c +++ b/networking/arping.c | |||
@@ -249,7 +249,7 @@ int arping_main(int argc, char **argv) | |||
249 | * Advert also sets unsolicited. | 249 | * Advert also sets unsolicited. |
250 | */ | 250 | */ |
251 | opt_complementary = "=1:Df:AU"; | 251 | opt_complementary = "=1:Df:AU"; |
252 | opt = getopt32(argc, argv, "DUAqfbc:w:I:s:", | 252 | opt = getopt32(argv, "DUAqfbc:w:I:s:", |
253 | &str_count, &str_timeout, &device, &source); | 253 | &str_count, &str_timeout, &device, &source); |
254 | if (opt & 0x40) /* -c: count */ | 254 | if (opt & 0x40) /* -c: count */ |
255 | count = xatou(str_count); | 255 | count = xatou(str_count); |
diff --git a/networking/dnsd.c b/networking/dnsd.c index 672b729e0..c906de32a 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c | |||
@@ -338,7 +338,7 @@ int dnsd_main(int argc, char **argv) | |||
338 | uint16_t port = 53; | 338 | uint16_t port = 53; |
339 | uint8_t buf[MAX_PACK_LEN]; | 339 | uint8_t buf[MAX_PACK_LEN]; |
340 | 340 | ||
341 | getopt32(argc, argv, "i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport); | 341 | getopt32(argv, "i:c:t:p:dv", &listen_interface, &fileconf, &sttl, &sport); |
342 | //if (option_mask32 & 0x1) // -i | 342 | //if (option_mask32 & 0x1) // -i |
343 | //if (option_mask32 & 0x2) // -c | 343 | //if (option_mask32 & 0x2) // -c |
344 | if (option_mask32 & 0x4) // -t | 344 | if (option_mask32 & 0x4) // -t |
diff --git a/networking/ether-wake.c b/networking/ether-wake.c index b67e1b5d8..36713837a 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c | |||
@@ -195,7 +195,7 @@ int ether_wake_main(int argc, char **argv) | |||
195 | 195 | ||
196 | /* handle misc user options */ | 196 | /* handle misc user options */ |
197 | opt_complementary = "=1"; | 197 | opt_complementary = "=1"; |
198 | flags = getopt32(argc, argv, "bi:p:", &ifname, &pass); | 198 | flags = getopt32(argv, "bi:p:", &ifname, &pass); |
199 | if (flags & 4) /* -p */ | 199 | if (flags & 4) /* -p */ |
200 | wol_passwd_sz = get_wol_pw(pass, wol_passwd); | 200 | wol_passwd_sz = get_wol_pw(pass, wol_passwd); |
201 | flags &= 1; /* we further interested only in -b [bcast] flag */ | 201 | flags &= 1; /* we further interested only in -b [bcast] flag */ |
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 255e413cb..d7e2bfa5d 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c | |||
@@ -331,7 +331,7 @@ int ftpgetput_main(int argc, char **argv) | |||
331 | applet_long_options = ftpgetput_longopts; | 331 | applet_long_options = ftpgetput_longopts; |
332 | #endif | 332 | #endif |
333 | opt_complementary = "=3"; /* must have 3 params */ | 333 | opt_complementary = "=3"; /* must have 3 params */ |
334 | opt = getopt32(argc, argv, "cvu:p:P:", &server->user, &server->password, &port); | 334 | opt = getopt32(argv, "cvu:p:P:", &server->user, &server->password, &port); |
335 | argv += optind; | 335 | argv += optind; |
336 | 336 | ||
337 | /* Process the non-option command line arguments */ | 337 | /* Process the non-option command line arguments */ |
diff --git a/networking/hostname.c b/networking/hostname.c index 862bbdfa2..95dc4515d 100644 --- a/networking/hostname.c +++ b/networking/hostname.c | |||
@@ -60,7 +60,7 @@ int hostname_main(int argc, char **argv) | |||
60 | if (argc < 1) | 60 | if (argc < 1) |
61 | bb_show_usage(); | 61 | bb_show_usage(); |
62 | 62 | ||
63 | getopt32(argc, argv, "dfisF:", &hostname_str); | 63 | getopt32(argv, "dfisF:", &hostname_str); |
64 | 64 | ||
65 | /* Output in desired format */ | 65 | /* Output in desired format */ |
66 | if (option_mask32 & OPT_dfis) { | 66 | if (option_mask32 & OPT_dfis) { |
diff --git a/networking/httpd.c b/networking/httpd.c index 072714435..c837d67ad 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -1975,7 +1975,7 @@ int httpd_main(int argc, char **argv) | |||
1975 | /* We do not "absolutize" path given by -h (home) opt. | 1975 | /* We do not "absolutize" path given by -h (home) opt. |
1976 | * If user gives relative path in -h, $SCRIPT_FILENAME can end up | 1976 | * If user gives relative path in -h, $SCRIPT_FILENAME can end up |
1977 | * relative too. */ | 1977 | * relative too. */ |
1978 | opt = getopt32(argc, argv, "c:d:h:" | 1978 | opt = getopt32(argv, "c:d:h:" |
1979 | USE_FEATURE_HTTPD_ENCODE_URL_STR("e:") | 1979 | USE_FEATURE_HTTPD_ENCODE_URL_STR("e:") |
1980 | USE_FEATURE_HTTPD_BASIC_AUTH("r:") | 1980 | USE_FEATURE_HTTPD_BASIC_AUTH("r:") |
1981 | USE_FEATURE_HTTPD_AUTH_MD5("m:") | 1981 | USE_FEATURE_HTTPD_AUTH_MD5("m:") |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index e1c1e652b..128cc37bd 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -1148,7 +1148,7 @@ int ifupdown_main(int argc, char **argv) | |||
1148 | cmds = iface_up; | 1148 | cmds = iface_up; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | getopt32(argc, argv, OPTION_STR, &interfaces); | 1151 | getopt32(argv, OPTION_STR, &interfaces); |
1152 | if (argc - optind > 0) { | 1152 | if (argc - optind > 0) { |
1153 | if (DO_ALL) bb_show_usage(); | 1153 | if (DO_ALL) bb_show_usage(); |
1154 | } else { | 1154 | } else { |
diff --git a/networking/inetd.c b/networking/inetd.c index a7517ebdf..e4e9f95b0 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1278,7 +1278,7 @@ int inetd_main(int argc, char **argv) | |||
1278 | if (uid != 0) | 1278 | if (uid != 0) |
1279 | config_filename = NULL; | 1279 | config_filename = NULL; |
1280 | 1280 | ||
1281 | opt = getopt32(argc, argv, "R:f", &stoomany); | 1281 | opt = getopt32(argv, "R:f", &stoomany); |
1282 | if (opt & 1) | 1282 | if (opt & 1) |
1283 | toomany = xatoi_u(stoomany); | 1283 | toomany = xatoi_u(stoomany); |
1284 | argv += optind; | 1284 | argv += optind; |
diff --git a/networking/ipcalc.c b/networking/ipcalc.c index 3f99b7511..759704379 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c | |||
@@ -87,7 +87,7 @@ int ipcalc_main(int argc, char **argv) | |||
87 | #if ENABLE_FEATURE_IPCALC_LONG_OPTIONS | 87 | #if ENABLE_FEATURE_IPCALC_LONG_OPTIONS |
88 | applet_long_options = ipcalc_longopts; | 88 | applet_long_options = ipcalc_longopts; |
89 | #endif | 89 | #endif |
90 | opt = getopt32(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs")); | 90 | opt = getopt32(argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs")); |
91 | argc -= optind; | 91 | argc -= optind; |
92 | argv += optind; | 92 | argv += optind; |
93 | if (opt & (BROADCAST | NETWORK | NETPREFIX)) { | 93 | if (opt & (BROADCAST | NETWORK | NETPREFIX)) { |
diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c index 84cf6da6a..23f6758a0 100644 --- a/networking/isrv_identd.c +++ b/networking/isrv_identd.c | |||
@@ -107,7 +107,7 @@ int fakeidentd_main(int argc, char **argv) | |||
107 | unsigned opt; | 107 | unsigned opt; |
108 | int fd; | 108 | int fd; |
109 | 109 | ||
110 | opt = getopt32(argc, argv, "fiwb:", &bind_address); | 110 | opt = getopt32(argv, "fiwb:", &bind_address); |
111 | strcpy(bogouser, "nobody"); | 111 | strcpy(bogouser, "nobody"); |
112 | if (argv[optind]) | 112 | if (argv[optind]) |
113 | strncpy(bogouser, argv[optind], sizeof(bogouser)); | 113 | strncpy(bogouser, argv[optind], sizeof(bogouser)); |
diff --git a/networking/nameif.c b/networking/nameif.c index fd081fd63..daac191bf 100644 --- a/networking/nameif.c +++ b/networking/nameif.c | |||
@@ -66,7 +66,7 @@ int nameif_main(int argc, char **argv) | |||
66 | int if_index = 1; | 66 | int if_index = 1; |
67 | mactable_t *ch; | 67 | mactable_t *ch; |
68 | 68 | ||
69 | if (1 & getopt32(argc, argv, "sc:", &fname)) { | 69 | if (1 & getopt32(argv, "sc:", &fname)) { |
70 | openlog(applet_name, 0, LOG_LOCAL0); | 70 | openlog(applet_name, 0, LOG_LOCAL0); |
71 | logmode = LOGMODE_SYSLOG; | 71 | logmode = LOGMODE_SYSLOG; |
72 | } | 72 | } |
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c index 30abb3c1c..ab8246531 100644 --- a/networking/nc_bloaty.c +++ b/networking/nc_bloaty.c | |||
@@ -706,7 +706,7 @@ int nc_main(int argc, char **argv) | |||
706 | 706 | ||
707 | // -g -G -t -r deleted, unimplemented -a deleted too | 707 | // -g -G -t -r deleted, unimplemented -a deleted too |
708 | opt_complementary = "?2:vv"; /* max 2 params, -v is a counter */ | 708 | opt_complementary = "?2:vv"; /* max 2 params, -v is a counter */ |
709 | getopt32(argc, argv, "hnp:s:uvw:" USE_NC_SERVER("l") | 709 | getopt32(argv, "hnp:s:uvw:" USE_NC_SERVER("l") |
710 | USE_NC_EXTRA("i:o:z"), | 710 | USE_NC_EXTRA("i:o:z"), |
711 | &str_p, &str_s, &str_w | 711 | &str_p, &str_s, &str_w |
712 | USE_NC_EXTRA(, &str_i, &str_o, &o_verbose)); | 712 | USE_NC_EXTRA(, &str_i, &str_o, &o_verbose)); |
diff --git a/networking/netstat.c b/networking/netstat.c index 9fd3d2f86..5bacb47cc 100644 --- a/networking/netstat.c +++ b/networking/netstat.c | |||
@@ -497,7 +497,7 @@ int netstat_main(int argc, char **argv) | |||
497 | #endif | 497 | #endif |
498 | 498 | ||
499 | /* Option string must match NETSTAT_xxx constants */ | 499 | /* Option string must match NETSTAT_xxx constants */ |
500 | opt = getopt32(argc, argv, NETSTAT_OPTS); | 500 | opt = getopt32(argv, NETSTAT_OPTS); |
501 | if (opt & 0x1) { // -l | 501 | if (opt & 0x1) { // -l |
502 | flags &= ~NETSTAT_CONNECTED; | 502 | flags &= ~NETSTAT_CONNECTED; |
503 | flags |= NETSTAT_LISTENING; | 503 | flags |= NETSTAT_LISTENING; |
diff --git a/networking/ping.c b/networking/ping.c index d1a413dd3..5d61cd768 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -689,7 +689,7 @@ int ping_main(int argc, char **argv) | |||
689 | 689 | ||
690 | /* exactly one argument needed, -v and -q don't mix */ | 690 | /* exactly one argument needed, -v and -q don't mix */ |
691 | opt_complementary = "=1:q--v:v--q"; | 691 | opt_complementary = "=1:q--v:v--q"; |
692 | getopt32(argc, argv, OPT_STRING, &opt_c, &opt_s, &opt_I); | 692 | getopt32(argv, OPT_STRING, &opt_c, &opt_s, &opt_I); |
693 | if (option_mask32 & OPT_c) pingcount = xatoul(opt_c); // -c | 693 | if (option_mask32 & OPT_c) pingcount = xatoul(opt_c); // -c |
694 | if (option_mask32 & OPT_s) datalen = xatou16(opt_s); // -s | 694 | if (option_mask32 & OPT_s) datalen = xatou16(opt_s); // -s |
695 | if (option_mask32 & OPT_I) { // -I | 695 | if (option_mask32 & OPT_I) { // -I |
diff --git a/networking/pscan.c b/networking/pscan.c index 9eda16865..5ae3e61dd 100644 --- a/networking/pscan.c +++ b/networking/pscan.c | |||
@@ -54,7 +54,7 @@ int pscan_main(int argc, char **argv) | |||
54 | unsigned start; | 54 | unsigned start; |
55 | 55 | ||
56 | opt_complementary = "=1"; /* exactly one non-option */ | 56 | opt_complementary = "=1"; /* exactly one non-option */ |
57 | getopt32(argc, argv, "p:P:t:T:", &opt_min_port, &opt_max_port, &opt_timeout, &opt_min_rtt); | 57 | getopt32(argv, "p:P:t:T:", &opt_min_port, &opt_max_port, &opt_timeout, &opt_min_rtt); |
58 | argv += optind; | 58 | argv += optind; |
59 | max_port = xatou_range(opt_max_port, 1, 65535); | 59 | max_port = xatou_range(opt_max_port, 1, 65535); |
60 | port = xatou_range(opt_min_port, 1, max_port); | 60 | port = xatou_range(opt_min_port, 1, max_port); |
diff --git a/networking/route.c b/networking/route.c index bfa58da2a..55a6c2155 100644 --- a/networking/route.c +++ b/networking/route.c | |||
@@ -656,7 +656,7 @@ int route_main(int argc, char **argv) | |||
656 | } | 656 | } |
657 | } | 657 | } |
658 | 658 | ||
659 | opt = getopt32(argc, argv, "A:ne", &family); | 659 | opt = getopt32(argv, "A:ne", &family); |
660 | 660 | ||
661 | if ((opt & ROUTE_OPT_A) && strcmp(family, "inet") != 0) { | 661 | if ((opt & ROUTE_OPT_A) && strcmp(family, "inet") != 0) { |
662 | #if ENABLE_FEATURE_IPV6 | 662 | #if ENABLE_FEATURE_IPV6 |
diff --git a/networking/slattach.c b/networking/slattach.c index f78c88e89..ce6d705a8 100644 --- a/networking/slattach.c +++ b/networking/slattach.c | |||
@@ -152,7 +152,7 @@ int slattach_main(int argc, char **argv) | |||
152 | INIT_G(); | 152 | INIT_G(); |
153 | 153 | ||
154 | /* Parse command line options */ | 154 | /* Parse command line options */ |
155 | opt = getopt32(argc, argv, "p:s:c:ehmLF", &proto, &baud_str, &extcmd); | 155 | opt = getopt32(argv, "p:s:c:ehmLF", &proto, &baud_str, &extcmd); |
156 | /*argc -= optind;*/ | 156 | /*argc -= optind;*/ |
157 | argv += optind; | 157 | argv += optind; |
158 | 158 | ||
diff --git a/networking/telnet.c b/networking/telnet.c index 4e8b27ba6..ae526fa9e 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
@@ -583,7 +583,7 @@ int telnet_main(int argc, char** argv) | |||
583 | bb_show_usage(); | 583 | bb_show_usage(); |
584 | 584 | ||
585 | #if ENABLE_FEATURE_TELNET_AUTOLOGIN | 585 | #if ENABLE_FEATURE_TELNET_AUTOLOGIN |
586 | if (1 & getopt32(argc, argv, "al:", &G.autologin)) | 586 | if (1 & getopt32(argv, "al:", &G.autologin)) |
587 | G.autologin = getenv("USER"); | 587 | G.autologin = getenv("USER"); |
588 | argv += optind; | 588 | argv += optind; |
589 | #else | 589 | #else |
diff --git a/networking/telnetd.c b/networking/telnetd.c index 9246f7052..b21991212 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c | |||
@@ -386,7 +386,7 @@ int telnetd_main(int argc, char **argv) | |||
386 | OPT_INETD = 0x20 * ENABLE_FEATURE_TELNETD_STANDALONE, | 386 | OPT_INETD = 0x20 * ENABLE_FEATURE_TELNETD_STANDALONE, |
387 | }; | 387 | }; |
388 | 388 | ||
389 | opt = getopt32(argc, argv, "f:l:" USE_FEATURE_TELNETD_STANDALONE("p:b:Fi"), | 389 | opt = getopt32(argv, "f:l:" USE_FEATURE_TELNETD_STANDALONE("p:b:Fi"), |
390 | &issuefile, &loginpath | 390 | &issuefile, &loginpath |
391 | USE_FEATURE_TELNETD_STANDALONE(, &opt_portnbr, &opt_bindaddr)); | 391 | USE_FEATURE_TELNETD_STANDALONE(, &opt_portnbr, &opt_bindaddr)); |
392 | /* Redirect log to syslog early, if needed */ | 392 | /* Redirect log to syslog early, if needed */ |
diff --git a/networking/tftp.c b/networking/tftp.c index 030c0116e..6be265b4c 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -405,7 +405,7 @@ int tftp_main(int argc, char **argv) | |||
405 | opt_complementary = "" USE_FEATURE_TFTP_GET("g:") USE_FEATURE_TFTP_PUT("p:") | 405 | opt_complementary = "" USE_FEATURE_TFTP_GET("g:") USE_FEATURE_TFTP_PUT("p:") |
406 | USE_GETPUT("?g--p:p--g"); | 406 | USE_GETPUT("?g--p:p--g"); |
407 | 407 | ||
408 | USE_GETPUT(cmd =) getopt32(argc, argv, | 408 | USE_GETPUT(cmd =) getopt32(argv, |
409 | USE_FEATURE_TFTP_GET("g") USE_FEATURE_TFTP_PUT("p") | 409 | USE_FEATURE_TFTP_GET("g") USE_FEATURE_TFTP_PUT("p") |
410 | "l:r:" USE_FEATURE_TFTP_BLOCKSIZE("b:"), | 410 | "l:r:" USE_FEATURE_TFTP_BLOCKSIZE("b:"), |
411 | &localfile, &remotefile | 411 | &localfile, &remotefile |
diff --git a/networking/traceroute.c b/networking/traceroute.c index 0923d97dc..236ddbdaf 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c | |||
@@ -941,7 +941,7 @@ int traceroute_main(int argc, char **argv) | |||
941 | opt_complementary = "x-x"; | 941 | opt_complementary = "x-x"; |
942 | #endif | 942 | #endif |
943 | 943 | ||
944 | op = getopt32(argc, argv, "FIlnrdvxt:i:m:p:q:s:w:z:f:" | 944 | op = getopt32(argv, "FIlnrdvxt:i:m:p:q:s:w:z:f:" |
945 | #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE | 945 | #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE |
946 | "g:" | 946 | "g:" |
947 | #endif | 947 | #endif |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index f0a3351fd..961a1712a 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -215,7 +215,7 @@ int udhcpc_main(int argc, char **argv) | |||
215 | #if ENABLE_GETOPT_LONG | 215 | #if ENABLE_GETOPT_LONG |
216 | applet_long_options = udhcpc_longopts; | 216 | applet_long_options = udhcpc_longopts; |
217 | #endif | 217 | #endif |
218 | opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vS", | 218 | opt = getopt32(argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vS", |
219 | &str_c, &str_V, &str_h, &str_h, &str_F, | 219 | &str_c, &str_V, &str_h, &str_h, &str_F, |
220 | &client_config.interface, &client_config.pidfile, &str_r, | 220 | &client_config.interface, &client_config.pidfile, &str_r, |
221 | &client_config.script, &str_T, &str_t | 221 | &client_config.script, &str_T, &str_t |
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 2fd16ce9b..e722833e1 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c | |||
@@ -36,7 +36,7 @@ int udhcpd_main(int argc, char **argv) | |||
36 | struct option_set *option; | 36 | struct option_set *option; |
37 | struct dhcpOfferedAddr *lease, static_lease; | 37 | struct dhcpOfferedAddr *lease, static_lease; |
38 | 38 | ||
39 | opt = getopt32(argc, argv, "fS"); | 39 | opt = getopt32(argv, "fS"); |
40 | argv += optind; | 40 | argv += optind; |
41 | 41 | ||
42 | if (!(opt & 1)) { /* no -f */ | 42 | if (!(opt & 1)) { /* no -f */ |
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c index a0765be79..3e931c0b5 100644 --- a/networking/udhcp/dumpleases.c +++ b/networking/udhcp/dumpleases.c | |||
@@ -33,7 +33,7 @@ int dumpleases_main(int argc, char **argv) | |||
33 | applet_long_options = dumpleases_longopts; | 33 | applet_long_options = dumpleases_longopts; |
34 | #endif | 34 | #endif |
35 | opt_complementary = "=0:a--r:r--a"; | 35 | opt_complementary = "=0:a--r:r--a"; |
36 | opt = getopt32(argc, argv, "arf:", &file); | 36 | opt = getopt32(argv, "arf:", &file); |
37 | 37 | ||
38 | fd = xopen(file, O_RDONLY); | 38 | fd = xopen(file, O_RDONLY); |
39 | 39 | ||
diff --git a/networking/wget.c b/networking/wget.c index 3e61ea656..8af7a3399 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -147,7 +147,7 @@ int wget_main(int argc, char **argv) | |||
147 | #endif | 147 | #endif |
148 | /* server.allocated = target.allocated = NULL; */ | 148 | /* server.allocated = target.allocated = NULL; */ |
149 | opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::"); | 149 | opt_complementary = "-1" USE_FEATURE_WGET_LONG_OPTIONS(":\xfe::"); |
150 | opt = getopt32(argc, argv, "csqO:P:Y:U:", | 150 | opt = getopt32(argv, "csqO:P:Y:U:", |
151 | &fname_out, &dir_prefix, | 151 | &fname_out, &dir_prefix, |
152 | &proxy_flag, &user_agent | 152 | &proxy_flag, &user_agent |
153 | USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) | 153 | USE_FEATURE_WGET_LONG_OPTIONS(, &headers_llist) |
diff --git a/networking/zcip.c b/networking/zcip.c index 0b5bebec4..2f0b5a7fb 100644 --- a/networking/zcip.c +++ b/networking/zcip.c | |||
@@ -203,7 +203,7 @@ int zcip_main(int argc, char **argv) | |||
203 | // parse commandline: prog [options] ifname script | 203 | // parse commandline: prog [options] ifname script |
204 | // exactly 2 args; -v accumulates and implies -f | 204 | // exactly 2 args; -v accumulates and implies -f |
205 | opt_complementary = "=2:vv:vf"; | 205 | opt_complementary = "=2:vv:vf"; |
206 | opts = getopt32(argc, argv, "fqr:v", &r_opt, &verbose); | 206 | opts = getopt32(argv, "fqr:v", &r_opt, &verbose); |
207 | if (!FOREGROUND) { | 207 | if (!FOREGROUND) { |
208 | /* Do it early, before all bb_xx_msg calls */ | 208 | /* Do it early, before all bb_xx_msg calls */ |
209 | openlog(applet_name, 0, LOG_DAEMON); | 209 | openlog(applet_name, 0, LOG_DAEMON); |
diff --git a/procps/pidof.c b/procps/pidof.c index 01e587cbf..c989076bb 100644 --- a/procps/pidof.c +++ b/procps/pidof.c | |||
@@ -28,7 +28,7 @@ int pidof_main(int argc, char **argv) | |||
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | /* do unconditional option parsing */ | 30 | /* do unconditional option parsing */ |
31 | opt = getopt32(argc, argv, "" | 31 | opt = getopt32(argv, "" |
32 | USE_FEATURE_PIDOF_SINGLE ("s") | 32 | USE_FEATURE_PIDOF_SINGLE ("s") |
33 | USE_FEATURE_PIDOF_OMIT("o:", &omits)); | 33 | USE_FEATURE_PIDOF_OMIT("o:", &omits)); |
34 | 34 | ||
diff --git a/procps/ps.c b/procps/ps.c index 5150a08a2..805fe0615 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -297,7 +297,7 @@ int ps_main(int argc, char **argv) | |||
297 | // Select which columns to display | 297 | // Select which columns to display |
298 | /* We allow (and ignore) most of the above. FIXME */ | 298 | /* We allow (and ignore) most of the above. FIXME */ |
299 | opt_complementary = "o::"; | 299 | opt_complementary = "o::"; |
300 | USE_SELINUX(opt =) getopt32(argc, argv, "Zo:aAdefl", &opt_o); | 300 | USE_SELINUX(opt =) getopt32(argv, "Zo:aAdefl", &opt_o); |
301 | if (opt_o) { | 301 | if (opt_o) { |
302 | do { | 302 | do { |
303 | parse_o(opt_o->data); | 303 | parse_o(opt_o->data); |
@@ -357,7 +357,7 @@ int ps_main(int argc, char **argv) | |||
357 | #if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX | 357 | #if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX |
358 | #if ENABLE_FEATURE_PS_WIDE | 358 | #if ENABLE_FEATURE_PS_WIDE |
359 | opt_complementary = "-:ww"; | 359 | opt_complementary = "-:ww"; |
360 | USE_SELINUX(i =) getopt32(argc, argv, USE_SELINUX("Z") "w", &w_count); | 360 | USE_SELINUX(i =) getopt32(argv, USE_SELINUX("Z") "w", &w_count); |
361 | /* if w is given once, GNU ps sets the width to 132, | 361 | /* if w is given once, GNU ps sets the width to 132, |
362 | * if w is given more than once, it is "unlimited" | 362 | * if w is given more than once, it is "unlimited" |
363 | */ | 363 | */ |
@@ -370,7 +370,7 @@ int ps_main(int argc, char **argv) | |||
370 | terminal_width = MAX_WIDTH; | 370 | terminal_width = MAX_WIDTH; |
371 | } | 371 | } |
372 | #else /* only ENABLE_SELINUX */ | 372 | #else /* only ENABLE_SELINUX */ |
373 | i = getopt32(argc, argv, "Z"); | 373 | i = getopt32(argv, "Z"); |
374 | #endif | 374 | #endif |
375 | #if ENABLE_SELINUX | 375 | #if ENABLE_SELINUX |
376 | if ((i & 1) && is_selinux_enabled()) | 376 | if ((i & 1) && is_selinux_enabled()) |
diff --git a/procps/top.c b/procps/top.c index 85699b027..494509c7c 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -535,7 +535,7 @@ int top_main(int argc, char **argv) | |||
535 | 535 | ||
536 | /* do normal option parsing */ | 536 | /* do normal option parsing */ |
537 | opt_complementary = "-"; | 537 | opt_complementary = "-"; |
538 | getopt32(argc, argv, "d:n:b", &sinterval, &siterations); | 538 | getopt32(argv, "d:n:b", &sinterval, &siterations); |
539 | if (option_mask32 & 0x1) interval = xatou(sinterval); // -d | 539 | if (option_mask32 & 0x1) interval = xatou(sinterval); // -d |
540 | if (option_mask32 & 0x2) iterations = xatou(siterations); // -n | 540 | if (option_mask32 & 0x2) iterations = xatou(siterations); // -n |
541 | //if (option_mask32 & 0x4) // -b | 541 | //if (option_mask32 & 0x4) // -b |
diff --git a/procps/watch.c b/procps/watch.c index b2adcd5ce..3d18105bf 100644 --- a/procps/watch.c +++ b/procps/watch.c | |||
@@ -35,7 +35,7 @@ int watch_main(int argc, char **argv) | |||
35 | char **p; | 35 | char **p; |
36 | 36 | ||
37 | opt_complementary = "-1"; // at least one param please | 37 | opt_complementary = "-1"; // at least one param please |
38 | opt = getopt32(argc, argv, "+dtn:", &tmp); | 38 | opt = getopt32(argv, "+dtn:", &tmp); |
39 | //if (opt & 0x1) // -d (ignore) | 39 | //if (opt & 0x1) // -d (ignore) |
40 | //if (opt & 0x2) // -t | 40 | //if (opt & 0x2) // -t |
41 | if (opt & 0x4) period = xatou(tmp); | 41 | if (opt & 0x4) period = xatou(tmp); |
diff --git a/runit/chpst.c b/runit/chpst.c index 8eb1e8af6..87cd8e04a 100644 --- a/runit/chpst.c +++ b/runit/chpst.c | |||
@@ -266,7 +266,7 @@ int chpst_main(int argc, char **argv) | |||
266 | 266 | ||
267 | { | 267 | { |
268 | char *m,*d,*o,*p,*f,*c,*r,*t,*n; | 268 | char *m,*d,*o,*p,*f,*c,*r,*t,*n; |
269 | getopt32(argc, argv, "+u:U:e:m:d:o:p:f:c:r:t:/:n:vP012", | 269 | getopt32(argv, "+u:U:e:m:d:o:p:f:c:r:t:/:n:vP012", |
270 | &set_user,&env_user,&env_dir, | 270 | &set_user,&env_user,&env_dir, |
271 | &m,&d,&o,&p,&f,&c,&r,&t,&root,&n); | 271 | &m,&d,&o,&p,&f,&c,&r,&t,&root,&n); |
272 | // if (option_mask32 & 0x1) // -u | 272 | // if (option_mask32 & 0x1) // -u |
@@ -353,7 +353,7 @@ static void envdir(int argc, char **argv) | |||
353 | static void softlimit(int argc, char **argv) | 353 | static void softlimit(int argc, char **argv) |
354 | { | 354 | { |
355 | char *a,*c,*d,*f,*l,*m,*o,*p,*r,*s,*t; | 355 | char *a,*c,*d,*f,*l,*m,*o,*p,*r,*s,*t; |
356 | getopt32(argc, argv, "+a:c:d:f:l:m:o:p:r:s:t:", | 356 | getopt32(argv, "+a:c:d:f:l:m:o:p:r:s:t:", |
357 | &a,&c,&d,&f,&l,&m,&o,&p,&r,&s,&t); | 357 | &a,&c,&d,&f,&l,&m,&o,&p,&r,&s,&t); |
358 | if (option_mask32 & 0x001) limita = xatoul(a); // -a | 358 | if (option_mask32 & 0x001) limita = xatoul(a); // -a |
359 | if (option_mask32 & 0x002) limitc = xatoul(c); // -c | 359 | if (option_mask32 & 0x002) limitc = xatoul(c); // -c |
diff --git a/runit/sv.c b/runit/sv.c index 9181fff75..e9bfc75c5 100644 --- a/runit/sv.c +++ b/runit/sv.c | |||
@@ -427,7 +427,7 @@ int sv_main(int argc, char **argv) | |||
427 | x = getenv("SVWAIT"); | 427 | x = getenv("SVWAIT"); |
428 | if (x) waitsec = xatoul(x); | 428 | if (x) waitsec = xatoul(x); |
429 | 429 | ||
430 | opt = getopt32(argc, argv, "w:v", &x); | 430 | opt = getopt32(argv, "w:v", &x); |
431 | if (opt & 1) waitsec = xatoul(x); // -w | 431 | if (opt & 1) waitsec = xatoul(x); // -w |
432 | if (opt & 2) verbose = 1; // -v | 432 | if (opt & 2) verbose = 1; // -v |
433 | argc -= optind; | 433 | argc -= optind; |
diff --git a/runit/svlogd.c b/runit/svlogd.c index e16043e44..467845122 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c | |||
@@ -759,7 +759,7 @@ int svlogd_main(int argc, char **argv) | |||
759 | #define line bb_common_bufsiz1 | 759 | #define line bb_common_bufsiz1 |
760 | 760 | ||
761 | opt_complementary = "tt:vv"; | 761 | opt_complementary = "tt:vv"; |
762 | opt = getopt32(argc, argv, "r:R:l:b:tv", | 762 | opt = getopt32(argv, "r:R:l:b:tv", |
763 | &r, &replace, &l, &b, ×tamp, &verbose); | 763 | &r, &replace, &l, &b, ×tamp, &verbose); |
764 | if (opt & 1) { // -r | 764 | if (opt & 1) { // -r |
765 | repl = r[0]; | 765 | repl = r[0]; |
diff --git a/selinux/chcon.c b/selinux/chcon.c index a9552281d..f0590b5b0 100644 --- a/selinux/chcon.c +++ b/selinux/chcon.c | |||
@@ -136,7 +136,7 @@ int chcon_main(int argc, char **argv) | |||
136 | ":\xff--urtl:u--\xff:r--\xff:t--\xff:l--\xff" | 136 | ":\xff--urtl:u--\xff:r--\xff:t--\xff:l--\xff" |
137 | #endif | 137 | #endif |
138 | ":f--v:v--f"; /* 'verbose' and 'quiet' are exclusive */ | 138 | ":f--v:v--f"; /* 'verbose' and 'quiet' are exclusive */ |
139 | getopt32(argc, argv, "Rchf:u:r:t:l:v", | 139 | getopt32(argv, "Rchf:u:r:t:l:v", |
140 | &user, &role, &type, &range, &reference_file); | 140 | &user, &role, &type, &range, &reference_file); |
141 | argv += optind; | 141 | argv += optind; |
142 | 142 | ||
diff --git a/selinux/getsebool.c b/selinux/getsebool.c index b059003c1..06a298061 100644 --- a/selinux/getsebool.c +++ b/selinux/getsebool.c | |||
@@ -16,7 +16,7 @@ int getsebool_main(int argc, char **argv) | |||
16 | unsigned opt; | 16 | unsigned opt; |
17 | 17 | ||
18 | selinux_or_die(); | 18 | selinux_or_die(); |
19 | opt = getopt32(argc, argv, "a"); | 19 | opt = getopt32(argv, "a"); |
20 | 20 | ||
21 | if (opt) { /* -a */ | 21 | if (opt) { /* -a */ |
22 | if (argc > 2) | 22 | if (argc > 2) |
diff --git a/selinux/matchpathcon.c b/selinux/matchpathcon.c index 8d681d02f..2bc0a3304 100644 --- a/selinux/matchpathcon.c +++ b/selinux/matchpathcon.c | |||
@@ -38,7 +38,7 @@ int matchpathcon_main(int argc, char **argv) | |||
38 | 38 | ||
39 | opt_complementary = "-1" /* at least one param reqd */ | 39 | opt_complementary = "-1" /* at least one param reqd */ |
40 | ":?:f--p:p--f"; /* mutually exclusive */ | 40 | ":?:f--p:p--f"; /* mutually exclusive */ |
41 | opts = getopt32(argc, argv, "nNf:p:V", &fcontext, &prefix); | 41 | opts = getopt32(argv, "nNf:p:V", &fcontext, &prefix); |
42 | argv += optind; | 42 | argv += optind; |
43 | 43 | ||
44 | if (opts & OPT_NOT_TRANS) { | 44 | if (opts & OPT_NOT_TRANS) { |
diff --git a/selinux/runcon.c b/selinux/runcon.c index 015a23322..37ac5d18f 100644 --- a/selinux/runcon.c +++ b/selinux/runcon.c | |||
@@ -104,7 +104,7 @@ int runcon_main(int argc, char **argv) | |||
104 | applet_long_options = runcon_longopts; | 104 | applet_long_options = runcon_longopts; |
105 | #endif | 105 | #endif |
106 | opt_complementary = "-1"; | 106 | opt_complementary = "-1"; |
107 | opts = getopt32(argc, argv, "r:t:u:l:ch", &role, &type, &user, &range); | 107 | opts = getopt32(argv, "r:t:u:l:ch", &role, &type, &user, &range); |
108 | argv += optind; | 108 | argv += optind; |
109 | 109 | ||
110 | if (!(opts & OPTS_CONTEXT_COMPONENT)) { | 110 | if (!(opts & OPTS_CONTEXT_COMPONENT)) { |
diff --git a/selinux/setfiles.c b/selinux/setfiles.c index 08b911a03..174d4ce60 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c | |||
@@ -537,10 +537,10 @@ int setfiles_main(int argc, char **argv) | |||
537 | opt_complementary = "e::vv:v--p:p--v:v--q:q--v"; | 537 | opt_complementary = "e::vv:v--p:p--v:v--q:q--v"; |
538 | /* Option order must match OPT_x definitions! */ | 538 | /* Option order must match OPT_x definitions! */ |
539 | if (applet_name[0] == 'r') { /* restorecon */ | 539 | if (applet_name[0] == 'r') { /* restorecon */ |
540 | flags = getopt32(argc, argv, "de:f:ilnpqrsvo:FWR", | 540 | flags = getopt32(argv, "de:f:ilnpqrsvo:FWR", |
541 | &exclude_dir, &input_filename, &out_filename, &verbose); | 541 | &exclude_dir, &input_filename, &out_filename, &verbose); |
542 | } else { /* setfiles */ | 542 | } else { /* setfiles */ |
543 | flags = getopt32(argc, argv, "de:f:ilnpqr:svo:FW" | 543 | flags = getopt32(argv, "de:f:ilnpqr:svo:FW" |
544 | USE_FEATURE_SETFILES_CHECK_OPTION("c:"), | 544 | USE_FEATURE_SETFILES_CHECK_OPTION("c:"), |
545 | &exclude_dir, &input_filename, &rootpath, &out_filename, | 545 | &exclude_dir, &input_filename, &rootpath, &out_filename, |
546 | USE_FEATURE_SETFILES_CHECK_OPTION(&policyfile,) | 546 | USE_FEATURE_SETFILES_CHECK_OPTION(&policyfile,) |
diff --git a/shell/bbsh.c b/shell/bbsh.c index 4fd071404..09c4bd9a2 100644 --- a/shell/bbsh.c +++ b/shell/bbsh.c | |||
@@ -204,7 +204,7 @@ int bbsh_main(int argc, char **argv) | |||
204 | char *command=NULL; | 204 | char *command=NULL; |
205 | FILE *f; | 205 | FILE *f; |
206 | 206 | ||
207 | getopt32(argc, argv, "c:", &command); | 207 | getopt32(argv, "c:", &command); |
208 | 208 | ||
209 | f = argv[optind] ? xfopen(argv[optind],"r") : NULL; | 209 | f = argv[optind] ? xfopen(argv[optind],"r") : NULL; |
210 | if (command) handle(command); | 210 | if (command) handle(command); |
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c index fcc574686..2af410590 100644 --- a/sysklogd/klogd.c +++ b/sysklogd/klogd.c | |||
@@ -42,7 +42,7 @@ int klogd_main(int argc, char **argv) | |||
42 | char *start; | 42 | char *start; |
43 | 43 | ||
44 | /* do normal option parsing */ | 44 | /* do normal option parsing */ |
45 | getopt32(argc, argv, "c:n", &start); | 45 | getopt32(argv, "c:n", &start); |
46 | 46 | ||
47 | if (option_mask32 & OPT_LEVEL) { | 47 | if (option_mask32 & OPT_LEVEL) { |
48 | /* Valid levels are between 1 and 8 */ | 48 | /* Valid levels are between 1 and 8 */ |
diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 3f67aff5c..df5d8ff7e 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c | |||
@@ -93,7 +93,7 @@ int logger_main(int argc, char **argv) | |||
93 | str_t = name; | 93 | str_t = name; |
94 | 94 | ||
95 | /* Parse any options */ | 95 | /* Parse any options */ |
96 | getopt32(argc, argv, "p:st:", &str_p, &str_t); | 96 | getopt32(argv, "p:st:", &str_p, &str_t); |
97 | 97 | ||
98 | if (option_mask32 & 0x2) /* -s */ | 98 | if (option_mask32 & 0x2) /* -s */ |
99 | i |= LOG_PERROR; | 99 | i |= LOG_PERROR; |
diff --git a/sysklogd/logread.c b/sysklogd/logread.c index 597e285a5..69a084ff6 100644 --- a/sysklogd/logread.c +++ b/sysklogd/logread.c | |||
@@ -59,7 +59,7 @@ int logread_main(int argc, char **argv) | |||
59 | int cur; | 59 | int cur; |
60 | int log_semid; /* ipc semaphore id */ | 60 | int log_semid; /* ipc semaphore id */ |
61 | int log_shmid; /* ipc shared memory id */ | 61 | int log_shmid; /* ipc shared memory id */ |
62 | smallint follow = getopt32(argc, argv, "f"); | 62 | smallint follow = getopt32(argv, "f"); |
63 | 63 | ||
64 | log_shmid = shmget(KEY_ID, 0, 0); | 64 | log_shmid = shmget(KEY_ID, 0, 0); |
65 | if (log_shmid == -1) | 65 | if (log_shmid == -1) |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 72ecc6de1..5b153f509 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -573,7 +573,7 @@ int syslogd_main(int argc, char **argv) | |||
573 | 573 | ||
574 | /* do normal option parsing */ | 574 | /* do normal option parsing */ |
575 | opt_complementary = "=0"; /* no non-option params */ | 575 | opt_complementary = "=0"; /* no non-option params */ |
576 | getopt32(argc, argv, OPTION_STR, OPTION_PARAM); | 576 | getopt32(argv, OPTION_STR, OPTION_PARAM); |
577 | #ifdef SYSLOGD_MARK | 577 | #ifdef SYSLOGD_MARK |
578 | if (option_mask32 & OPT_mark) // -m | 578 | if (option_mask32 & OPT_mark) // -m |
579 | G.markInterval = xatou_range(opt_m, 0, INT_MAX/60) * 60; | 579 | G.markInterval = xatou_range(opt_m, 0, INT_MAX/60) * 60; |
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 0c1c6fabb..909cbd24e 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c | |||
@@ -16,7 +16,7 @@ int dmesg_main(int argc, char **argv); | |||
16 | int dmesg_main(int argc, char **argv) | 16 | int dmesg_main(int argc, char **argv) |
17 | { | 17 | { |
18 | char *size, *level; | 18 | char *size, *level; |
19 | int flags = getopt32(argc, argv, "cs:n:", &size, &level); | 19 | int flags = getopt32(argv, "cs:n:", &size, &level); |
20 | 20 | ||
21 | if (flags & 4) { | 21 | if (flags & 4) { |
22 | if (klogctl(8, NULL, xatoul_range(level, 0, 10))) | 22 | if (klogctl(8, NULL, xatoul_range(level, 0, 10))) |
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index 5e253efa8..dc45e23c0 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c | |||
@@ -57,7 +57,7 @@ int fdformat_main(int argc,char **argv) | |||
57 | if (argc < 2) { | 57 | if (argc < 2) { |
58 | bb_show_usage(); | 58 | bb_show_usage(); |
59 | } | 59 | } |
60 | verify = !getopt32(argc, argv, "n"); | 60 | verify = !getopt32(argv, "n"); |
61 | argv += optind; | 61 | argv += optind; |
62 | 62 | ||
63 | xstat(*argv, &st); | 63 | xstat(*argv, &st); |
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 2933db472..2a91a8f2f 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -2752,7 +2752,7 @@ int fdisk_main(int argc, char **argv) | |||
2752 | 2752 | ||
2753 | PTR_TO_GLOBALS = xzalloc(sizeof(G)); | 2753 | PTR_TO_GLOBALS = xzalloc(sizeof(G)); |
2754 | 2754 | ||
2755 | opt = getopt32(argc, argv, "b:C:H:lS:u" USE_FEATURE_FDISK_BLKSIZE("s"), | 2755 | opt = getopt32(argv, "b:C:H:lS:u" USE_FEATURE_FDISK_BLKSIZE("s"), |
2756 | &str_b, &str_C, &str_H, &str_S); | 2756 | &str_b, &str_C, &str_H, &str_S); |
2757 | argc -= optind; | 2757 | argc -= optind; |
2758 | argv += optind; | 2758 | argv += optind; |
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 246017036..94fb45761 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -314,11 +314,11 @@ int getopt_main(int argc, char *argv[]) | |||
314 | } | 314 | } |
315 | 315 | ||
316 | #if !ENABLE_GETOPT_LONG | 316 | #if !ENABLE_GETOPT_LONG |
317 | opt = getopt32(argc, argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg); | 317 | opt = getopt32(argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg); |
318 | #else | 318 | #else |
319 | applet_long_options = getopt_longopts; | 319 | applet_long_options = getopt_longopts; |
320 | opt_complementary = "l::"; | 320 | opt_complementary = "l::"; |
321 | opt = getopt32(argc, argv, "+o:n:qQs:Tual:", | 321 | opt = getopt32(argv, "+o:n:qQs:Tual:", |
322 | &optstr, &name, &s_arg, &l_arg); | 322 | &optstr, &name, &s_arg, &l_arg); |
323 | /* Effectuate the read options for the applet itself */ | 323 | /* Effectuate the read options for the applet itself */ |
324 | while (l_arg) { | 324 | while (l_arg) { |
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index fcb7308fe..09b09eb6f 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c | |||
@@ -189,7 +189,7 @@ int hwclock_main(int argc, char **argv) | |||
189 | applet_long_options = hwclock_longopts; | 189 | applet_long_options = hwclock_longopts; |
190 | #endif | 190 | #endif |
191 | opt_complementary = "r--ws:w--rs:s--wr:l--u:u--l"; | 191 | opt_complementary = "r--ws:w--rs:s--wr:l--u:u--l"; |
192 | opt = getopt32(argc, argv, "lurswf:", &rtcname); | 192 | opt = getopt32(argv, "lurswf:", &rtcname); |
193 | 193 | ||
194 | /* If -u or -l wasn't given check if we are using utc */ | 194 | /* If -u or -l wasn't given check if we are using utc */ |
195 | if (opt & (HWCLOCK_OPT_UTC | HWCLOCK_OPT_LOCALTIME)) | 195 | if (opt & (HWCLOCK_OPT_UTC | HWCLOCK_OPT_LOCALTIME)) |
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index d7d901921..e11c2de04 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c | |||
@@ -574,7 +574,7 @@ int ipcs_main(int argc, char **argv) | |||
574 | #define flag_sem (1<<2) | 574 | #define flag_sem (1<<2) |
575 | #define flag_shm (1<<3) | 575 | #define flag_shm (1<<3) |
576 | 576 | ||
577 | opt = getopt32(argc, argv, "i:aqsmtcplu", &opt_i); | 577 | opt = getopt32(argv, "i:aqsmtcplu", &opt_i); |
578 | if (opt & 0x1) { // -i | 578 | if (opt & 0x1) { // -i |
579 | id = xatoi(opt_i); | 579 | id = xatoi(opt_i); |
580 | flags |= flag_print; | 580 | flags |= flag_print; |
diff --git a/util-linux/losetup.c b/util-linux/losetup.c index e2d4e4d79..9409cdff5 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c | |||
@@ -18,7 +18,7 @@ int losetup_main(int argc, char **argv) | |||
18 | char *opt_o; | 18 | char *opt_o; |
19 | unsigned long long offset = 0; | 19 | unsigned long long offset = 0; |
20 | 20 | ||
21 | opt = getopt32(argc, argv, "do:", &opt_o); | 21 | opt = getopt32(argv, "do:", &opt_o); |
22 | argc -= optind; | 22 | argc -= optind; |
23 | argv += optind; | 23 | argv += optind; |
24 | 24 | ||
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 34a4a91ab..2b0697ae5 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
@@ -626,7 +626,7 @@ int mkfs_minix_main(int argc, char **argv) | |||
626 | bb_error_msg_and_die("bad inode size"); | 626 | bb_error_msg_and_die("bad inode size"); |
627 | #endif | 627 | #endif |
628 | 628 | ||
629 | opt = getopt32(argc, argv, "ci:l:n:v", &str_i, &listfile, &str_n); | 629 | opt = getopt32(argv, "ci:l:n:v", &str_i, &listfile, &str_n); |
630 | argv += optind; | 630 | argv += optind; |
631 | //if (opt & 1) -c | 631 | //if (opt & 1) -c |
632 | if (opt & 2) G.req_nr_inodes = xatoul(str_i); // -i | 632 | if (opt & 2) G.req_nr_inodes = xatoul(str_i); // -i |
diff --git a/util-linux/mount.c b/util-linux/mount.c index bd7ecc258..e9bf2a8d3 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -1554,7 +1554,7 @@ int mount_main(int argc, char **argv) | |||
1554 | 1554 | ||
1555 | // Parse remaining options | 1555 | // Parse remaining options |
1556 | 1556 | ||
1557 | opt = getopt32(argc, argv, "o:t:rwanfvs", &opt_o, &fstype); | 1557 | opt = getopt32(argv, "o:t:rwanfvs", &opt_o, &fstype); |
1558 | if (opt & 0x1) append_mount_options(&cmdopts, opt_o); // -o | 1558 | if (opt & 0x1) append_mount_options(&cmdopts, opt_o); // -o |
1559 | //if (opt & 0x2) // -t | 1559 | //if (opt & 0x2) // -t |
1560 | if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r | 1560 | if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r |
diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 9166546ae..4387f04de 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c | |||
@@ -49,7 +49,7 @@ int rdate_main(int argc, char **argv) | |||
49 | unsigned long flags; | 49 | unsigned long flags; |
50 | 50 | ||
51 | opt_complementary = "-1"; | 51 | opt_complementary = "-1"; |
52 | flags = getopt32(argc, argv, "sp"); | 52 | flags = getopt32(argv, "sp"); |
53 | 53 | ||
54 | remote_time = askremotedate(argv[optind]); | 54 | remote_time = askremotedate(argv[optind]); |
55 | 55 | ||
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index 347621c19..152137654 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c | |||
@@ -67,7 +67,7 @@ int readprofile_main(int argc, char **argv) | |||
67 | mapFile = defaultmap; | 67 | mapFile = defaultmap; |
68 | 68 | ||
69 | opt_complementary = "nn:aa:bb:ss:ii:rr:vv"; | 69 | opt_complementary = "nn:aa:bb:ss:ii:rr:vv"; |
70 | getopt32(argc, argv, "M:m:p:nabsirv", | 70 | getopt32(argv, "M:m:p:nabsirv", |
71 | &mult, &mapFile, &proFile, | 71 | &mult, &mapFile, &proFile, |
72 | &optNative, &optAll, &optBins, &optSub, | 72 | &optNative, &optAll, &optBins, &optSub, |
73 | &optInfo, &optReset, &optVerbose); | 73 | &optInfo, &optReset, &optVerbose); |
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index cb1bbe940..73fe105a9 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
@@ -66,7 +66,7 @@ int swap_on_off_main(int argc, char **argv) | |||
66 | if (argc == 1) | 66 | if (argc == 1) |
67 | bb_show_usage(); | 67 | bb_show_usage(); |
68 | 68 | ||
69 | ret = getopt32(argc, argv, "a"); | 69 | ret = getopt32(argv, "a"); |
70 | if (ret) | 70 | if (ret) |
71 | return do_em_all(); | 71 | return do_em_all(); |
72 | 72 | ||
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 72a2f46c1..e4e9e21ad 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c | |||
@@ -74,7 +74,7 @@ int switch_root_main(int argc, char **argv) | |||
74 | // Parse args (-c console) | 74 | // Parse args (-c console) |
75 | 75 | ||
76 | opt_complementary = "-2"; | 76 | opt_complementary = "-2"; |
77 | getopt32(argc, argv, "c:", &console); | 77 | getopt32(argv, "c:", &console); |
78 | argv += optind; | 78 | argv += optind; |
79 | 79 | ||
80 | // Change to new root directory and verify it's a different fs. | 80 | // Change to new root directory and verify it's a different fs. |
diff --git a/util-linux/umount.c b/util-linux/umount.c index 7063a474d..16d3dfb82 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -38,7 +38,7 @@ int umount_main(int argc, char **argv) | |||
38 | 38 | ||
39 | /* Parse any options */ | 39 | /* Parse any options */ |
40 | 40 | ||
41 | opt = getopt32(argc, argv, OPTION_STRING, &fstype); | 41 | opt = getopt32(argv, OPTION_STRING, &fstype); |
42 | 42 | ||
43 | argc -= optind; | 43 | argc -= optind; |
44 | argv += optind; | 44 | argv += optind; |