diff options
-rw-r--r-- | coreutils/Config.in | 7 | ||||
-rw-r--r-- | coreutils/chown.c | 18 |
2 files changed, 24 insertions, 1 deletions
diff --git a/coreutils/Config.in b/coreutils/Config.in index 49e285982..1e32e2664 100644 --- a/coreutils/Config.in +++ b/coreutils/Config.in | |||
@@ -52,6 +52,13 @@ config CHOWN | |||
52 | chown is used to change the user and/or group ownership | 52 | chown is used to change the user and/or group ownership |
53 | of files. | 53 | of files. |
54 | 54 | ||
55 | config FEATURE_CHOWN_LONG_OPTIONS | ||
56 | bool "Enable long options" | ||
57 | default n | ||
58 | depends on CHOWN && LONG_OPTS | ||
59 | help | ||
60 | Enable use of long options | ||
61 | |||
55 | config CHROOT | 62 | config CHROOT |
56 | bool "chroot" | 63 | bool "chroot" |
57 | default n | 64 | default n |
diff --git a/coreutils/chown.c b/coreutils/chown.c index 2d8e556f0..d29f8252a 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -8,7 +8,6 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* BB_AUDIT SUSv3 defects - none? */ | 10 | /* BB_AUDIT SUSv3 defects - none? */ |
11 | /* BB_AUDIT GNU defects - unsupported long options. */ | ||
12 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */ |
13 | 12 | ||
14 | #include "libbb.h" | 13 | #include "libbb.h" |
@@ -37,6 +36,20 @@ | |||
37 | #define BIT_TRAVERSE_TOP (0x20|0x40) | 36 | #define BIT_TRAVERSE_TOP (0x20|0x40) |
38 | #define OPT_TRAVERSE_TOP (IF_DESKTOP(opt & BIT_TRAVERSE_TOP) IF_NOT_DESKTOP(0)) | 37 | #define OPT_TRAVERSE_TOP (IF_DESKTOP(opt & BIT_TRAVERSE_TOP) IF_NOT_DESKTOP(0)) |
39 | 38 | ||
39 | #if ENABLE_FEATURE_CHOWN_LONG_OPTIONS | ||
40 | static const char chown_longopts[] ALIGN1 = | ||
41 | "recursive\0" No_argument "R" | ||
42 | "dereference\0" No_argument "\xff" | ||
43 | "no-dereference\0" No_argument "h" | ||
44 | # if ENABLE_DESKTOP | ||
45 | "changes\0" No_argument "c" | ||
46 | "silent\0" No_argument "f" | ||
47 | "quiet\0" No_argument "f" | ||
48 | "verbose\0" No_argument "v" | ||
49 | # endif | ||
50 | ; | ||
51 | #endif | ||
52 | |||
40 | typedef int (*chown_fptr)(const char *, uid_t, gid_t); | 53 | typedef int (*chown_fptr)(const char *, uid_t, gid_t); |
41 | 54 | ||
42 | struct param_t { | 55 | struct param_t { |
@@ -78,6 +91,9 @@ int chown_main(int argc UNUSED_PARAM, char **argv) | |||
78 | param.ugid.gid = -1; | 91 | param.ugid.gid = -1; |
79 | param.chown_func = chown; | 92 | param.chown_func = chown; |
80 | 93 | ||
94 | #if ENABLE_FEATURE_CHOWN_LONG_OPTIONS | ||
95 | applet_long_options = chown_longopts; | ||
96 | #endif | ||
81 | opt_complementary = "-2"; | 97 | opt_complementary = "-2"; |
82 | opt = getopt32(argv, OPT_STR); | 98 | opt = getopt32(argv, OPT_STR); |
83 | argv += optind; | 99 | argv += optind; |