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

@@ -2634,7 +2634,7 @@ static rstream *next_input_file(void)
int awk_main(int argc, char **argv)
{
unsigned long opt;
unsigned opt;
char *opt_F, *opt_v, *opt_W;
char *s, *s1;
int i, j, c, flen;
@@ -2691,7 +2691,7 @@ keep_going:
free(s);
}
opt = bb_getopt_ulflags(argc, argv, "F:v:f:W:", &opt_F, &opt_v, &programname, &opt_W);
opt = getopt32(argc, argv, "F:v:f:W:", &opt_F, &opt_v, &programname, &opt_W);
if (opt & 0x1) setvar_s(V[FS], opt_F); // -F
if (opt & 0x2) if (!is_assignment(opt_v)) bb_show_usage(); // -v
if (opt & 0x4) { // -f

View File

@@ -85,7 +85,7 @@ int patch_main(int argc, char **argv)
{
char *p, *i;
ret = bb_getopt_ulflags(argc, argv, "p:i:", &p, &i);
ret = getopt32(argc, argv, "p:i:", &p, &i);
if (ret & 1)
patch_level = bb_xgetlarg(p, 10, -1, USHRT_MAX);
if (ret & 2) {

View File

@@ -1109,7 +1109,7 @@ static void add_files_link(llist_t *opt_f)
int sed_main(int argc, char **argv)
{
unsigned long opt;
unsigned opt;
llist_t *opt_e, *opt_f;
int status = EXIT_SUCCESS;
@@ -1126,8 +1126,8 @@ int sed_main(int argc, char **argv)
/* do normal option parsing */
opt_e = opt_f = NULL;
bb_opt_complementally = "e::f::"; /* can occur multiple times */
opt = bb_getopt_ulflags(argc, argv, "irne:f:", &opt_e, &opt_f);
opt_complementary = "e::f::"; /* can occur multiple times */
opt = getopt32(argc, argv, "irne:f:", &opt_e, &opt_f);
if (opt & 0x1) { // -i
bbg.in_place++;
atexit(cleanup_outname);
@@ -1135,11 +1135,11 @@ int sed_main(int argc, char **argv)
if (opt & 0x2) bbg.regex_type|=REG_EXTENDED; // -r
if (opt & 0x4) bbg.be_quiet++; // -n
if (opt & 0x8) { // -e
/* getopt_ulflags reverses order of arguments, handle it */
/* getopt32 reverses order of arguments, handle it */
add_cmds_link(opt_e);
}
if (opt & 0x10) { // -f
/* getopt_ulflags reverses order of arguments, handle it */
/* getopt32 reverses order of arguments, handle it */
add_files_link(opt_f);
}
/* if we didn't get a pattern from -e or -f, use argv[optind] */