diff options
Diffstat (limited to 'coreutils')
36 files changed, 65 insertions, 67 deletions
diff --git a/coreutils/cal.c b/coreutils/cal.c index 8996aa8..ef91412 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c @@ -91,7 +91,7 @@ int cal_main(int argc, char **argv) setlocale(LC_TIME, ""); #endif - flags = bb_getopt_ulflags(argc, argv, "jy"); + flags = getopt32(argc, argv, "jy"); julian = flags & 1; diff --git a/coreutils/cat.c b/coreutils/cat.c index 37237ec..f3baf0a 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c @@ -18,7 +18,7 @@ int cat_main(int argc, char **argv) FILE *f; int retval = EXIT_SUCCESS; - bb_getopt_ulflags(argc, argv, "u"); + getopt32(argc, argv, "u"); argv += optind; if (!*argv) { diff --git a/coreutils/catv.c b/coreutils/catv.c index f8229c2..55656b4 100644 --- a/coreutils/catv.c +++ b/coreutils/catv.c @@ -17,7 +17,7 @@ int catv_main(int argc, char **argv) int retval = EXIT_SUCCESS, fd; unsigned long flags; - flags = bb_getopt_ulflags(argc, argv, "etv"); + flags = getopt32(argc, argv, "etv"); #define CATV_OPT_e (1<<0) #define CATV_OPT_t (1<<1) #define CATV_OPT_v (1<<2) diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c index 5064f2d..e62bd16 100644 --- a/coreutils/chgrp.c +++ b/coreutils/chgrp.c @@ -31,7 +31,7 @@ int chgrp_main(int argc, char **argv) int recursiveFlag; int retval = EXIT_SUCCESS; - recursiveFlag = bb_getopt_ulflags(argc, argv, "R"); + recursiveFlag = getopt32(argc, argv, "R"); if (argc - optind < 2) { bb_show_usage(); diff --git a/coreutils/chown.c b/coreutils/chown.c index bb379ac..b73f66a 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c @@ -43,7 +43,7 @@ int chown_main(int argc, char **argv) int retval = EXIT_SUCCESS; char *groupName; - flags = bb_getopt_ulflags(argc, argv, "Rh"); + flags = getopt32(argc, argv, "Rh"); if (flags & FLAG_h) chown_func = lchown; diff --git a/coreutils/cmp.c b/coreutils/cmp.c index d0d9769..07858c6 100644 --- a/coreutils/cmp.c +++ b/coreutils/cmp.c @@ -54,7 +54,7 @@ int cmp_main(int argc, char **argv) xfunc_error_retval = 2; /* 1 is returned if files are different. */ - opt = bb_getopt_ulflags(argc, argv, opt_chars); + opt = getopt32(argc, argv, opt_chars); if (((opt & (CMP_OPT_s|CMP_OPT_l)) == (CMP_OPT_s|CMP_OPT_l)) || (((unsigned int)(--argc - optind)) > 1)) diff --git a/coreutils/comm.c b/coreutils/comm.c index 7524a7b..91f0177 100644 --- a/coreutils/comm.c +++ b/coreutils/comm.c @@ -112,7 +112,7 @@ int comm_main(int argc, char **argv) { unsigned long flags; - flags = bb_getopt_ulflags(argc, argv, "123"); + flags = getopt32(argc, argv, "123"); if (optind + 2 != argc) bb_show_usage(); diff --git a/coreutils/cp.c b/coreutils/cp.c index 85086aa..fabfe58 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c @@ -39,7 +39,7 @@ int cp_main(int argc, char **argv) int flags; int status = 0; - flags = bb_getopt_ulflags(argc, argv, "pdRfiarPHL"); + flags = getopt32(argc, argv, "pdRfiarPHL"); if (flags & 32) { flags |= (FILEUTILS_PRESERVE_STATUS | FILEUTILS_RECUR | FILEUTILS_DEREFERENCE); diff --git a/coreutils/cut.c b/coreutils/cut.c index d88a891..30dbc02 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -12,14 +12,13 @@ #include "busybox.h" /* option vars */ -static const char *const optstring = "b:c:f:d:sn"; - +static const char optstring[] = "b:c:f:d:sn"; #define CUT_OPT_BYTE_FLGS (1<<0) #define CUT_OPT_CHAR_FLGS (1<<1) #define CUT_OPT_FIELDS_FLGS (1<<2) #define CUT_OPT_DELIM_FLGS (1<<3) #define CUT_OPT_SUPPRESS_FLGS (1<<4) -static unsigned long opt; +static unsigned opt; static char delim = '\t'; /* delimiter, default is tab */ @@ -179,9 +178,8 @@ int cut_main(int argc, char **argv) { char *sopt, *ltok; - bb_opt_complementally = "b--bcf:c--bcf:f--bcf"; - opt = - bb_getopt_ulflags(argc, argv, optstring, &sopt, &sopt, &sopt, <ok); + opt_complementary = "b--bcf:c--bcf:f--bcf"; + opt = getopt32(argc, argv, optstring, &sopt, &sopt, &sopt, <ok); if (!(opt & (CUT_OPT_BYTE_FLGS | CUT_OPT_CHAR_FLGS | CUT_OPT_FIELDS_FLGS))) bb_error_msg_and_die ("expected a list of bytes, characters, or fields"); diff --git a/coreutils/date.c b/coreutils/date.c index 2a82e04..74e9966 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -42,7 +42,7 @@ int date_main(int argc, char **argv) { time_t tm; struct tm tm_time; - unsigned long opt; + unsigned opt; int ifmt = -1; char *date_str = NULL; char *date_fmt = NULL; @@ -50,9 +50,9 @@ int date_main(int argc, char **argv) char *isofmt_arg; char *hintfmt_arg; - bb_opt_complementally = "?:d--s:s--d" + opt_complementary = "?:d--s:s--d" USE_FEATURE_DATE_ISOFMT(":R--I:I--R"); - opt = bb_getopt_ulflags(argc, argv, "Rs:ud:r:" + opt = getopt32(argc, argv, "Rs:ud:r:" USE_FEATURE_DATE_ISOFMT("I::D:"), &date_str, &date_str, &filename USE_FEATURE_DATE_ISOFMT(, &isofmt_arg, &hintfmt_arg)); diff --git a/coreutils/df.c b/coreutils/df.c index 17ce634..94ead32 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -41,7 +41,7 @@ int df_main(int argc, char **argv) unsigned long df_disp_hr = KILOBYTE; #endif int status = EXIT_SUCCESS; - unsigned long opt; + unsigned opt; FILE *mount_table; struct mntent *mount_entry; struct statfs s; @@ -49,8 +49,8 @@ int df_main(int argc, char **argv) const char *disp_units_hdr = hdr_1k; #ifdef CONFIG_FEATURE_HUMAN_READABLE - bb_opt_complementally = "h-km:k-hm:m-hk"; - opt = bb_getopt_ulflags(argc, argv, "hmk"); + opt_complementary = "h-km:k-hm:m-hk"; + opt = getopt32(argc, argv, "hmk"); if(opt & 1) { df_disp_hr = 0; disp_units_hdr = " Size"; @@ -60,7 +60,7 @@ int df_main(int argc, char **argv) disp_units_hdr = "1M-blocks"; } #else - opt = bb_getopt_ulflags(argc, argv, "k"); + opt = getopt32(argc, argv, "k"); #endif bb_printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n", diff --git a/coreutils/diff.c b/coreutils/diff.c index 3c409b2..2edcd96 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c @@ -1164,9 +1164,9 @@ int diff_main(int argc, char **argv) char *U_opt; llist_t *L_arg = NULL; - bb_opt_complementally = "L::"; + opt_complementary = "L::"; cmd_flags = - bb_getopt_ulflags(argc, argv, "abdiL:NqrsS:tTU:wu", &L_arg, &start, + getopt32(argc, argv, "abdiL:NqrsS:tTU:wu", &L_arg, &start, &U_opt); if (cmd_flags & FLAG_L) { diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index 19f1a32..a8038a6 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -93,11 +93,11 @@ int dos2unix_main(int argc, char *argv[]) ConvType = CT_UNIX2DOS; /*1 */ } /* -u and -d are mutally exclusive */ - bb_opt_complementally = "?:u--d:d--u"; + opt_complementary = "?:u--d:d--u"; /* process parameters */ /* -u convert to unix */ /* -d convert to dos */ - o = bb_getopt_ulflags(argc, argv, "du"); + o = getopt32(argc, argv, "du"); /* Do the conversion requested by an argument else do the default * conversion depending on our name. */ diff --git a/coreutils/du.c b/coreutils/du.c index 3cc9355..1452e58 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -153,7 +153,7 @@ int du_main(int argc, char **argv) int slink_depth_save; int print_final_total; char *smax_print_depth; - unsigned long opt; + unsigned opt; #ifdef CONFIG_FEATURE_DU_DEFUALT_BLOCKSIZE_1K if (getenv("POSIXLY_CORRECT")) { /* TODO - a new libbb function? */ @@ -172,8 +172,8 @@ int du_main(int argc, char **argv) * ignore -a. This is consistent with -s being equivalent to -d 0. */ #ifdef CONFIG_FEATURE_HUMAN_READABLE - bb_opt_complementally = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; - opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth); + opt_complementary = "h-km:k-hm:m-hk:H-L:L-H:s-d:d-s"; + opt = getopt32(argc, argv, "aHkLsx" "d:" "lc" "hm", &smax_print_depth); if((opt & (1 << 9))) { /* -h opt */ disp_hr = 0; @@ -187,8 +187,8 @@ int du_main(int argc, char **argv) disp_hr = KILOBYTE; } #else - bb_opt_complementally = "H-L:L-H:s-d:d-s"; - opt = bb_getopt_ulflags(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth); + opt_complementary = "H-L:L-H:s-d:d-s"; + opt = getopt32(argc, argv, "aHkLsx" "d:" "lc", &smax_print_depth); #if !defined CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K if((opt & (1 << 2))) { /* -k opt */ diff --git a/coreutils/env.c b/coreutils/env.c index 2af15a3..d03318f 100644 --- a/coreutils/env.c +++ b/coreutils/env.c @@ -46,16 +46,16 @@ int env_main(int argc, char** argv) static char *cleanenv[1] = { NULL }; char **ep; - unsigned long opt; + unsigned opt; llist_t *unset_env = NULL; extern char **environ; - bb_opt_complementally = "u::"; + opt_complementary = "u::"; #if ENABLE_FEATURE_ENV_LONG_OPTIONS - bb_applet_long_options = env_long_options; + applet_long_options = env_long_options; #endif - opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env); + opt = getopt32(argc, argv, "+iu:", &unset_env); argv += optind; if (*argv && (argv[0][0] == '-') && !argv[0][1]) { diff --git a/coreutils/fold.c b/coreutils/fold.c index aff7bb1..3b5be64 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c @@ -60,7 +60,7 @@ int fold_main(int argc, char **argv) } } - flags = bb_getopt_ulflags(argc, argv, "bsw:", &w_opt); + flags = getopt32(argc, argv, "bsw:", &w_opt); if (flags & FLAG_WIDTH) width = bb_xgetlarg(w_opt, 10, 1, 10000); diff --git a/coreutils/head.c b/coreutils/head.c index 50694bf..7d5f219 100644 --- a/coreutils/head.c +++ b/coreutils/head.c @@ -60,7 +60,7 @@ int head_main(int argc, char **argv) } #endif - /* No size benefit in converting this to bb_getopt_ulflags */ + /* No size benefit in converting this to getopt32 */ while ((opt = getopt(argc, argv, head_opts)) > 0) { switch (opt) { #if ENABLE_FEATURE_FANCY_HEAD diff --git a/coreutils/id.c b/coreutils/id.c index 1bedff3..dd825ab 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -50,8 +50,8 @@ int id_main(int argc, char **argv) /* Don't allow -n -r -nr -ug -rug -nug -rnug */ /* Don't allow more than one username */ - bb_opt_complementally = "?1:?:u--g:g--u:r?ug:n?ug"; - flags = bb_getopt_ulflags(argc, argv, "rnug"); + opt_complementary = "?1:?:u--g:g--u:r?ug:n?ug"; + flags = getopt32(argc, argv, "rnug"); /* This values could be overwritten later */ uid = geteuid(); diff --git a/coreutils/install.c b/coreutils/install.c index d3d6a58..2178d43 100644 --- a/coreutils/install.c +++ b/coreutils/install.c @@ -45,11 +45,11 @@ int install_main(int argc, char **argv) int ret = EXIT_SUCCESS, flags, i, isdir; #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS - bb_applet_long_options = install_long_options; + applet_long_options = install_long_options; #endif - bb_opt_complementally = "?:s--d:d--s"; + opt_complementary = "?:s--d:d--s"; /* -c exists for backwards compatibility, its needed */ - flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ + flags = getopt32(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ /* preserve access and modification time, this is GNU behaviour, BSD only preserves modification time */ 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 d1f5b1e..3a3d341 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) mode_t mode = 0666; char *smode = NULL; - bb_getopt_ulflags(argc, argv, "m:", &smode); + getopt32(argc, argv, "m:", &smode); if(smode) { if (bb_parse_mode(smode, &mode)) umask(0); diff --git a/coreutils/ln.c b/coreutils/ln.c index df18358..cd6e470 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c @@ -30,7 +30,7 @@ int ln_main(int argc, char **argv) struct stat statbuf; int (*link_func)(const char *, const char *); - flag = bb_getopt_ulflags(argc, argv, "sfnbS:", &suffix); + flag = getopt32(argc, argv, "sfnbS:", &suffix); if (argc == optind) { bb_show_usage(); diff --git a/coreutils/ls.c b/coreutils/ls.c index 0099f18..8ba4ab7 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -877,7 +877,7 @@ int ls_main(int argc, char **argv) struct dnode **dnp; struct dnode *dn; struct dnode *cur; - long opt; + unsigned opt; int nfiles = 0; int dnfiles; int dndirs; @@ -904,12 +904,12 @@ int ls_main(int argc, char **argv) #endif #ifdef CONFIG_FEATURE_LS_COLOR - bb_applet_long_options = ls_color_opt; + applet_long_options = ls_color_opt; #endif /* process options */ #ifdef CONFIG_FEATURE_AUTOWIDTH - opt = bb_getopt_ulflags(argc, argv, ls_options, &tabstops_str, &terminal_width_str + opt = getopt32(argc, argv, ls_options, &tabstops_str, &terminal_width_str #ifdef CONFIG_FEATURE_LS_COLOR , &color_opt #endif @@ -921,7 +921,7 @@ int ls_main(int argc, char **argv) terminal_width = atoi(terminal_width_str); } #else - opt = bb_getopt_ulflags(argc, argv, ls_options + opt = getopt32(argc, argv, ls_options #ifdef CONFIG_FEATURE_LS_COLOR , &color_opt #endif diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index c10fac5..a99e458 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) : HASH_SHA1; if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK) - flags = bb_getopt_ulflags(argc, argv, "scw"); + flags = getopt32(argc, argv, "scw"); else optind = 1; if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) { diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index c09c72f..3fe55c3 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -34,13 +34,13 @@ int mkdir_main (int argc, char **argv) mode_t mode = (mode_t)(-1); int status = EXIT_SUCCESS; int flags = 0; - unsigned long opt; + unsigned opt; char *smode; #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS - bb_applet_long_options = mkdir_long_options; + applet_long_options = mkdir_long_options; #endif - opt = bb_getopt_ulflags(argc, argv, "m:p", &smode); + opt = getopt32(argc, argv, "m:p", &smode); if(opt & 1) { mode = 0777; if (!bb_parse_mode (smode, &mode)) { diff --git a/coreutils/mv.c b/coreutils/mv.c index 274aecb..770b424 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c @@ -45,10 +45,10 @@ int mv_main(int argc, char **argv) int status = 0; #if ENABLE_FEATURE_MV_LONG_OPTIONS - bb_applet_long_options = mv_long_options; + applet_long_options = mv_long_options; #endif - bb_opt_complementally = "f-i:i-f"; - flags = bb_getopt_ulflags(argc, argv, "fi"); + opt_complementary = "f-i:i-f"; + flags = getopt32(argc, argv, "fi"); if (optind + 2 > argc) { bb_show_usage(); } diff --git a/coreutils/rm.c b/coreutils/rm.c index c787ae3..490694a 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c @@ -22,10 +22,10 @@ int rm_main(int argc, char **argv) { int status = 0; int flags = 0; - unsigned long opt; + unsigned opt; - bb_opt_complementally = "f-i:i-f"; - opt = bb_getopt_ulflags(argc, argv, "fiRr"); + opt_complementary = "f-i:i-f"; + opt = getopt32(argc, argv, "fiRr"); if(opt & 1) flags |= FILEUTILS_FORCE; if(opt & 2) diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index e1ed34c..05ea0e9 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c @@ -22,7 +22,7 @@ int rmdir_main(int argc, char **argv) int do_dot; char *path; - flags = bb_getopt_ulflags(argc, argv, "p"); + flags = getopt32(argc, argv, "p"); argv += optind; diff --git a/coreutils/stat.c b/coreutils/stat.c index 8e01218..b9fd42f 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -516,7 +516,7 @@ int stat_main(int argc, char **argv) int ok = 1; int (*statfunc)(char const *, char const *) = do_stat; - flags = bb_getopt_ulflags(argc, argv, "ftL" + flags = getopt32(argc, argv, "ftL" USE_FEATURE_STAT_FORMAT("c:", &format) ); diff --git a/coreutils/sum.c b/coreutils/sum.c index 99d477f..61ca582 100644 --- a/coreutils/sum.c +++ b/coreutils/sum.c @@ -136,7 +136,7 @@ int sum_main(int argc, char **argv) int (*sum_func)(const char *, int) = bsd_sum_file; /* give the bsd func priority over sysv func */ - flags = bb_getopt_ulflags(argc, argv, "sr"); + flags = getopt32(argc, argv, "sr"); if (flags & 1) sum_func = sysv_sum_file; if (flags & 2) diff --git a/coreutils/tee.c b/coreutils/tee.c index 1f59f03..a194153 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c @@ -28,7 +28,7 @@ int tee_main(int argc, char **argv) int c; #endif - flags = bb_getopt_ulflags(argc, argv, "ia"); /* 'a' must be 2nd */ + flags = getopt32(argc, argv, "ia"); /* 'a' must be 2nd */ mode += (flags & 2); /* Since 'a' is the 2nd option... */ diff --git a/coreutils/touch.c b/coreutils/touch.c index 76c05d8..e1af7d0 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c @@ -32,7 +32,7 @@ int touch_main(int argc, char **argv) int flags; int status = EXIT_SUCCESS; - flags = bb_getopt_ulflags(argc, argv, "c"); + flags = getopt32(argc, argv, "c"); argv += optind; diff --git a/coreutils/tty.c b/coreutils/tty.c index eb8c3dd..579e6f7 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c @@ -23,7 +23,7 @@ int tty_main(int argc, char **argv) xfunc_error_retval = 2; /* SUSv3 requires > 1 for error. */ - silent = bb_getopt_ulflags(argc, argv, "s"); + silent = getopt32(argc, argv, "s"); /* gnu tty outputs a warning that it is ignoring all args. */ bb_warn_ignoring_args(argc - optind); diff --git a/coreutils/uname.c b/coreutils/uname.c index da12c3a..575fb52 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c @@ -63,7 +63,7 @@ int uname_main(int argc, char **argv) const unsigned short int *delta; char toprint; - toprint = bb_getopt_ulflags(argc, argv, options); + toprint = getopt32(argc, argv, options); if (argc != optind) { bb_show_usage(); diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 21ebce3..921d29a 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c @@ -129,7 +129,7 @@ int uudecode_main(int argc, char **argv) char *outname = NULL; char *line; - bb_getopt_ulflags(argc, argv, "o:", &outname); + getopt32(argc, argv, "o:", &outname); if (optind == argc) { src_stream = stdin; diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 1a8882f..5853836 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c @@ -27,7 +27,7 @@ int uuencode_main(int argc, char **argv) RESERVE_CONFIG_BUFFER(dst_buf, DST_BUF_SIZE + 1); tbl = bb_uuenc_tbl_std; - if (bb_getopt_ulflags(argc, argv, "m") & 1) { + if (getopt32(argc, argv, "m") & 1) { tbl = bb_uuenc_tbl_base64; } diff --git a/coreutils/wc.c b/coreutils/wc.c index 6ddac4d..359d9fd 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c @@ -87,7 +87,7 @@ int wc_main(int argc, char **argv) char in_word; unsigned print_type; - print_type = bb_getopt_ulflags(argc, argv, "lwcL"); + print_type = getopt32(argc, argv, "lwcL"); if (print_type == 0) { print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS); |