tls: reorder a few more cipher ids
[oweals/busybox.git] / util-linux / nsenter.c
index 6834292dad5ed4ab1dd9e21d434e47dca206e600..ae8103a52dc4b8e32cc4a01724c27793580ea007 100644 (file)
@@ -6,21 +6,12 @@
  *
  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
-
 //config:config NSENTER
-//config:      bool "nsenter"
+//config:      bool "nsenter (8.6 kb)"
 //config:      default y
 //config:      select PLATFORM_LINUX
 //config:      help
-//config:        Run program with namespaces of other processes.
-//config:
-//config:config FEATURE_NSENTER_LONG_OPTS
-//config:      bool "Enable long options"
-//config:      default y
-//config:      depends on NSENTER && LONG_OPTS
-//config:      help
-//config:        Support long options for the nsenter applet. This makes
-//config:        the busybox implementation more compatible with upstream.
+//config:      Run program with namespaces of other processes.
 
 //applet:IF_NSENTER(APPLET(nsenter, BB_DIR_USR_BIN, BB_SUID_DROP))
 
 
 //usage:#define nsenter_trivial_usage
 //usage:       "[OPTIONS] [PROG [ARGS]]"
-//usage:#if ENABLE_FEATURE_NSENTER_LONG_OPTS
-//usage:#define nsenter_full_usage "\n"
-//usage:     "\n       -t, --target=PID                Target process to get namespaces from"
-//usage:     "\n       -m, --mount[=FILE]              Enter mount namespace"
-//usage:     "\n       -u, --uts[=FILE]                Enter UTS namespace (hostname etc)"
-//usage:     "\n       -i, --ipc[=FILE]                Enter System V IPC namespace"
-//usage:     "\n       -n, --net[=FILE]                Enter network namespace"
-//usage:     "\n       -p, --pid[=FILE]                Enter pid namespace"
-//usage:     "\n       -U, --user[=FILE]               Enter user namespace"
-//usage:     "\n       -S, --setuid=UID                Set uid in entered namespace"
-//usage:     "\n       -G, --setgid=GID                Set gid in entered namespace"
-//usage:     "\n       --preserve-credentials          Don't touch uids or gids"
-//usage:     "\n       -r, --root[=DIR]                Set root directory"
-//usage:     "\n       -w, --wd[=DIR]                  Set working directory"
-//usage:     "\n       -F, --no-fork                   Don't fork before exec'ing PROG"
-//usage:#else
 //usage:#define nsenter_full_usage "\n"
 //usage:     "\n       -t PID          Target process to get namespaces from"
 //usage:     "\n       -m[FILE]        Enter mount namespace"
 //usage:     "\n       -U[FILE]        Enter user namespace"
 //usage:     "\n       -S UID          Set uid in entered namespace"
 //usage:     "\n       -G GID          Set gid in entered namespace"
+//usage:       IF_LONG_OPTS(
+//usage:     "\n       --preserve-credentials  Don't touch uids or gids"
+//usage:       )
 //usage:     "\n       -r[DIR]         Set root directory"
 //usage:     "\n       -w[DIR]         Set working directory"
 //usage:     "\n       -F              Don't fork before exec'ing PROG"
-//usage:#endif
 
 #include <sched.h>
 #ifndef CLONE_NEWUTS
@@ -101,7 +78,7 @@ enum {
        OPT_root        = 1 << 9,
        OPT_wd          = 1 << 10,
        OPT_nofork      = 1 << 11,
-       OPT_prescred    = (1 << 12) * ENABLE_FEATURE_NSENTER_LONG_OPTS,
+       OPT_prescred    = (1 << 12) * ENABLE_LONG_OPTS,
 };
 enum {
        NS_USR_POS = 0,
@@ -128,14 +105,14 @@ static const struct namespace_descr ns_list[] = {
 /*
  * Upstream nsenter doesn't support the short option for --preserve-credentials
  */
-static const char opt_str[] ALIGN1 = "U::i::u::n::p::m::""t+S+G+r::w::F";
+static const char opt_str[] ALIGN1 = "U::i::u::n::p::m::""t:+S:+G:+r::w::F";
 
-#if ENABLE_FEATURE_NSENTER_LONG_OPTS
+#if ENABLE_LONG_OPTS
 static const char nsenter_longopts[] ALIGN1 =
        "user\0"                        Optional_argument       "U"
        "ipc\0"                         Optional_argument       "i"
        "uts\0"                         Optional_argument       "u"
-       "network\0"                     Optional_argument       "n"
+       "net\0"                         Optional_argument       "n"
        "pid\0"                         Optional_argument       "p"
        "mount\0"                       Optional_argument       "m"
        "target\0"                      Required_argument       "t"
@@ -190,8 +167,7 @@ int nsenter_main(int argc UNUSED_PARAM, char **argv)
 
        memset(ns_ctx_list, 0, sizeof(ns_ctx_list));
 
-       IF_FEATURE_NSENTER_LONG_OPTS(applet_long_options = nsenter_longopts);
-       opts = getopt32(argv, opt_str,
+       opts = getopt32long(argv, opt_str, nsenter_longopts,
                        &ns_ctx_list[NS_USR_POS].path,
                        &ns_ctx_list[NS_IPC_POS].path,
                        &ns_ctx_list[NS_UTS_POS].path,