aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-08 16:38:18 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-08 17:09:40 +0200
commit036585a911a5fe6c2cd77b808dd9150500f37272 (patch)
treeaa7c65b4d09c74642f622a1ef5da982d6ed4940a /util-linux
parent00677b5e35dd97f415f0b0bef25b55865f55ab33 (diff)
downloadbusybox-w32-036585a911a5fe6c2cd77b808dd9150500f37272.tar.gz
busybox-w32-036585a911a5fe6c2cd77b808dd9150500f37272.tar.bz2
busybox-w32-036585a911a5fe6c2cd77b808dd9150500f37272.zip
getopt32: remove applet_long_options
FEATURE_GETOPT_LONG made dependent on LONG_OPTS. The folloving options are removed, now LONG_OPTS enables long options for affected applets: FEATURE_ENV_LONG_OPTIONS FEATURE_EXPAND_LONG_OPTIONS FEATURE_UNEXPAND_LONG_OPTIONS FEATURE_MKDIR_LONG_OPTIONS FEATURE_MV_LONG_OPTIONS FEATURE_RMDIR_LONG_OPTIONS FEATURE_ADDGROUP_LONG_OPTIONS FEATURE_ADDUSER_LONG_OPTIONS FEATURE_HWCLOCK_LONG_OPTIONS FEATURE_NSENTER_LONG_OPTS FEATURE_CHCON_LONG_OPTIONS FEATURE_RUNCON_LONG_OPTIONS They either had a small number of long options, or their long options are essential. Example: upstream addgroup and adduser have ONLY longopts, we should probably go further and get rid of non-standard short options. To this end, make addgroup and adduser "select LONG_OPTS". We had this breakage caused by us even in our own package! #if ENABLE_LONG_OPTS || !ENABLE_ADDGROUP /* We try to use --gid, not -g, because "standard" addgroup * has no short option -g, it has only long --gid. */ argv[1] = (char*)"--gid"; #else /* Breaks if system in fact does NOT use busybox addgroup */ argv[1] = (char*)"-g"; #endif xargs: its lone longopt no longer depends on DESKTOP, only on LONG_OPTS. hwclock TODO: get rid of incompatible -t, -l aliases to --systz, --localtime Shorten help texts by omitting long option when short opt alternative exists. Reduction of size comes from the fact that store of an immediate (an address of longopts) to a fixed address (global variable) is a longer insn than pushing that immediate or passing it in a register. This effect is CPU-agnostic. function old new delta getopt32 1350 22 -1328 vgetopt32 - 1318 +1318 getopt32long - 24 +24 tftpd_main 562 567 +5 scan_recursive 376 380 +4 collect_cpu 545 546 +1 date_main 1096 1095 -1 hostname_main 262 259 -3 uname_main 259 255 -4 setpriv_main 362 358 -4 rmdir_main 191 187 -4 mv_main 562 558 -4 ipcalc_main 548 544 -4 ifenslave_main 641 637 -4 gzip_main 192 188 -4 gunzip_main 77 73 -4 fsfreeze_main 81 77 -4 flock_main 318 314 -4 deluser_main 337 333 -4 cp_main 374 370 -4 chown_main 175 171 -4 applet_long_options 4 - -4 xargs_main 894 889 -5 wget_main 2540 2535 -5 udhcpc_main 2767 2762 -5 touch_main 436 431 -5 tar_main 1014 1009 -5 start_stop_daemon_main 1033 1028 -5 sed_main 682 677 -5 script_main 1082 1077 -5 run_parts_main 330 325 -5 rtcwake_main 459 454 -5 od_main 2169 2164 -5 nl_main 201 196 -5 modprobe_main 773 768 -5 mkdir_main 160 155 -5 ls_main 568 563 -5 install_main 773 768 -5 hwclock_main 411 406 -5 getopt_main 622 617 -5 fstrim_main 256 251 -5 env_main 198 193 -5 dumpleases_main 635 630 -5 dpkg_main 3991 3986 -5 diff_main 1355 1350 -5 cryptpw_main 233 228 -5 cpio_main 593 588 -5 conspy_main 1135 1130 -5 chpasswd_main 313 308 -5 adduser_main 887 882 -5 addgroup_main 416 411 -5 ftpgetput_main 351 345 -6 get_terminal_width_height 242 234 -8 expand_main 690 680 -10 static.expand_longopts 18 - -18 static.unexpand_longopts 27 - -27 mkdir_longopts 28 - -28 env_longopts 30 - -30 static.ifenslave_longopts 34 - -34 mv_longopts 46 - -46 static.rmdir_longopts 48 - -48 packed_usage 31739 31687 -52 ------------------------------------------------------------------------------ (add/remove: 2/8 grow/shrink: 3/49 up/down: 1352/-1840) Total: -488 bytes text data bss dec hex filename 915681 485 6880 923046 e15a6 busybox_old 915428 485 6876 922789 e14a5 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/flock.c3
-rw-r--r--util-linux/fsfreeze.c9
-rw-r--r--util-linux/fstrim.c3
-rw-r--r--util-linux/getopt.c22
-rw-r--r--util-linux/hwclock.c28
-rw-r--r--util-linux/nsenter.c35
-rw-r--r--util-linux/rtcwake.c4
-rw-r--r--util-linux/script.c4
-rw-r--r--util-linux/setpriv.c9
-rw-r--r--util-linux/unshare.c3
10 files changed, 39 insertions, 81 deletions
diff --git a/util-linux/flock.c b/util-linux/flock.c
index b55e07adb..0c9158508 100644
--- a/util-linux/flock.c
+++ b/util-linux/flock.c
@@ -44,11 +44,10 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
44 "unlock\0" No_argument "u" 44 "unlock\0" No_argument "u"
45 "nonblock\0" No_argument "n" 45 "nonblock\0" No_argument "n"
46 ; 46 ;
47 applet_long_options = flock_longopts;
48#endif 47#endif
49 opt_complementary = "-1"; 48 opt_complementary = "-1";
50 49
51 opt = getopt32(argv, "+sxnu"); 50 opt = getopt32long(argv, "+sxnu", flock_longopts);
52 argv += optind; 51 argv += optind;
53 52
54 if (argv[1]) { 53 if (argv[1]) {
diff --git a/util-linux/fsfreeze.c b/util-linux/fsfreeze.c
index c1f31569f..af715da5e 100644
--- a/util-linux/fsfreeze.c
+++ b/util-linux/fsfreeze.c
@@ -36,15 +36,14 @@ int fsfreeze_main(int argc UNUSED_PARAM, char **argv)
36 unsigned opts; 36 unsigned opts;
37 int fd; 37 int fd;
38 38
39 applet_long_options =
40 "freeze\0" No_argument "\xff"
41 "unfreeze\0" No_argument "\xfe"
42 ;
43 /* exactly one non-option arg: the mountpoint */ 39 /* exactly one non-option arg: the mountpoint */
44 /* one of opts is required */ 40 /* one of opts is required */
45 /* opts are mutually exclusive */ 41 /* opts are mutually exclusive */
46 opt_complementary = "=1:""\xff:\xfe:""\xff--\xfe:\xfe--\xff"; 42 opt_complementary = "=1:""\xff:\xfe:""\xff--\xfe:\xfe--\xff";
47 opts = getopt32(argv, ""); 43 opts = getopt32long(argv, "",
44 "freeze\0" No_argument "\xff"
45 "unfreeze\0" No_argument "\xfe"
46 );
48 47
49 fd = xopen(argv[optind], O_RDONLY); 48 fd = xopen(argv[optind], O_RDONLY);
50 /* Works with NULL arg on linux-4.8.0 */ 49 /* Works with NULL arg on linux-4.8.0 */
diff --git a/util-linux/fstrim.c b/util-linux/fstrim.c
index 1fbf0c857..8f0a0538f 100644
--- a/util-linux/fstrim.c
+++ b/util-linux/fstrim.c
@@ -69,11 +69,10 @@ int fstrim_main(int argc UNUSED_PARAM, char **argv)
69 "minimum\0" Required_argument "m" 69 "minimum\0" Required_argument "m"
70 "verbose\0" No_argument "v" 70 "verbose\0" No_argument "v"
71 ; 71 ;
72 applet_long_options = fstrim_longopts;
73#endif 72#endif
74 73
75 opt_complementary = "=1"; /* exactly one non-option arg: the mountpoint */ 74 opt_complementary = "=1"; /* exactly one non-option arg: the mountpoint */
76 opts = getopt32(argv, "o:l:m:v", &arg_o, &arg_l, &arg_m); 75 opts = getopt32long(argv, "o:l:m:v", fstrim_longopts, &arg_o, &arg_l, &arg_m);
77 76
78 memset(&range, 0, sizeof(range)); 77 memset(&range, 0, sizeof(range));
79 range.len = ULLONG_MAX; 78 range.len = ULLONG_MAX;
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 5fe0da7cd..a151b7e56 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -42,8 +42,8 @@
42//config: 42//config:
43//config:config FEATURE_GETOPT_LONG 43//config:config FEATURE_GETOPT_LONG
44//config: bool "Support -l LONGOPTs" 44//config: bool "Support -l LONGOPTs"
45//config: default y if LONG_OPTS 45//config: default y
46//config: depends on GETOPT 46//config: depends on GETOPT && LONG_OPTS
47//config: help 47//config: help
48//config: Enable support for long options (option -l). 48//config: Enable support for long options (option -l).
49 49
@@ -54,20 +54,6 @@
54//usage:#define getopt_trivial_usage 54//usage:#define getopt_trivial_usage
55//usage: "[OPTIONS] [--] OPTSTRING PARAMS" 55//usage: "[OPTIONS] [--] OPTSTRING PARAMS"
56//usage:#define getopt_full_usage "\n\n" 56//usage:#define getopt_full_usage "\n\n"
57//usage: IF_LONG_OPTS(
58//usage: IF_FEATURE_GETOPT_LONG(
59//usage: " -a,--alternative Allow long options starting with single -\n"
60//usage: " -l,--longoptions LOPT[,...] Long options to recognize\n"
61//usage: )
62//usage: " -n,--name PROGNAME The name under which errors are reported"
63//usage: "\n -o,--options OPTSTRING Short options to recognize"
64//usage: "\n -q,--quiet No error messages on unrecognized options"
65//usage: "\n -Q,--quiet-output No normal output"
66//usage: "\n -s,--shell SHELL Set shell quoting conventions"
67//usage: "\n -T,--test Version test (exits with 4)"
68//usage: "\n -u,--unquoted Don't quote output"
69//usage: )
70//usage: IF_NOT_LONG_OPTS(
71//usage: IF_FEATURE_GETOPT_LONG( 57//usage: IF_FEATURE_GETOPT_LONG(
72//usage: " -a Allow long options starting with single -\n" 58//usage: " -a Allow long options starting with single -\n"
73//usage: " -l LOPT[,...] Long options to recognize\n" 59//usage: " -l LOPT[,...] Long options to recognize\n"
@@ -79,7 +65,6 @@
79//usage: "\n -s SHELL Set shell quoting conventions" 65//usage: "\n -s SHELL Set shell quoting conventions"
80//usage: "\n -T Version test (exits with 4)" 66//usage: "\n -T Version test (exits with 4)"
81//usage: "\n -u Don't quote output" 67//usage: "\n -u Don't quote output"
82//usage: )
83//usage: IF_FEATURE_GETOPT_LONG( /* example uses -l, needs FEATURE_GETOPT_LONG */ 68//usage: IF_FEATURE_GETOPT_LONG( /* example uses -l, needs FEATURE_GETOPT_LONG */
84//usage: "\n" 69//usage: "\n"
85//usage: "\nExample:" 70//usage: "\nExample:"
@@ -411,8 +396,7 @@ int getopt_main(int argc, char **argv)
411#if !ENABLE_FEATURE_GETOPT_LONG 396#if !ENABLE_FEATURE_GETOPT_LONG
412 opt = getopt32(argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg); 397 opt = getopt32(argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg);
413#else 398#else
414 applet_long_options = getopt_longopts; 399 opt = getopt32long(argv, "+o:n:qQs:Tual:*", getopt_longopts,
415 opt = getopt32(argv, "+o:n:qQs:Tual:*",
416 &optstr, &name, &s_arg, &l_arg); 400 &optstr, &name, &s_arg, &l_arg);
417 /* Effectuate the read options for the applet itself */ 401 /* Effectuate the read options for the applet itself */
418 while (l_arg) { 402 while (l_arg) {
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 5df56de15..50f83d8c4 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -16,11 +16,6 @@
16//config: shutdown in the hardware clock, so the hardware will keep the 16//config: shutdown in the hardware clock, so the hardware will keep the
17//config: correct time when Linux is _not_ running. 17//config: correct time when Linux is _not_ running.
18//config: 18//config:
19//config:config FEATURE_HWCLOCK_LONG_OPTIONS
20//config: bool "Support long options (--hctosys,...)"
21//config: default y
22//config: depends on HWCLOCK && LONG_OPTS
23//config:
24//config:config FEATURE_HWCLOCK_ADJTIME_FHS 19//config:config FEATURE_HWCLOCK_ADJTIME_FHS
25//config: bool "Use FHS /var/lib/hwclock/adjtime" 20//config: bool "Use FHS /var/lib/hwclock/adjtime"
26//config: default n # util-linux-ng in Fedora 13 still uses /etc/adjtime 21//config: default n # util-linux-ng in Fedora 13 still uses /etc/adjtime
@@ -293,12 +288,12 @@ static void set_system_clock_timezone(int utc)
293} 288}
294 289
295//usage:#define hwclock_trivial_usage 290//usage:#define hwclock_trivial_usage
296//usage: IF_FEATURE_HWCLOCK_LONG_OPTIONS( 291//usage: IF_LONG_OPTS(
297//usage: "[-r|--show] [-s|--hctosys] [-w|--systohc] [-t|--systz]" 292//usage: "[-r|--show] [-s|--hctosys] [-w|--systohc] [--systz]"
298//usage: " [-l|--localtime] [-u|--utc]" 293//usage: " [--localtime] [-u|--utc]"
299//usage: " [-f|--rtc FILE]" 294//usage: " [-f|--rtc FILE]"
300//usage: ) 295//usage: )
301//usage: IF_NOT_FEATURE_HWCLOCK_LONG_OPTIONS( 296//usage: IF_NOT_LONG_OPTS(
302//usage: "[-r] [-s] [-w] [-t] [-l] [-u] [-f FILE]" 297//usage: "[-r] [-s] [-w] [-t] [-l] [-u] [-f FILE]"
303//usage: ) 298//usage: )
304//usage:#define hwclock_full_usage "\n\n" 299//usage:#define hwclock_full_usage "\n\n"
@@ -306,12 +301,18 @@ static void set_system_clock_timezone(int utc)
306//usage: "\n -r Show hardware clock time" 301//usage: "\n -r Show hardware clock time"
307//usage: "\n -s Set system time from hardware clock" 302//usage: "\n -s Set system time from hardware clock"
308//usage: "\n -w Set hardware clock from system time" 303//usage: "\n -w Set hardware clock from system time"
309//usage: "\n -t Set in-kernel timezone, correct system time" 304//usage: IF_LONG_OPTS(
305//usage: "\n --systz Set in-kernel timezone, correct system time"
306//usage: )
310//usage: "\n if hardware clock is in local time" 307//usage: "\n if hardware clock is in local time"
311//usage: "\n -u Assume hardware clock is kept in UTC" 308//usage: "\n -u Assume hardware clock is kept in UTC"
312//usage: "\n -l Assume hardware clock is kept in local time" 309//usage: IF_LONG_OPTS(
310//usage: "\n --localtime Assume hardware clock is kept in local time"
311//usage: )
313//usage: "\n -f FILE Use specified device (e.g. /dev/rtc2)" 312//usage: "\n -f FILE Use specified device (e.g. /dev/rtc2)"
314 313
314//TODO: get rid of incompatible -t and -l aliases to --systz and --localtime
315
315#define HWCLOCK_OPT_LOCALTIME 0x01 316#define HWCLOCK_OPT_LOCALTIME 0x01
316#define HWCLOCK_OPT_UTC 0x02 317#define HWCLOCK_OPT_UTC 0x02
317#define HWCLOCK_OPT_SHOW 0x04 318#define HWCLOCK_OPT_SHOW 0x04
@@ -327,7 +328,7 @@ int hwclock_main(int argc UNUSED_PARAM, char **argv)
327 unsigned opt; 328 unsigned opt;
328 int utc; 329 int utc;
329 330
330#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS 331#if ENABLE_LONG_OPTS
331 static const char hwclock_longopts[] ALIGN1 = 332 static const char hwclock_longopts[] ALIGN1 =
332 "localtime\0" No_argument "l" /* short opt is non-standard */ 333 "localtime\0" No_argument "l" /* short opt is non-standard */
333 "utc\0" No_argument "u" 334 "utc\0" No_argument "u"
@@ -337,14 +338,13 @@ int hwclock_main(int argc UNUSED_PARAM, char **argv)
337 "systz\0" No_argument "t" /* short opt is non-standard */ 338 "systz\0" No_argument "t" /* short opt is non-standard */
338 "rtc\0" Required_argument "f" 339 "rtc\0" Required_argument "f"
339 ; 340 ;
340 applet_long_options = hwclock_longopts;
341#endif 341#endif
342 342
343 /* Initialize "timezone" (libc global variable) */ 343 /* Initialize "timezone" (libc global variable) */
344 tzset(); 344 tzset();
345 345
346 opt_complementary = "r--wst:w--rst:s--wrt:t--rsw:l--u:u--l"; 346 opt_complementary = "r--wst:w--rst:s--wrt:t--rsw:l--u:u--l";
347 opt = getopt32(argv, "lurswtf:", &rtcname); 347 opt = getopt32long(argv, "lurswtf:", hwclock_longopts, &rtcname);
348 348
349 /* If -u or -l wasn't given check if we are using utc */ 349 /* If -u or -l wasn't given check if we are using utc */
350 if (opt & (HWCLOCK_OPT_UTC | HWCLOCK_OPT_LOCALTIME)) 350 if (opt & (HWCLOCK_OPT_UTC | HWCLOCK_OPT_LOCALTIME))
diff --git a/util-linux/nsenter.c b/util-linux/nsenter.c
index 12c86b0ed..d91b0b509 100644
--- a/util-linux/nsenter.c
+++ b/util-linux/nsenter.c
@@ -13,14 +13,6 @@
13//config: select PLATFORM_LINUX 13//config: select PLATFORM_LINUX
14//config: help 14//config: help
15//config: Run program with namespaces of other processes. 15//config: Run program with namespaces of other processes.
16//config:
17//config:config FEATURE_NSENTER_LONG_OPTS
18//config: bool "Enable long options"
19//config: default y
20//config: depends on NSENTER && LONG_OPTS
21//config: help
22//config: Support long options for the nsenter applet. This makes
23//config: the busybox implementation more compatible with upstream.
24 16
25//applet:IF_NSENTER(APPLET(nsenter, BB_DIR_USR_BIN, BB_SUID_DROP)) 17//applet:IF_NSENTER(APPLET(nsenter, BB_DIR_USR_BIN, BB_SUID_DROP))
26 18
@@ -28,22 +20,6 @@
28 20
29//usage:#define nsenter_trivial_usage 21//usage:#define nsenter_trivial_usage
30//usage: "[OPTIONS] [PROG [ARGS]]" 22//usage: "[OPTIONS] [PROG [ARGS]]"
31//usage:#if ENABLE_FEATURE_NSENTER_LONG_OPTS
32//usage:#define nsenter_full_usage "\n"
33//usage: "\n -t,--target PID Target process to get namespaces from"
34//usage: "\n -m,--mount[=FILE] Enter mount namespace"
35//usage: "\n -u,--uts[=FILE] Enter UTS namespace (hostname etc)"
36//usage: "\n -i,--ipc[=FILE] Enter System V IPC namespace"
37//usage: "\n -n,--net[=FILE] Enter network namespace"
38//usage: "\n -p,--pid[=FILE] Enter pid namespace"
39//usage: "\n -U,--user[=FILE] Enter user namespace"
40//usage: "\n -S,--setuid UID Set uid in entered namespace"
41//usage: "\n -G,--setgid GID Set gid in entered namespace"
42//usage: "\n --preserve-credentials Don't touch uids or gids"
43//usage: "\n -r,--root[=DIR] Set root directory"
44//usage: "\n -w,--wd[=DIR] Set working directory"
45//usage: "\n -F,--no-fork Don't fork before exec'ing PROG"
46//usage:#else
47//usage:#define nsenter_full_usage "\n" 23//usage:#define nsenter_full_usage "\n"
48//usage: "\n -t PID Target process to get namespaces from" 24//usage: "\n -t PID Target process to get namespaces from"
49//usage: "\n -m[FILE] Enter mount namespace" 25//usage: "\n -m[FILE] Enter mount namespace"
@@ -54,10 +30,12 @@
54//usage: "\n -U[FILE] Enter user namespace" 30//usage: "\n -U[FILE] Enter user namespace"
55//usage: "\n -S UID Set uid in entered namespace" 31//usage: "\n -S UID Set uid in entered namespace"
56//usage: "\n -G GID Set gid in entered namespace" 32//usage: "\n -G GID Set gid in entered namespace"
33//usage: IF_LONG_OPTS(
34//usage: "\n --preserve-credentials Don't touch uids or gids"
35//usage: )
57//usage: "\n -r[DIR] Set root directory" 36//usage: "\n -r[DIR] Set root directory"
58//usage: "\n -w[DIR] Set working directory" 37//usage: "\n -w[DIR] Set working directory"
59//usage: "\n -F Don't fork before exec'ing PROG" 38//usage: "\n -F Don't fork before exec'ing PROG"
60//usage:#endif
61 39
62#include <sched.h> 40#include <sched.h>
63#ifndef CLONE_NEWUTS 41#ifndef CLONE_NEWUTS
@@ -101,7 +79,7 @@ enum {
101 OPT_root = 1 << 9, 79 OPT_root = 1 << 9,
102 OPT_wd = 1 << 10, 80 OPT_wd = 1 << 10,
103 OPT_nofork = 1 << 11, 81 OPT_nofork = 1 << 11,
104 OPT_prescred = (1 << 12) * ENABLE_FEATURE_NSENTER_LONG_OPTS, 82 OPT_prescred = (1 << 12) * ENABLE_LONG_OPTS,
105}; 83};
106enum { 84enum {
107 NS_USR_POS = 0, 85 NS_USR_POS = 0,
@@ -130,7 +108,7 @@ static const struct namespace_descr ns_list[] = {
130 */ 108 */
131static const char opt_str[] ALIGN1 = "U::i::u::n::p::m::""t+S+G+r::w::F"; 109static const char opt_str[] ALIGN1 = "U::i::u::n::p::m::""t+S+G+r::w::F";
132 110
133#if ENABLE_FEATURE_NSENTER_LONG_OPTS 111#if ENABLE_LONG_OPTS
134static const char nsenter_longopts[] ALIGN1 = 112static const char nsenter_longopts[] ALIGN1 =
135 "user\0" Optional_argument "U" 113 "user\0" Optional_argument "U"
136 "ipc\0" Optional_argument "i" 114 "ipc\0" Optional_argument "i"
@@ -190,8 +168,7 @@ int nsenter_main(int argc UNUSED_PARAM, char **argv)
190 168
191 memset(ns_ctx_list, 0, sizeof(ns_ctx_list)); 169 memset(ns_ctx_list, 0, sizeof(ns_ctx_list));
192 170
193 IF_FEATURE_NSENTER_LONG_OPTS(applet_long_options = nsenter_longopts); 171 opts = getopt32long(argv, opt_str, nsenter_longopts,
194 opts = getopt32(argv, opt_str,
195 &ns_ctx_list[NS_USR_POS].path, 172 &ns_ctx_list[NS_USR_POS].path,
196 &ns_ctx_list[NS_IPC_POS].path, 173 &ns_ctx_list[NS_IPC_POS].path,
197 &ns_ctx_list[NS_UTS_POS].path, 174 &ns_ctx_list[NS_UTS_POS].path,
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index 4c47c5369..2a3d61f21 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -154,11 +154,11 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv)
154 "seconds\0" Required_argument "s" 154 "seconds\0" Required_argument "s"
155 "time\0" Required_argument "t" 155 "time\0" Required_argument "t"
156 ; 156 ;
157 applet_long_options = rtcwake_longopts;
158#endif 157#endif
159 /* Must have -s or -t, exclusive */ 158 /* Must have -s or -t, exclusive */
160 opt_complementary = "s:t:s--t:t--s"; 159 opt_complementary = "s:t:s--t:t--s";
161 opt = getopt32(argv, "alud:m:s:t:", &rtcname, &suspend, &opt_seconds, &opt_time); 160 opt = getopt32long(argv, "alud:m:s:t:", rtcwake_longopts,
161 &rtcname, &suspend, &opt_seconds, &opt_time);
162 162
163 /* this is the default 163 /* this is the default
164 if (opt & RTCWAKE_OPT_AUTO) 164 if (opt & RTCWAKE_OPT_AUTO)
diff --git a/util-linux/script.c b/util-linux/script.c
index 4cb9842a0..8174c65bf 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -78,12 +78,10 @@ int script_main(int argc UNUSED_PARAM, char **argv)
78 "quiet\0" No_argument "q" 78 "quiet\0" No_argument "q"
79 "timing\0" Optional_argument "t" 79 "timing\0" Optional_argument "t"
80 ; 80 ;
81
82 applet_long_options = script_longopts;
83#endif 81#endif
84 82
85 opt_complementary = "?1"; /* max one arg */ 83 opt_complementary = "?1"; /* max one arg */
86 opt = getopt32(argv, "ac:fqt::", &shell_arg, &str_t); 84 opt = getopt32long(argv, "ac:fqt::", script_longopts, &shell_arg, &str_t);
87 //argc -= optind; 85 //argc -= optind;
88 argv += optind; 86 argv += optind;
89 if (argv[0]) { 87 if (argv[0]) {
diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c
index 0f85428ab..5c532d637 100644
--- a/util-linux/setpriv.c
+++ b/util-linux/setpriv.c
@@ -421,9 +421,12 @@ int setpriv_main(int argc UNUSED_PARAM, char **argv)
421 int opts; 421 int opts;
422 IF_FEATURE_SETPRIV_CAPABILITIES(char *inh_caps, *ambient_caps;) 422 IF_FEATURE_SETPRIV_CAPABILITIES(char *inh_caps, *ambient_caps;)
423 423
424 applet_long_options = setpriv_longopts; 424 opts = getopt32long(argv,
425 opts = getopt32(argv, "+"IF_FEATURE_SETPRIV_DUMP("d") 425 "+"IF_FEATURE_SETPRIV_DUMP("d")
426 IF_FEATURE_SETPRIV_CAPABILITIES("\xfe:\xfd:", &inh_caps, &ambient_caps)); 426 IF_FEATURE_SETPRIV_CAPABILITIES("\xfe:\xfd:"),
427 setpriv_longopts
428 IF_FEATURE_SETPRIV_CAPABILITIES(, &inh_caps, &ambient_caps)
429 );
427 argv += optind; 430 argv += optind;
428 431
429#if ENABLE_FEATURE_SETPRIV_DUMP 432#if ENABLE_FEATURE_SETPRIV_DUMP
diff --git a/util-linux/unshare.c b/util-linux/unshare.c
index e7b95c72b..df377478f 100644
--- a/util-linux/unshare.c
+++ b/util-linux/unshare.c
@@ -220,8 +220,7 @@ int unshare_main(int argc UNUSED_PARAM, char **argv)
220 ":ru" /* --map-root-user or -r implies -u */ 220 ":ru" /* --map-root-user or -r implies -u */
221 ":\xfd""m" /* --mount-proc implies -m */ 221 ":\xfd""m" /* --mount-proc implies -m */
222 ; 222 ;
223 applet_long_options = unshare_longopts; 223 opts = getopt32long(argv, opt_str, unshare_longopts,
224 opts = getopt32(argv, opt_str,
225 &proc_mnt_target, &prop_str, &setgrp_str, 224 &proc_mnt_target, &prop_str, &setgrp_str,
226 &ns_ctx_list[NS_MNT_POS].path, 225 &ns_ctx_list[NS_MNT_POS].path,
227 &ns_ctx_list[NS_UTS_POS].path, 226 &ns_ctx_list[NS_UTS_POS].path,