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 /coreutils | |
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
Diffstat (limited to 'coreutils')
40 files changed, 44 insertions, 44 deletions
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); |