diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/env.c | 11 | ||||
-rw-r--r-- | coreutils/install.c | 25 | ||||
-rw-r--r-- | coreutils/ls.c | 9 | ||||
-rw-r--r-- | coreutils/mkdir.c | 13 | ||||
-rw-r--r-- | coreutils/mv.c | 11 | ||||
-rw-r--r-- | coreutils/od_bloaty.c | 23 |
6 files changed, 43 insertions, 49 deletions
diff --git a/coreutils/env.c b/coreutils/env.c index ad30f0193..8d20eac9c 100644 --- a/coreutils/env.c +++ b/coreutils/env.c | |||
@@ -35,11 +35,10 @@ extern char **environ; | |||
35 | #include "libbb.h" | 35 | #include "libbb.h" |
36 | 36 | ||
37 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS | 37 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS |
38 | static const struct option env_long_options[] = { | 38 | static const char env_longopts[] = |
39 | { "ignore-environment", 0, NULL, 'i' }, | 39 | "ignore-environment\0" No_argument "i" |
40 | { "unset", 1, NULL, 'u' }, | 40 | "unset\0" Required_argument "u" |
41 | { 0, 0, 0, 0 } | 41 | "\0"; |
42 | }; | ||
43 | #endif | 42 | #endif |
44 | 43 | ||
45 | int env_main(int argc, char** argv); | 44 | int env_main(int argc, char** argv); |
@@ -53,7 +52,7 @@ int env_main(int argc, char** argv) | |||
53 | 52 | ||
54 | opt_complementary = "u::"; | 53 | opt_complementary = "u::"; |
55 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS | 54 | #if ENABLE_FEATURE_ENV_LONG_OPTIONS |
56 | applet_long_options = env_long_options; | 55 | applet_long_options = env_longopts; |
57 | #endif | 56 | #endif |
58 | opt = getopt32(argc, argv, "+iu:", &unset_env); | 57 | opt = getopt32(argc, argv, "+iu:", &unset_env); |
59 | argv += optind; | 58 | argv += optind; |
diff --git a/coreutils/install.c b/coreutils/install.c index 8d71fa070..8d5494958 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -16,20 +16,19 @@ | |||
16 | #include "libcoreutils/coreutils.h" | 16 | #include "libcoreutils/coreutils.h" |
17 | 17 | ||
18 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS | 18 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS |
19 | static const struct option install_long_options[] = { | 19 | static const char install_longopts[] = |
20 | { "directory", 0, NULL, 'd' }, | 20 | "directory\0" No_argument "d" |
21 | { "preserve-timestamps", 0, NULL, 'p' }, | 21 | "preserve-timestamps\0" No_argument "p" |
22 | { "strip", 0, NULL, 's' }, | 22 | "strip\0" No_argument "s" |
23 | { "group", 0, NULL, 'g' }, | 23 | "group\0" No_argument "g" |
24 | { "mode", 0, NULL, 'm' }, | 24 | "mode\0" No_argument "m" |
25 | { "owner", 0, NULL, 'o' }, | 25 | "owner\0" No_argument "o" |
26 | #if ENABLE_SELINUX | 26 | #if ENABLE_SELINUX |
27 | { "context", 1, NULL, 'Z' }, | 27 | "context\0" Required_argument "Z" |
28 | { "preserve_context", 0, NULL, 0xff }, | 28 | "preserve_context\0" No_argument "\xff" |
29 | { "preserve-context", 0, NULL, 0xff }, | 29 | "preserve-context\0" No_argument "\xff" |
30 | #endif | 30 | #endif |
31 | { 0, 0, 0, 0 } | 31 | "\0"; |
32 | }; | ||
33 | #endif | 32 | #endif |
34 | 33 | ||
35 | 34 | ||
@@ -97,7 +96,7 @@ int install_main(int argc, char **argv) | |||
97 | }; | 96 | }; |
98 | 97 | ||
99 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS | 98 | #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS |
100 | applet_long_options = install_long_options; | 99 | applet_long_options = install_longopts; |
101 | #endif | 100 | #endif |
102 | opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z"); | 101 | opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z"); |
103 | /* -c exists for backwards compatibility, it's needed */ | 102 | /* -c exists for backwards compatibility, it's needed */ |
diff --git a/coreutils/ls.c b/coreutils/ls.c index a5bd0e304..8545edda9 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -117,13 +117,12 @@ SPLIT_SUBDIR = 2, | |||
117 | 117 | ||
118 | /* colored LS support by JaWi, janwillem.janssen@lxtreme.nl */ | 118 | /* colored LS support by JaWi, janwillem.janssen@lxtreme.nl */ |
119 | #if ENABLE_FEATURE_LS_COLOR | 119 | #if ENABLE_FEATURE_LS_COLOR |
120 | static int show_color; | 120 | static smallint show_color; |
121 | /* long option entry used only for --color, which has no short option | 121 | /* long option entry used only for --color, which has no short option |
122 | * equivalent */ | 122 | * equivalent */ |
123 | static const struct option ls_color_opt[] = { | 123 | static const char ls_color_opt[] = |
124 | { "color", optional_argument, NULL, 1 }, | 124 | "color\0" Optional_argument "\xff" /* no short equivalent */ |
125 | { NULL, 0, NULL, 0 } | 125 | "\0"; |
126 | }; | ||
127 | #else | 126 | #else |
128 | enum { show_color = 0 }; | 127 | enum { show_color = 0 }; |
129 | #endif | 128 | #endif |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 60c03a1f9..b0595b43f 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -25,14 +25,13 @@ | |||
25 | /* This is a NOFORK applet. Be very careful! */ | 25 | /* This is a NOFORK applet. Be very careful! */ |
26 | 26 | ||
27 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS | 27 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS |
28 | static const struct option mkdir_long_options[] = { | 28 | static const char mkdir_longopts[] = |
29 | { "mode" , 1, NULL, 'm' }, | 29 | "mode\0" Required_argument "m" |
30 | { "parents", 0, NULL, 'p' }, | 30 | "parents\0" No_argument "p" |
31 | #if ENABLE_SELINUX | 31 | #if ENABLE_SELINUX |
32 | { "context", 1, NULL, 'Z' }, | 32 | "context\0" Required_argument "Z" |
33 | #endif | 33 | #endif |
34 | { NULL, 0, NULL, 0 } | 34 | "\0"; |
35 | }; | ||
36 | #endif | 35 | #endif |
37 | 36 | ||
38 | int mkdir_main(int argc, char **argv); | 37 | int mkdir_main(int argc, char **argv); |
@@ -48,7 +47,7 @@ int mkdir_main(int argc, char **argv) | |||
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS | 49 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS |
51 | applet_long_options = mkdir_long_options; | 50 | applet_long_options = mkdir_longopts; |
52 | #endif | 51 | #endif |
53 | opt = getopt32(argc, argv, "m:p" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); | 52 | opt = getopt32(argc, argv, "m:p" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext)); |
54 | if (opt & 1) { | 53 | if (opt & 1) { |
diff --git a/coreutils/mv.c b/coreutils/mv.c index 8d9c9827a..bb96af8f6 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -21,11 +21,10 @@ | |||
21 | #include "libcoreutils/coreutils.h" | 21 | #include "libcoreutils/coreutils.h" |
22 | 22 | ||
23 | #if ENABLE_FEATURE_MV_LONG_OPTIONS | 23 | #if ENABLE_FEATURE_MV_LONG_OPTIONS |
24 | static const struct option mv_long_options[] = { | 24 | static const char mv_longopts[] = |
25 | { "interactive", 0, NULL, 'i' }, | 25 | "interactive\0" No_argument "i" |
26 | { "force", 0, NULL, 'f' }, | 26 | "force\0" No_argument "f" |
27 | { 0, 0, 0, 0 } | 27 | "\0"; |
28 | }; | ||
29 | #endif | 28 | #endif |
30 | 29 | ||
31 | #define OPT_FILEUTILS_FORCE 1 | 30 | #define OPT_FILEUTILS_FORCE 1 |
@@ -45,7 +44,7 @@ int mv_main(int argc, char **argv) | |||
45 | int copy_flag = 0; | 44 | int copy_flag = 0; |
46 | 45 | ||
47 | #if ENABLE_FEATURE_MV_LONG_OPTIONS | 46 | #if ENABLE_FEATURE_MV_LONG_OPTIONS |
48 | applet_long_options = mv_long_options; | 47 | applet_long_options = mv_longopts; |
49 | #endif | 48 | #endif |
50 | opt_complementary = "f-i:i-f"; | 49 | opt_complementary = "f-i:i-f"; |
51 | flags = getopt32(argc, argv, "fi"); | 50 | flags = getopt32(argc, argv, "fi"); |
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index af5eba9ce..335efe7ca 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -1242,17 +1242,16 @@ int od_main(int argc, char **argv) | |||
1242 | OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG, | 1242 | OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG, |
1243 | }; | 1243 | }; |
1244 | #if ENABLE_GETOPT_LONG | 1244 | #if ENABLE_GETOPT_LONG |
1245 | static const struct option long_options[] = { | 1245 | static const char od_longopts[] = |
1246 | { "skip-bytes", required_argument, NULL, 'j' }, | 1246 | "skip-bytes\0" Required_argument "j" |
1247 | { "address-radix", required_argument, NULL, 'A' }, | 1247 | "address-radix\0" Required_argument "A" |
1248 | { "read-bytes", required_argument, NULL, 'N' }, | 1248 | "read-bytes\0" Required_argument "N" |
1249 | { "format", required_argument, NULL, 't' }, | 1249 | "format\0" Required_argument "t" |
1250 | { "output-duplicates", no_argument, NULL, 'v' }, | 1250 | "output-duplicates\0" No_argument "v" |
1251 | { "strings", optional_argument, NULL, 'S' }, | 1251 | "strings\0" Optional_argument "S" |
1252 | { "width", optional_argument, NULL, 'w' }, | 1252 | "width\0" Optional_argument "w" |
1253 | { "traditional", no_argument, NULL, 0xff }, | 1253 | "traditional\0" No_argument "\xff" |
1254 | { NULL, 0, NULL, 0 } | 1254 | "\0"; |
1255 | }; | ||
1256 | #endif | 1255 | #endif |
1257 | char *str_A, *str_N, *str_j, *str_S; | 1256 | char *str_A, *str_N, *str_j, *str_S; |
1258 | char *str_w = NULL; | 1257 | char *str_w = NULL; |
@@ -1267,7 +1266,7 @@ int od_main(int argc, char **argv) | |||
1267 | /* Parse command line */ | 1266 | /* Parse command line */ |
1268 | opt_complementary = "t::"; // list | 1267 | opt_complementary = "t::"; // list |
1269 | #if ENABLE_GETOPT_LONG | 1268 | #if ENABLE_GETOPT_LONG |
1270 | applet_long_options = long_options; | 1269 | applet_long_options = od_longopts; |
1271 | #endif | 1270 | #endif |
1272 | opt = getopt32(argc, argv, "A:N:abcdfhij:lot:vxsS:" | 1271 | opt = getopt32(argc, argv, "A:N:abcdfhij:lot:vxsS:" |
1273 | "w::", // -w with optional param | 1272 | "w::", // -w with optional param |