rework long option handling. saves ~1.2k
[platform/upstream/busybox.git] / coreutils / install.c
index 8d71fa0..8d54949 100644 (file)
 #include "libcoreutils/coreutils.h"
 
 #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
-static const struct option install_long_options[] = {
-       { "directory",           0, NULL, 'd' },
-       { "preserve-timestamps", 0, NULL, 'p' },
-       { "strip",               0, NULL, 's' },
-       { "group",               0, NULL, 'g' },
-       { "mode",                0, NULL, 'm' },
-       { "owner",               0, NULL, 'o' },
+static const char install_longopts[] =
+       "directory\0"           No_argument       "d"
+       "preserve-timestamps\0" No_argument       "p"
+       "strip\0"               No_argument       "s"
+       "group\0"               No_argument       "g"
+       "mode\0"                No_argument       "m"
+       "owner\0"               No_argument       "o"
 #if ENABLE_SELINUX
-       { "context",             1, NULL, 'Z' },
-       { "preserve_context",    0, NULL, 0xff },
-       { "preserve-context",    0, NULL, 0xff },
+       "context\0"             Required_argument "Z"
+       "preserve_context\0"    No_argument       "\xff"
+       "preserve-context\0"    No_argument       "\xff"
 #endif
-       { 0, 0, 0, 0 }
-};
+       "\0";
 #endif
 
 
@@ -97,7 +96,7 @@ int install_main(int argc, char **argv)
        };
 
 #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
-       applet_long_options = install_long_options;
+       applet_long_options = install_longopts;
 #endif
        opt_complementary = "s--d:d--s" USE_SELINUX(":Z--\xff:\xff--Z");
        /* -c exists for backwards compatibility, it's needed */