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

@ -16,7 +16,7 @@
int dmesg_main(int argc, char *argv[])
{
char *size, *level;
int flags = bb_getopt_ulflags(argc, argv, "cs:n:", &size, &level);
int flags = getopt32(argc, argv, "cs:n:", &size, &level);
if (flags & 4) {
if (klogctl(8, NULL, bb_xgetlarg(level, 10, 0, 10)))

View File

@ -63,7 +63,7 @@ int fdformat_main(int argc,char **argv)
if (argc < 2) {
bb_show_usage();
}
verify = !bb_getopt_ulflags(argc, argv, "n");
verify = !getopt32(argc, argv, "n");
argv += optind;
xstat(*argv, &st);

View File

@ -184,7 +184,7 @@ enum { LONG_OPTIONS_INCR = 10 };
#define init_longopt() add_longopt(NULL,0)
/* Register a long option. The contents of name is copied. */
void add_longopt(const char *name,int has_arg)
void add_longopt(const char *name, int has_arg)
{
if (!name) { /* init */
free(long_options);

View File

@ -182,7 +182,7 @@ static int check_utc(void)
int hwclock_main ( int argc, char **argv )
{
unsigned long opt;
unsigned opt;
int utc;
#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
@ -194,11 +194,11 @@ static const struct option hwclock_long_options[] = {
{ "systohc", 0, 0, 'w' },
{ 0, 0, 0, 0 }
};
bb_applet_long_options = hwclock_long_options;
applet_long_options = hwclock_long_options;
#endif
bb_opt_complementally = "?:r--ws:w--rs:s--wr:l--u:u--l";
opt = bb_getopt_ulflags(argc, argv, "lursw");
opt_complementary = "?:r--ws:w--rs:s--wr:l--u:u--l";
opt = getopt32(argc, argv, "lursw");
/* If -u or -l wasn't given check if we are using utc */
if (opt & (HWCLOCK_OPT_UTC | HWCLOCK_OPT_LOCALTIME))

View File

@ -572,14 +572,14 @@ int ipcs_main(int argc, char **argv)
{
int id = 0;
unsigned flags = 0;
unsigned long opt;
unsigned opt;
char *opt_i;
#define flag_print (1<<0)
#define flag_msg (1<<1)
#define flag_sem (1<<2)
#define flag_shm (1<<3)
opt = bb_getopt_ulflags(argc, argv, "i:aqsmtcplu", &opt_i);
opt = getopt32(argc, argv, "i:aqsmtcplu", &opt_i);
if (opt & 0x1) { // -i
id = atoi(opt_i);
flags |= flag_print;

View File

@ -14,11 +14,11 @@
int losetup_main(int argc, char **argv)
{
unsigned long opt;
unsigned opt;
char *opt_o;
int offset = 0;
opt = bb_getopt_ulflags(argc, argv, "do:", &opt_o);
opt = getopt32(argc, argv, "do:", &opt_o);
argc -= optind;
argv += optind;

View File

@ -1428,7 +1428,7 @@ int mount_main(int argc, char **argv)
const char *fstabname;
FILE *fstab;
int i, j, rc = 0;
unsigned long opt;
unsigned opt;
struct mntent mtpair[2], *mtcur = mtpair;
/* parse long options, like --bind and --move. Note that -o option
@ -1444,7 +1444,7 @@ int mount_main(int argc, char **argv)
// Parse remaining options
opt = bb_getopt_ulflags(argc, argv, "o:t:rwanfvs", &opt_o, &fstype);
opt = getopt32(argc, argv, "o:t:rwanfvs", &opt_o, &fstype);
if (opt & 0x1) append_mount_options(&cmdopts, opt_o); // -o
//if (opt & 0x2) // -t
if (opt & 0x4) append_mount_options(&cmdopts, "ro"); // -r

View File

@ -63,8 +63,8 @@ int rdate_main(int argc, char **argv)
time_t remote_time;
unsigned long flags;
bb_opt_complementally = "-1";
flags = bb_getopt_ulflags(argc, argv, "sp");
opt_complementary = "-1";
flags = getopt32(argc, argv, "sp");
remote_time = askremotedate(argv[optind]);

View File

@ -64,8 +64,8 @@ int readprofile_main(int argc, char **argv)
proFile = defaultpro;
mapFile = defaultmap;
bb_opt_complementally = "nn:aa:bb:ss:ii:rr:vv";
bb_getopt_ulflags(argc, argv, "M:m:p:nabsirv",
opt_complementary = "nn:aa:bb:ss:ii:rr:vv";
getopt32(argc, argv, "M:m:p:nabsirv",
&mult, &mapFile, &proFile,
&optNative, &optAll, &optBins, &optSub,
&optInfo, &optReset, &optVerbose);

View File

@ -66,7 +66,7 @@ int swap_on_off_main(int argc, char **argv)
if (argc == 1)
bb_show_usage();
ret = bb_getopt_ulflags(argc, argv, "a");
ret = getopt32(argc, argv, "a");
if (ret & DO_ALL)
return do_em_all();

View File

@ -71,8 +71,8 @@ int switch_root_main(int argc, char *argv[])
// Parse args (-c console)
bb_opt_complementally="-2";
bb_getopt_ulflags(argc,argv,"c:",&console);
opt_complementary="-2";
getopt32(argc,argv,"c:",&console);
// Change to new root directory and verify it's a different fs.

View File

@ -27,7 +27,7 @@ int umount_main(int argc, char **argv)
struct mntent me;
FILE *fp;
int status = EXIT_SUCCESS;
unsigned long opt;
unsigned opt;
struct mtab_list {
char *dir;
char *device;
@ -36,7 +36,7 @@ int umount_main(int argc, char **argv)
/* Parse any options */
opt = bb_getopt_ulflags(argc, argv, OPTION_STRING);
opt = getopt32(argc, argv, OPTION_STRING);
argc -= optind;
argv += optind;