getopt_ulflags -> getopt32.

It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
This commit is contained in:
Denis Vlasenko
2006-10-03 21:00:06 +00:00
parent 40920825d5
commit 67b23e6043
120 changed files with 322 additions and 327 deletions

View File

@@ -24,7 +24,7 @@
/* options */
static unsigned long opt;
static unsigned opt;
#define GREP_OPTS "lnqvscFiHhe:f:Lo"
#define GREP_OPT_l (1<<0)
#define PRINT_FILES_WITH_MATCHES (opt & GREP_OPT_l)
@@ -302,8 +302,8 @@ int grep_main(int argc, char **argv)
char *slines_before;
char *Copt;
bb_opt_complementally = "H-h:e::f::C-AB";
opt = bb_getopt_ulflags(argc, argv,
opt_complementary = "H-h:e::f::C-AB";
opt = getopt32(argc, argv,
GREP_OPTS GREP_OPT_CONTEXT OPT_EGREP,
&pattern_head, &fopt,
&slines_after, &slines_before, &Copt);
@@ -336,8 +336,8 @@ int grep_main(int argc, char **argv)
before_buf = (char **)xzalloc(lines_before * sizeof(char *));
#else
/* with auto sanity checks */
bb_opt_complementally = "H-h:e::f::c-n:q-n:l-n";
opt = bb_getopt_ulflags(argc, argv, GREP_OPTS OPT_EGREP,
opt_complementary = "H-h:e::f::c-n:q-n:l-n";
opt = getopt32(argc, argv, GREP_OPTS OPT_EGREP,
&pattern_head, &fopt);
#endif
invert_search = (opt & GREP_OPT_v) != 0; /* 0 | 1 */

View File

@@ -399,7 +399,7 @@ int xargs_main(int argc, char **argv)
size_t n_chars = 0;
long orig_arg_max;
const char *eof_str = "_";
unsigned long opt;
unsigned opt;
size_t n_max_chars;
#if ENABLE_FEATURE_XARGS_SUPPORT_ZERO_TERM
xlist_t* (*read_args)(xlist_t*, const char*, size_t, char*) = process_stdin;
@@ -407,7 +407,7 @@ int xargs_main(int argc, char **argv)
#define read_args process_stdin
#endif
opt = bb_getopt_ulflags(argc, argv, OPTION_STR, &max_args, &max_chars, &eof_str);
opt = getopt32(argc, argv, OPTION_STR, &max_args, &max_chars, &eof_str);
if (opt & OPT_ZEROTERM)
USE_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin);