diff options
Diffstat (limited to 'coreutils')
36 files changed, 65 insertions, 67 deletions
diff --git a/coreutils/cal.c b/coreutils/cal.c index 8996aa8c7..ef914128c 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
@@ -91,7 +91,7 @@ int cal_main(int argc, char **argv) | |||
91 | setlocale(LC_TIME, ""); | 91 | setlocale(LC_TIME, ""); |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | flags = bb_getopt_ulflags(argc, argv, "jy"); | 94 | flags = getopt32(argc, argv, "jy"); |
95 | 95 | ||
96 | julian = flags & 1; | 96 | julian = flags & 1; |
97 | 97 | ||
diff --git a/coreutils/cat.c b/coreutils/cat.c index 37237ec1d..f3baf0a2d 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
@@ -18,7 +18,7 @@ int cat_main(int argc, char **argv) | |||
18 | FILE *f; | 18 | FILE *f; |
19 | int retval = EXIT_SUCCESS; | 19 | int retval = EXIT_SUCCESS; |
20 | 20 | ||
21 | bb_getopt_ulflags(argc, argv, "u"); | 21 | getopt32(argc, argv, "u"); |
22 | 22 | ||
23 | argv += optind; | 23 | argv += optind; |
24 | if (!*argv) { | 24 | if (!*argv) { |
diff --git a/coreutils/catv.c b/coreutils/catv.c index f8229c20e..55656b4b2 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c | |||
@@ -17,7 +17,7 @@ int catv_main(int argc, char **argv) | |||
17 | int retval = EXIT_SUCCESS, fd; | 17 | int retval = EXIT_SUCCESS, fd; |
18 | unsigned long flags; | 18 | unsigned long flags; |
19 | 19 | ||
20 | flags = bb_getopt_ulflags(argc, argv, "etv"); | 20 | flags = getopt32(argc, argv, "etv"); |
21 | #define CATV_OPT_e (1<<0) | 21 | #define CATV_OPT_e (1<<0) |
22 | #define CATV_OPT_t (1<<1) | 22 | #define CATV_OPT_t (1<<1) |
23 | #define CATV_OPT_v (1<<2) | 23 | #define CATV_OPT_v (1<<2) |
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c index 5064f2d6e..e62bd16f0 100644 --- a/coreutils/chgrp.c +++ b/coreutils/chgrp.c | |||
@@ -31,7 +31,7 @@ int chgrp_main(int argc, char **argv) | |||
31 | int recursiveFlag; | 31 | int recursiveFlag; |
32 | int retval = EXIT_SUCCESS; | 32 | int retval = EXIT_SUCCESS; |
33 | 33 | ||
34 | recursiveFlag = bb_getopt_ulflags(argc, argv, "R"); | 34 | recursiveFlag = getopt32(argc, argv, "R"); |
35 | 35 | ||
36 | if (argc - optind < 2) { | 36 | if (argc - optind < 2) { |
37 | bb_show_usage(); | 37 | bb_show_usage(); |
diff --git a/coreutils/chown.c b/coreutils/chown.c index bb379ac20..b73f66a89 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -43,7 +43,7 @@ int chown_main(int argc, char **argv) | |||
43 | int retval = EXIT_SUCCESS; | 43 | int retval = EXIT_SUCCESS; |
44 | char *groupName; | 44 | char *groupName; |
45 | 45 | ||
46 | flags = bb_getopt_ulflags(argc, argv, "Rh"); | 46 | flags = getopt32(argc, argv, "Rh"); |
47 | 47 | ||
48 | if (flags & FLAG_h) chown_func = lchown; | 48 | if (flags & FLAG_h) chown_func = lchown; |
49 | 49 | ||
diff --git a/coreutils/cmp.c b/coreutils/cmp.c index d0d976997..07858c64e 100644 --- a/coreutils/cmp.c +++ b/coreutils/cmp.c | |||
@@ -54,7 +54,7 @@ int cmp_main(int argc, char **argv) | |||
54 | 54 | ||
55 | xfunc_error_retval = 2; /* 1 is returned if files are different. */ | 55 | xfunc_error_retval = 2; /* 1 is returned if files are different. */ |
56 | 56 | ||
57 | opt = bb_getopt_ulflags(argc, argv, opt_chars); | 57 | opt = getopt32(argc, argv, opt_chars); |
58 | 58 | ||
59 | if (((opt & (CMP_OPT_s|CMP_OPT_l)) == (CMP_OPT_s|CMP_OPT_l)) | 59 | if (((opt & (CMP_OPT_s|CMP_OPT_l)) == (CMP_OPT_s|CMP_OPT_l)) |
60 | || (((unsigned int)(--argc - optind)) > 1)) | 60 | || (((unsigned int)(--argc - optind)) > 1)) |
diff --git a/coreutils/comm.c b/coreutils/comm.c index 7524a7b25..91f017753 100644 --- a/coreutils/comm.c +++ b/coreutils/comm.c | |||
@@ -112,7 +112,7 @@ int comm_main(int argc, char **argv) | |||
112 | { | 112 | { |
113 | unsigned long flags; | 113 | unsigned long flags; |
114 | 114 | ||
115 | flags = bb_getopt_ulflags(argc, argv, "123"); | 115 | flags = getopt32(argc, argv, "123"); |
116 | 116 | ||
117 | if (optind + 2 != argc) | 117 | if (optind + 2 != argc) |
118 | bb_show_usage(); | 118 | bb_show_usage(); |
diff --git a/coreutils/cp.c b/coreutils/cp.c index 85086aab5..fabfe58e0 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
@@ -39,7 +39,7 @@ int cp_main(int argc, char **argv) | |||
39 | int flags; | 39 | int flags; |
40 | int status = 0; | 40 | int status = 0; |
41 | 41 | ||
42 | flags = bb_getopt_ulflags(argc, argv, "pdRfiarPHL"); | 42 | flags = getopt32(argc, argv, "pdRfiarPHL"); |
43 | 43 | ||
44 | if (flags & 32) { | 44 | if (flags & 32) { |
45 | flags |= (FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR | FILEUTILS_DEREFERENCE); | 45 | flags |= (FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR | FILEUTILS_DEREFERENCE); |
diff --git a/coreutils/cut.c b/coreutils/cut.c index d88a891b0..30dbc02db 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -12,14 +12,13 @@ | |||
12 | #include "busybox.h" | 12 | #include "busybox.h" |
13 | 13 | ||
14 | /* option vars */ | 14 | /* option vars */ |
15 | static const char *const optstring = "b:c:f:d:sn"; | 15 | static const char optstring[] = "b:c:f:d:sn"; |
16 | |||
17 | #define CUT_OPT_BYTE_FLGS (1<<0) | 16 | #define CUT_OPT_BYTE_FLGS (1<<0) |
18 | #define CUT_OPT_CHAR_FLGS (1<<1) | 17 | #define CUT_OPT_CHAR_FLGS (1<<1) |
19 | #define CUT_OPT_FIELDS_FLGS (1<<2) | 18 | #define CUT_OPT_FIELDS_FLGS (1<<2) |
20 | #define CUT_OPT_DELIM_FLGS (1<<3) | 19 | #define CUT_OPT_DELIM_FLGS (1<<3) |
21 | #define CUT_OPT_SUPPRESS_FLGS (1<<4) | 20 | #define CUT_OPT_SUPPRESS_FLGS (1<<4) |
22 | static unsigned long opt; | 21 | static unsigned opt; |
23 | 22 | ||
24 | static char delim = '\t'; /* delimiter, default is tab */ | 23 | static char delim = '\t'; /* delimiter, default is tab */ |
25 | 24 | ||
@@ -179,9 +178,8 @@ int cut_main(int argc, char **argv) | |||
179 | { | 178 | { |
180 | char *sopt, *ltok; | 179 | char *sopt, *ltok; |
181 | 180 | ||
182 | bb_opt_complementally = "b--bcf:c--bcf:f--bcf"; | 181 | opt_complementary = "b--bcf:c--bcf:f--bcf"; |
183 | opt = | 182 | opt = getopt32(argc, argv, optstring, &sopt, &sopt, &sopt, <ok); |
184 | bb_getopt_ulflags(argc, argv, optstring, &sopt, &sopt, &sopt, <ok); | ||
185 | if (!(opt & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) | 183 | if (!(opt & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) |
186 | bb_error_msg_and_die | 184 | bb_error_msg_and_die |
187 | ("expected a list of bytes, characters, or fields"); | 185 | ("expected a list of bytes, characters, or fields"); |
diff --git a/coreutils/date.c b/coreutils/date.c index 2a82e0413..74e99665d 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -42,7 +42,7 @@ int date_main(int argc, char **argv) | |||
42 | { | 42 | { |
43 | time_t tm; | 43 | time_t tm; |
44 | struct tm tm_time; | 44 | struct tm tm_time; |
45 | unsigned long opt; | 45 | unsigned opt; |
46 | int ifmt = -1; | 46 | int ifmt = -1; |
47 | char *date_str = NULL; | 47 | char *date_str = NULL; |
48 | char *date_fmt = NULL; | 48 | char *date_fmt = NULL; |
@@ -50,9 +50,9 @@ int date_main(int argc, char **argv) | |||
50 | char *isofmt_arg; | 50 | char *isofmt_arg; |
51 | char *hintfmt_arg; | 51 | char *hintfmt_arg; |
52 | 52 | ||
53 | bb_opt_complementally = "?:d--s:s--d" | 53 | opt_complementary = "?:d--s:s--d" |
54 | USE_FEATURE_DATE_ISOFMT(":R--I:I--R"); | 54 | USE_FEATURE_DATE_ISOFMT(":R--I:I--R"); |
55 | opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" | 55 | opt = getopt32(argc, argv, "Rs:ud:r:" |
56 | USE_FEATURE_DATE_ISOFMT("I::D:"), | 56 | USE_FEATURE_DATE_ISOFMT("I::D:"), |
57 | &date_str, &date_str, &filename | 57 | &date_str, &date_str, &filename |
58 | USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg)); | 58 | USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg)); |
diff --git a/coreutils/df.c b/coreutils/df.c index 17ce634a7..94ead32eb 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -41,7 +41,7 @@ int df_main(int argc, char **argv) | |||
41 | unsigned long df_disp_hr = KILOBYTE; | 41 | unsigned long df_disp_hr = KILOBYTE; |
42 | #endif | 42 | #endif |
43 | int status = EXIT_SUCCESS; | 43 | int status = EXIT_SUCCESS; |
44 | unsigned long opt; | 44 | unsigned opt; |
45 | FILE *mount_table; | 45 | FILE *mount_table; |
46 | struct mntent *mount_entry; | 46 | struct mntent *mount_entry; |
47 | struct statfs s; | 47 | struct statfs s; |
@@ -49,8 +49,8 @@ int df_main(int argc, char **argv) | |||
49 | const char *disp_units_hdr = hdr_1k; | 49 | const char *disp_units_hdr = hdr_1k; |
50 | 50 | ||
51 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 51 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
52 | bb_opt_complementally = "h-km:k-hm:m-hk"; | 52 | opt_complementary = "h-km:k-hm:m-hk"; |
53 | opt = bb_getopt_ulflags(argc, argv, "hmk"); | 53 | opt = getopt32(argc, argv, "hmk"); |
54 | if(opt & 1) { | 54 | if(opt & 1) { |
55 | df_disp_hr = 0; | 55 | df_disp_hr = 0; |
56 | disp_units_hdr = " Size"; | 56 | disp_units_hdr = " Size"; |
@@ -60,7 +60,7 @@ int df_main(int argc, char **argv) | |||
60 | disp_units_hdr = "1M-blocks"; | 60 | disp_units_hdr = "1M-blocks"; |
61 | } | 61 | } |
62 | #else | 62 | #else |
63 | opt = bb_getopt_ulflags(argc, argv, "k"); | 63 | opt = getopt32(argc, argv, "k"); |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | bb_printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n", | 66 | bb_printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n", |
diff --git a/coreutils/diff.c b/coreutils/diff.c index 3c409b2cf..2edcd96ca 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c | |||
@@ -1164,9 +1164,9 @@ int diff_main(int argc, char **argv) | |||
1164 | char *U_opt; | 1164 | char *U_opt; |
1165 | llist_t *L_arg = NULL; | 1165 | llist_t *L_arg = NULL; |
1166 | 1166 | ||
1167 | bb_opt_complementally = "L::"; | 1167 | opt_complementary = "L::"; |
1168 | cmd_flags = | 1168 | cmd_flags = |
1169 | bb_getopt_ulflags(argc, argv, "abdiL:NqrsS:tTU:wu", &L_arg, &start, | 1169 | getopt32(argc, argv, "abdiL:NqrsS:tTU:wu", &L_arg, &start, |
1170 | &U_opt); | 1170 | &U_opt); |
1171 | 1171 | ||
1172 | if (cmd_flags & FLAG_L) { | 1172 | if (cmd_flags & FLAG_L) { |
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index 19f1a3257..a8038a6dd 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c | |||
@@ -93,11 +93,11 @@ int dos2unix_main(int argc, char *argv[]) | |||
93 | ConvType = CT_UNIX2DOS; /*1 */ | 93 | ConvType = CT_UNIX2DOS; /*1 */ |
94 | } | 94 | } |
95 | /* -u and -d are mutally exclusive */ | 95 | /* -u and -d are mutally exclusive */ |
96 | bb_opt_complementally = "?:u--d:d--u"; | 96 | opt_complementary = "?:u--d:d--u"; |
97 | /* process parameters */ | 97 | /* process parameters */ |
98 | /* -u convert to unix */ | 98 | /* -u convert to unix */ |
99 | /* -d convert to dos */ | 99 | /* -d convert to dos */ |
100 | o = bb_getopt_ulflags(argc, argv, "du"); | 100 | o = getopt32(argc, argv, "du"); |
101 | 101 | ||
102 | /* Do the conversion requested by an argument else do the default | 102 | /* Do the conversion requested by an argument else do the default |
103 | * conversion depending on our name. */ | 103 | * conversion depending on our name. */ |
diff --git a/coreutils/du.c b/coreutils/du.c index 3cc935553..1452e5883 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -153,7 +153,7 @@ int du_main(int argc, char **argv) | |||
153 | int slink_depth_save; | 153 | int slink_depth_save; |
154 | int print_final_total; | 154 | int print_final_total; |
155 | char *smax_print_depth; | 155 | char *smax_print_depth; |
156 | unsigned long opt; | 156 | unsigned opt; |
157 | 157 | ||
158 | #ifdef CONFIG_FEATURE_DU_DEFUALT_BLOCKSIZE_1K | 158 | #ifdef CONFIG_FEATURE_DU_DEFUALT_BLOCKSIZE_1K |
159 | if (getenv("POSIXLY_CORRECT")) { /* TODO - a new libbb function? */ | 159 | if (getenv("POSIXLY_CORRECT")) { /* TODO - a new libbb function? */ |
@@ -172,8 +172,8 @@ int du_main(int argc, char **argv) | |||
172 | * ignore -a. This is consistent with -s being equivalent to -d 0. | 172 | * ignore -a. This is consistent with -s being equivalent to -d 0. |
173 | */ | 173 | */ |
174 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 174 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
175 | bb_opt_complementally = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; | 175 | opt_complementary = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; |
176 | opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth); | 176 | opt = getopt32(argc, argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth); |
177 | if((opt & (1 << 9))) { | 177 | if((opt & (1 << 9))) { |
178 | /* -h opt */ | 178 | /* -h opt */ |
179 | disp_hr = 0; | 179 | disp_hr = 0; |
@@ -187,8 +187,8 @@ int du_main(int argc, char **argv) | |||
187 | disp_hr = KILOBYTE; | 187 | disp_hr = KILOBYTE; |
188 | } | 188 | } |
189 | #else | 189 | #else |
190 | bb_opt_complementally = "H-L:L-H:s-d:d-s"; | 190 | opt_complementary = "H-L:L-H:s-d:d-s"; |
191 | opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth); | 191 | opt = getopt32(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth); |
192 | #if !defined CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K | 192 | #if !defined CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K |
193 | if((opt & (1 << 2))) { | 193 | if((opt & (1 << 2))) { |
194 | /* -k opt */ | 194 | /* -k opt */ |
diff --git a/coreutils/env.c b/coreutils/env.c index 2af15a37e..d03318fea 100644 --- a/coreutils/env.c +++ b/coreutils/env.c | |||
@@ -46,16 +46,16 @@ int env_main(int argc, char** argv) | |||
46 | static char *cleanenv[1] = { NULL }; | 46 | static char *cleanenv[1] = { NULL }; |
47 | 47 | ||
48 | char **ep; | 48 | char **ep; |
49 | unsigned long opt; | 49 | unsigned opt; |
50 | llist_t *unset_env = NULL; | 50 | llist_t *unset_env = NULL; |
51 | extern char **environ; | 51 | extern char **environ; |
52 | 52 | ||
53 | bb_opt_complementally = "u::"; | 53 | opt_complementary = "u::"; |
54 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS | 54 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS |
55 | bb_applet_long_options = env_long_options; | 55 | applet_long_options = env_long_options; |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env); | 58 | opt = getopt32(argc, argv, "+iu:", &unset_env); |
59 | 59 | ||
60 | argv += optind; | 60 | argv += optind; |
61 | if (*argv && (argv[0][0] == '-') && !argv[0][1]) { | 61 | if (*argv && (argv[0][0] == '-') && !argv[0][1]) { |
diff --git a/coreutils/fold.c b/coreutils/fold.c index aff7bb1d9..3b5be64fe 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c | |||
@@ -60,7 +60,7 @@ int fold_main(int argc, char **argv) | |||
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | flags = bb_getopt_ulflags(argc, argv, "bsw:", &w_opt); | 63 | flags = getopt32(argc, argv, "bsw:", &w_opt); |
64 | if (flags & FLAG_WIDTH) | 64 | if (flags & FLAG_WIDTH) |
65 | width = bb_xgetlarg(w_opt, 10, 1, 10000); | 65 | width = bb_xgetlarg(w_opt, 10, 1, 10000); |
66 | 66 | ||
diff --git a/coreutils/head.c b/coreutils/head.c index 50694bfef..7d5f219d2 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -60,7 +60,7 @@ int head_main(int argc, char **argv) | |||
60 | } | 60 | } |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | /* No size benefit in converting this to bb_getopt_ulflags */ | 63 | /* No size benefit in converting this to getopt32 */ |
64 | while ((opt = getopt(argc, argv, head_opts)) > 0) { | 64 | while ((opt = getopt(argc, argv, head_opts)) > 0) { |
65 | switch (opt) { | 65 | switch (opt) { |
66 | #if ENABLE_FEATURE_FANCY_HEAD | 66 | #if ENABLE_FEATURE_FANCY_HEAD |
diff --git a/coreutils/id.c b/coreutils/id.c index 1bedff37a..dd825ab3c 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -50,8 +50,8 @@ int id_main(int argc, char **argv) | |||
50 | 50 | ||
51 | /* Don't allow -n -r -nr -ug -rug -nug -rnug */ | 51 | /* Don't allow -n -r -nr -ug -rug -nug -rnug */ |
52 | /* Don't allow more than one username */ | 52 | /* Don't allow more than one username */ |
53 | bb_opt_complementally = "?1:?:u--g:g--u:r?ug:n?ug"; | 53 | opt_complementary = "?1:?:u--g:g--u:r?ug:n?ug"; |
54 | flags = bb_getopt_ulflags(argc, argv, "rnug"); | 54 | flags = getopt32(argc, argv, "rnug"); |
55 | 55 | ||
56 | /* This values could be overwritten later */ | 56 | /* This values could be overwritten later */ |
57 | uid = geteuid(); | 57 | uid = geteuid(); |
diff --git a/coreutils/install.c b/coreutils/install.c index d3d6a58a1..2178d435d 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -45,11 +45,11 @@ int install_main(int argc, char **argv) | |||
45 | int ret = EXIT_SUCCESS, flags, i, isdir; | 45 | int ret = EXIT_SUCCESS, flags, i, isdir; |
46 | 46 | ||
47 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS | 47 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS |
48 | bb_applet_long_options = install_long_options; | 48 | applet_long_options = install_long_options; |
49 | #endif | 49 | #endif |
50 | bb_opt_complementally = "?:s--d:d--s"; | 50 | opt_complementary = "?:s--d:d--s"; |
51 | /* -c exists for backwards compatibility, its needed */ | 51 | /* -c exists for backwards compatibility, its needed */ |
52 | flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ | 52 | flags = getopt32(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ |
53 | 53 | ||
54 | /* preserve access and modification time, this is GNU behaviour, BSD only preserves modification time */ | 54 | /* preserve access and modification time, this is GNU behaviour, BSD only preserves modification time */ |
55 | if (flags & INSTALL_OPT_PRESERVE_TIME) { | 55 | if (flags & INSTALL_OPT_PRESERVE_TIME) { |
diff --git a/coreutils/libcoreutils/getopt_mk_fifo_nod.c b/coreutils/libcoreutils/getopt_mk_fifo_nod.c index d1f5b1e89..3a3d34118 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 | mode_t mode = 0666; | 31 | mode_t mode = 0666; |
32 | char *smode = NULL; | 32 | char *smode = NULL; |
33 | 33 | ||
34 | bb_getopt_ulflags(argc, argv, "m:", &smode); | 34 | getopt32(argc, argv, "m:", &smode); |
35 | if(smode) { | 35 | if(smode) { |
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 df183581e..cd6e470be 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -30,7 +30,7 @@ int ln_main(int argc, char **argv) | |||
30 | struct stat statbuf; | 30 | struct stat statbuf; |
31 | int (*link_func)(const char *, const char *); | 31 | int (*link_func)(const char *, const char *); |
32 | 32 | ||
33 | flag = bb_getopt_ulflags(argc, argv, "sfnbS:", &suffix); | 33 | flag = getopt32(argc, argv, "sfnbS:", &suffix); |
34 | 34 | ||
35 | if (argc == optind) { | 35 | if (argc == optind) { |
36 | bb_show_usage(); | 36 | bb_show_usage(); |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 0099f18fe..8ba4ab758 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -877,7 +877,7 @@ int ls_main(int argc, char **argv) | |||
877 | struct dnode **dnp; | 877 | struct dnode **dnp; |
878 | struct dnode *dn; | 878 | struct dnode *dn; |
879 | struct dnode *cur; | 879 | struct dnode *cur; |
880 | long opt; | 880 | unsigned opt; |
881 | int nfiles = 0; | 881 | int nfiles = 0; |
882 | int dnfiles; | 882 | int dnfiles; |
883 | int dndirs; | 883 | int dndirs; |
@@ -904,12 +904,12 @@ int ls_main(int argc, char **argv) | |||
904 | #endif | 904 | #endif |
905 | 905 | ||
906 | #ifdef CONFIG_FEATURE_LS_COLOR | 906 | #ifdef CONFIG_FEATURE_LS_COLOR |
907 | bb_applet_long_options = ls_color_opt; | 907 | applet_long_options = ls_color_opt; |
908 | #endif | 908 | #endif |
909 | 909 | ||
910 | /* process options */ | 910 | /* process options */ |
911 | #ifdef CONFIG_FEATURE_AUTOWIDTH | 911 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
912 | opt = bb_getopt_ulflags(argc, argv, ls_options, &tabstops_str, &terminal_width_str | 912 | opt = getopt32(argc, argv, ls_options, &tabstops_str, &terminal_width_str |
913 | #ifdef CONFIG_FEATURE_LS_COLOR | 913 | #ifdef CONFIG_FEATURE_LS_COLOR |
914 | , &color_opt | 914 | , &color_opt |
915 | #endif | 915 | #endif |
@@ -921,7 +921,7 @@ int ls_main(int argc, char **argv) | |||
921 | terminal_width = atoi(terminal_width_str); | 921 | terminal_width = atoi(terminal_width_str); |
922 | } | 922 | } |
923 | #else | 923 | #else |
924 | opt = bb_getopt_ulflags(argc, argv, ls_options | 924 | opt = getopt32(argc, argv, ls_options |
925 | #ifdef CONFIG_FEATURE_LS_COLOR | 925 | #ifdef CONFIG_FEATURE_LS_COLOR |
926 | , &color_opt | 926 | , &color_opt |
927 | #endif | 927 | #endif |
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index c10fac5d0..a99e45864 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -91,7 +91,7 @@ int md5_sha1_sum_main(int argc, char **argv) | |||
91 | : HASH_SHA1; | 91 | : HASH_SHA1; |
92 | 92 | ||
93 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) | 93 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) |
94 | flags = bb_getopt_ulflags(argc, argv, "scw"); | 94 | flags = getopt32(argc, argv, "scw"); |
95 | else optind = 1; | 95 | else optind = 1; |
96 | 96 | ||
97 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) { | 97 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) { |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index c09c72f7d..3fe55c395 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -34,13 +34,13 @@ int mkdir_main (int argc, char **argv) | |||
34 | mode_t mode = (mode_t)(-1); | 34 | mode_t mode = (mode_t)(-1); |
35 | int status = EXIT_SUCCESS; | 35 | int status = EXIT_SUCCESS; |
36 | int flags = 0; | 36 | int flags = 0; |
37 | unsigned long opt; | 37 | unsigned opt; |
38 | char *smode; | 38 | char *smode; |
39 | 39 | ||
40 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS | 40 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS |
41 | bb_applet_long_options = mkdir_long_options; | 41 | applet_long_options = mkdir_long_options; |
42 | #endif | 42 | #endif |
43 | opt = bb_getopt_ulflags(argc, argv, "m:p", &smode); | 43 | opt = getopt32(argc, argv, "m:p", &smode); |
44 | if(opt & 1) { | 44 | if(opt & 1) { |
45 | mode = 0777; | 45 | mode = 0777; |
46 | if (!bb_parse_mode (smode, &mode)) { | 46 | if (!bb_parse_mode (smode, &mode)) { |
diff --git a/coreutils/mv.c b/coreutils/mv.c index 274aecb45..770b42417 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -45,10 +45,10 @@ int mv_main(int argc, char **argv) | |||
45 | int status = 0; | 45 | int status = 0; |
46 | 46 | ||
47 | #if ENABLE_FEATURE_MV_LONG_OPTIONS | 47 | #if ENABLE_FEATURE_MV_LONG_OPTIONS |
48 | bb_applet_long_options = mv_long_options; | 48 | applet_long_options = mv_long_options; |
49 | #endif | 49 | #endif |
50 | bb_opt_complementally = "f-i:i-f"; | 50 | opt_complementary = "f-i:i-f"; |
51 | flags = bb_getopt_ulflags(argc, argv, "fi"); | 51 | flags = getopt32(argc, 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/rm.c b/coreutils/rm.c index c787ae342..490694a6e 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -22,10 +22,10 @@ int rm_main(int argc, char **argv) | |||
22 | { | 22 | { |
23 | int status = 0; | 23 | int status = 0; |
24 | int flags = 0; | 24 | int flags = 0; |
25 | unsigned long opt; | 25 | unsigned opt; |
26 | 26 | ||
27 | bb_opt_complementally = "f-i:i-f"; | 27 | opt_complementary = "f-i:i-f"; |
28 | opt = bb_getopt_ulflags(argc, argv, "fiRr"); | 28 | opt = getopt32(argc, argv, "fiRr"); |
29 | if(opt & 1) | 29 | if(opt & 1) |
30 | flags |= FILEUTILS_FORCE; | 30 | flags |= FILEUTILS_FORCE; |
31 | if(opt & 2) | 31 | if(opt & 2) |
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index e1ed34c6e..05ea0e9ff 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -22,7 +22,7 @@ int rmdir_main(int argc, char **argv) | |||
22 | int do_dot; | 22 | int do_dot; |
23 | char *path; | 23 | char *path; |
24 | 24 | ||
25 | flags = bb_getopt_ulflags(argc, argv, "p"); | 25 | flags = getopt32(argc, argv, "p"); |
26 | 26 | ||
27 | argv += optind; | 27 | argv += optind; |
28 | 28 | ||
diff --git a/coreutils/stat.c b/coreutils/stat.c index 8e0121849..b9fd42f4a 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -516,7 +516,7 @@ int stat_main(int argc, char **argv) | |||
516 | int ok = 1; | 516 | int ok = 1; |
517 | int (*statfunc)(char const *, char const *) = do_stat; | 517 | int (*statfunc)(char const *, char const *) = do_stat; |
518 | 518 | ||
519 | flags = bb_getopt_ulflags(argc, argv, "ftL" | 519 | flags = getopt32(argc, argv, "ftL" |
520 | USE_FEATURE_STAT_FORMAT("c:", &format) | 520 | USE_FEATURE_STAT_FORMAT("c:", &format) |
521 | ); | 521 | ); |
522 | 522 | ||
diff --git a/coreutils/sum.c b/coreutils/sum.c index 99d477fc3..61ca582a1 100644 --- a/coreutils/sum.c +++ b/coreutils/sum.c | |||
@@ -136,7 +136,7 @@ int sum_main(int argc, char **argv) | |||
136 | int (*sum_func)(const char *, int) = bsd_sum_file; | 136 | int (*sum_func)(const char *, int) = bsd_sum_file; |
137 | 137 | ||
138 | /* give the bsd func priority over sysv func */ | 138 | /* give the bsd func priority over sysv func */ |
139 | flags = bb_getopt_ulflags(argc, argv, "sr"); | 139 | flags = getopt32(argc, argv, "sr"); |
140 | if (flags & 1) | 140 | if (flags & 1) |
141 | sum_func = sysv_sum_file; | 141 | sum_func = sysv_sum_file; |
142 | if (flags & 2) | 142 | if (flags & 2) |
diff --git a/coreutils/tee.c b/coreutils/tee.c index 1f59f0361..a194153e0 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -28,7 +28,7 @@ int tee_main(int argc, char **argv) | |||
28 | int c; | 28 | int c; |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | flags = bb_getopt_ulflags(argc, argv, "ia"); /* 'a' must be 2nd */ | 31 | flags = getopt32(argc, argv, "ia"); /* 'a' must be 2nd */ |
32 | 32 | ||
33 | mode += (flags & 2); /* Since 'a' is the 2nd option... */ | 33 | mode += (flags & 2); /* Since 'a' is the 2nd option... */ |
34 | 34 | ||
diff --git a/coreutils/touch.c b/coreutils/touch.c index 76c05d8c8..e1af7d0dc 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -32,7 +32,7 @@ int touch_main(int argc, char **argv) | |||
32 | int flags; | 32 | int flags; |
33 | int status = EXIT_SUCCESS; | 33 | int status = EXIT_SUCCESS; |
34 | 34 | ||
35 | flags = bb_getopt_ulflags(argc, argv, "c"); | 35 | flags = getopt32(argc, argv, "c"); |
36 | 36 | ||
37 | argv += optind; | 37 | argv += optind; |
38 | 38 | ||
diff --git a/coreutils/tty.c b/coreutils/tty.c index eb8c3dd0f..579e6f73c 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c | |||
@@ -23,7 +23,7 @@ int tty_main(int argc, char **argv) | |||
23 | 23 | ||
24 | xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */ | 24 | xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */ |
25 | 25 | ||
26 | silent = bb_getopt_ulflags(argc, argv, "s"); | 26 | silent = getopt32(argc, argv, "s"); |
27 | 27 | ||
28 | /* gnu tty outputs a warning that it is ignoring all args. */ | 28 | /* gnu tty outputs a warning that it is ignoring all args. */ |
29 | bb_warn_ignoring_args(argc - optind); | 29 | bb_warn_ignoring_args(argc - optind); |
diff --git a/coreutils/uname.c b/coreutils/uname.c index da12c3aee..575fb525c 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c | |||
@@ -63,7 +63,7 @@ int uname_main(int argc, char **argv) | |||
63 | const unsigned short int *delta; | 63 | const unsigned short int *delta; |
64 | char toprint; | 64 | char toprint; |
65 | 65 | ||
66 | toprint = bb_getopt_ulflags(argc, argv, options); | 66 | toprint = getopt32(argc, argv, options); |
67 | 67 | ||
68 | if (argc != optind) { | 68 | if (argc != optind) { |
69 | bb_show_usage(); | 69 | bb_show_usage(); |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 21ebce3ac..921d29af0 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -129,7 +129,7 @@ int uudecode_main(int argc, char **argv) | |||
129 | char *outname = NULL; | 129 | char *outname = NULL; |
130 | char *line; | 130 | char *line; |
131 | 131 | ||
132 | bb_getopt_ulflags(argc, argv, "o:", &outname); | 132 | getopt32(argc, argv, "o:", &outname); |
133 | 133 | ||
134 | if (optind == argc) { | 134 | if (optind == argc) { |
135 | src_stream = stdin; | 135 | src_stream = stdin; |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 1a8882fc7..58538365e 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -27,7 +27,7 @@ int uuencode_main(int argc, char **argv) | |||
27 | RESERVE_CONFIG_BUFFER(dst_buf, DST_BUF_SIZE + 1); | 27 | RESERVE_CONFIG_BUFFER(dst_buf, DST_BUF_SIZE + 1); |
28 | 28 | ||
29 | tbl = bb_uuenc_tbl_std; | 29 | tbl = bb_uuenc_tbl_std; |
30 | if (bb_getopt_ulflags(argc, argv, "m") & 1) { | 30 | if (getopt32(argc, argv, "m") & 1) { |
31 | tbl = bb_uuenc_tbl_base64; | 31 | tbl = bb_uuenc_tbl_base64; |
32 | } | 32 | } |
33 | 33 | ||
diff --git a/coreutils/wc.c b/coreutils/wc.c index 6ddac4dec..359d9fd6d 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -87,7 +87,7 @@ int wc_main(int argc, char **argv) | |||
87 | char in_word; | 87 | char in_word; |
88 | unsigned print_type; | 88 | unsigned print_type; |
89 | 89 | ||
90 | print_type = bb_getopt_ulflags(argc, argv, "lwcL"); | 90 | print_type = getopt32(argc, argv, "lwcL"); |
91 | 91 | ||
92 | if (print_type == 0) { | 92 | if (print_type == 0) { |
93 | print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); | 93 | print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); |