summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/getopt.c25
-rw-r--r--util-linux/hwclock.c19
2 files changed, 21 insertions, 23 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index a5e6743..5ee13ec 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -266,18 +266,17 @@ static void set_shell(const char *new_shell)
*/
#if ENABLE_GETOPT_LONG
-static const struct option longopts[] = {
- { "options", required_argument, NULL, 'o' },
- { "longoptions", required_argument, NULL, 'l' },
- { "quiet", no_argument, NULL, 'q' },
- { "quiet-output", no_argument, NULL, 'Q' },
- { "shell", required_argument, NULL, 's' },
- { "test", no_argument, NULL, 'T' },
- { "unquoted", no_argument, NULL, 'u' },
- { "alternative", no_argument, NULL, 'a' },
- { "name", required_argument, NULL, 'n' },
- { NULL, 0, NULL, 0 }
-};
+static const char getopt_longopts[] =
+ "options\0" Required_argument "o"
+ "longoptions\0" Required_argument "l"
+ "quiet\0" No_argument "q"
+ "quiet-output\0" No_argument "Q"
+ "shell\0" Required_argument "s"
+ "test\0" No_argument "T"
+ "unquoted\0" No_argument "u"
+ "alternative\0" No_argument "a"
+ "name\0" Required_argument "n"
+ "\0";
#endif
int getopt_main(int argc, char *argv[]);
@@ -317,7 +316,7 @@ int getopt_main(int argc, char *argv[])
#if !ENABLE_GETOPT_LONG
opt = getopt32(argc, argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg);
#else
- applet_long_options = longopts;
+ applet_long_options = getopt_longopts;
opt_complementary = "l::";
opt = getopt32(argc, argv, "+o:n:qQs:Tual:",
&optstr, &name, &s_arg, &l_arg);
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 882a0c5..ff696a3 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -178,16 +178,15 @@ int hwclock_main(int argc, char **argv)
int utc;
#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
- static const struct option hwclock_long_options[] = {
- { "localtime", 0, 0, 'l' },
- { "utc", 0, 0, 'u' },
- { "show", 0, 0, 'r' },
- { "hctosys", 0, 0, 's' },
- { "systohc", 0, 0, 'w' },
- { "file", 1, 0, 'f' },
- { 0, 0, 0, 0 }
- };
- applet_long_options = hwclock_long_options;
+ static const char hwclock_longopts[] =
+ "localtime\0" No_argument "l"
+ "utc\0" No_argument "u"
+ "show\0" No_argument "r"
+ "hctosys\0" No_argument "s"
+ "systohc\0" No_argument "w"
+ "file\0" Required_argument "f"
+ "\0";
+ applet_long_options = hwclock_longopts;
#endif
opt_complementary = "r--ws:w--rs:s--wr:l--u:u--l";
opt = getopt32(argc, argv, "lurswf:", &rtcname);