aboutsummaryrefslogtreecommitdiff
path: root/coreutils/mkdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/mkdir.c')
-rw-r--r--coreutils/mkdir.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 22851187c..986353dc6 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -18,11 +18,6 @@
18//config: default y 18//config: default y
19//config: help 19//config: help
20//config: mkdir is used to create directories with the specified names. 20//config: mkdir is used to create directories with the specified names.
21//config:
22//config:config FEATURE_MKDIR_LONG_OPTIONS
23//config: bool "Enable long options"
24//config: default y
25//config: depends on MKDIR && LONG_OPTS
26 21
27//applet:IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir)) 22//applet:IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir))
28 23
@@ -53,19 +48,6 @@
53 48
54/* This is a NOFORK applet. Be very careful! */ 49/* This is a NOFORK applet. Be very careful! */
55 50
56#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
57static const char mkdir_longopts[] ALIGN1 =
58 "mode\0" Required_argument "m"
59 "parents\0" No_argument "p"
60#if ENABLE_SELINUX
61 "context\0" Required_argument "Z"
62#endif
63#if ENABLE_FEATURE_VERBOSE
64 "verbose\0" No_argument "v"
65#endif
66 ;
67#endif
68
69int mkdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 51int mkdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
70int mkdir_main(int argc UNUSED_PARAM, char **argv) 52int mkdir_main(int argc UNUSED_PARAM, char **argv)
71{ 53{
@@ -78,10 +60,17 @@ int mkdir_main(int argc UNUSED_PARAM, char **argv)
78 security_context_t scontext; 60 security_context_t scontext;
79#endif 61#endif
80 62
81#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS 63 opt = getopt32long(argv, "m:pv" IF_SELINUX("Z:"),
82 applet_long_options = mkdir_longopts; 64 "mode\0" Required_argument "m"
83#endif 65 "parents\0" No_argument "p"
84 opt = getopt32(argv, "m:pv" IF_SELINUX("Z:"), &smode IF_SELINUX(,&scontext)); 66# if ENABLE_SELINUX
67 "context\0" Required_argument "Z"
68# endif
69# if ENABLE_FEATURE_VERBOSE
70 "verbose\0" No_argument "v"
71# endif
72 , &smode IF_SELINUX(,&scontext)
73 );
85 if (opt & 1) { 74 if (opt & 1) {
86 mode_t mmode = bb_parse_mode(smode, 0777); 75 mode_t mmode = bb_parse_mode(smode, 0777);
87 if (mmode == (mode_t)-1) { 76 if (mmode == (mode_t)-1) {