From 67b23e6043d8e2b30b0bf3bc105b8583c2a26db5 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 3 Oct 2006 21:00:06 +0000 Subject: 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. --- util-linux/dmesg.c | 2 +- util-linux/fdformat.c | 2 +- util-linux/getopt.c | 2 +- util-linux/hwclock.c | 8 ++++---- util-linux/ipcs.c | 4 ++-- util-linux/losetup.c | 4 ++-- util-linux/mount.c | 4 ++-- util-linux/rdate.c | 4 ++-- util-linux/readprofile.c | 4 ++-- util-linux/swaponoff.c | 2 +- util-linux/switch_root.c | 4 ++-- util-linux/umount.c | 4 ++-- 12 files changed, 22 insertions(+), 22 deletions(-) (limited to 'util-linux') diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 682c4f6..277415a 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c @@ -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))) diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index 9b97e68..0242d8d 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c @@ -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); diff --git a/util-linux/getopt.c b/util-linux/getopt.c index a4968b7..02bb218 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -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); diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index e1a67f2..cce3133 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c @@ -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)) diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index 8570659..5e58e81 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c @@ -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; diff --git a/util-linux/losetup.c b/util-linux/losetup.c index 54a1601..8882ee4 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c @@ -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; diff --git a/util-linux/mount.c b/util-linux/mount.c index 565dccd..899bf85 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -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 diff --git a/util-linux/rdate.c b/util-linux/rdate.c index c740a69..c24465d 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -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]); diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index 29e9f3e..ff70bf7 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -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); diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index ab75484..4fcb239 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -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(); diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 1a59907..f2d9b6e 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c @@ -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. diff --git a/util-linux/umount.c b/util-linux/umount.c index e4308e5..9c551f9 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -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; -- cgit v1.1