-#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
-#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
-#define APPCHAR(mode) ("\0|\0\0/\0\0\0\0\0@\0=\0\0\0" [TYPEINDEX(mode)])
-#define COLOR(mode) ("\000\043\043\043\042\000\043\043"\
- "\000\000\044\000\043\000\000\040" [TYPEINDEX(mode)])
-#define ATTR(mode) ("\00\00\01\00\01\00\01\00"\
- "\00\00\01\00\01\00\00\01" [TYPEINDEX(mode)])
-
-/* colored LS support by JaWi, janwillem.janssen@lxtreme.nl */
-#if ENABLE_FEATURE_LS_COLOR
-static int show_color;
-/* long option entry used only for --color, which has no short option
- * equivalent */
-static const struct option ls_color_opt[] = {
- { "color", optional_argument, NULL, 1 },
- { NULL, 0, NULL, 0 }
+/* -Cadil1 Std options, busybox always supports */
+/* -gnsxA Std options, busybox always supports */
+/* -Q GNU option, busybox always supports */
+/* -k SELinux option, busybox always supports (ignores if !SELinux) */
+/* Std has -k which means "show sizes in kbytes" */
+/* -LHRctur Std options, busybox optionally supports */
+/* -Fp Std options, busybox optionally supports */
+/* -SXvhTw GNU options, busybox optionally supports */
+/* -T WIDTH Ignored (we don't use tabs on output) */
+/* -KZ SELinux mandated options, busybox optionally supports */
+/* (coreutils 8.4 has no -K, remove it?) */
+/* -e I think we made this one up (looks similar to GNU --full-time) */
+/* We already used up all 32 bits, if we need to add more, candidates for removal: */
+/* -K, -T, -e (add --full-time instead) */
+static const char ls_options[] ALIGN1 =
+ "Cadil1gnsxQAk" /* 13 opts, total 13 */
+ IF_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
+ IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */
+ IF_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */
+ IF_FEATURE_LS_RECURSIVE("R") /* 1, 24 */
+ IF_SELINUX("KZ") /* 2, 26 */
+ IF_FEATURE_LS_FOLLOWLINKS("LH") /* 2, 28 */
+ IF_FEATURE_HUMAN_READABLE("h") /* 1, 29 */
+ IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 31 */
+ /* with --color, we use all 32 bits */;
+enum {
+ //OPT_C = (1 << 0),
+ //OPT_a = (1 << 1),
+ //OPT_d = (1 << 2),
+ //OPT_i = (1 << 3),
+ //OPT_l = (1 << 4),
+ //OPT_1 = (1 << 5),
+ OPT_g = (1 << 6),
+ //OPT_n = (1 << 7),
+ //OPT_s = (1 << 8),
+ //OPT_x = (1 << 9),
+ OPT_Q = (1 << 10),
+ //OPT_A = (1 << 11),
+ //OPT_k = (1 << 12),
+
+ OPTBIT_c = 13,
+ OPTBIT_e,
+ OPTBIT_t,
+ OPTBIT_u,
+ OPTBIT_S = OPTBIT_c + 4 * ENABLE_FEATURE_LS_TIMESTAMPS,
+ OPTBIT_X, /* 18 */
+ OPTBIT_r,
+ OPTBIT_v,
+ OPTBIT_F = OPTBIT_S + 4 * ENABLE_FEATURE_LS_SORTFILES,
+ OPTBIT_p, /* 22 */
+ OPTBIT_R = OPTBIT_F + 2 * ENABLE_FEATURE_LS_FILETYPES,
+ OPTBIT_K = OPTBIT_R + 1 * ENABLE_FEATURE_LS_RECURSIVE,
+ OPTBIT_Z, /* 25 */
+ OPTBIT_L = OPTBIT_K + 2 * ENABLE_SELINUX,
+ OPTBIT_H, /* 27 */
+ OPTBIT_h = OPTBIT_L + 2 * ENABLE_FEATURE_LS_FOLLOWLINKS,
+ OPTBIT_T = OPTBIT_h + 1 * ENABLE_FEATURE_HUMAN_READABLE,
+ OPTBIT_w, /* 30 */
+ OPTBIT_color = OPTBIT_T + 2 * ENABLE_FEATURE_AUTOWIDTH,
+
+ OPT_c = (1 << OPTBIT_c) * ENABLE_FEATURE_LS_TIMESTAMPS,
+ OPT_e = (1 << OPTBIT_e) * ENABLE_FEATURE_LS_TIMESTAMPS,
+ OPT_t = (1 << OPTBIT_t) * ENABLE_FEATURE_LS_TIMESTAMPS,
+ OPT_u = (1 << OPTBIT_u) * ENABLE_FEATURE_LS_TIMESTAMPS,
+ OPT_S = (1 << OPTBIT_S) * ENABLE_FEATURE_LS_SORTFILES,
+ OPT_X = (1 << OPTBIT_X) * ENABLE_FEATURE_LS_SORTFILES,
+ OPT_r = (1 << OPTBIT_r) * ENABLE_FEATURE_LS_SORTFILES,
+ OPT_v = (1 << OPTBIT_v) * ENABLE_FEATURE_LS_SORTFILES,
+ OPT_F = (1 << OPTBIT_F) * ENABLE_FEATURE_LS_FILETYPES,
+ OPT_p = (1 << OPTBIT_p) * ENABLE_FEATURE_LS_FILETYPES,
+ OPT_R = (1 << OPTBIT_R) * ENABLE_FEATURE_LS_RECURSIVE,
+ OPT_K = (1 << OPTBIT_K) * ENABLE_SELINUX,
+ OPT_Z = (1 << OPTBIT_Z) * ENABLE_SELINUX,
+ OPT_L = (1 << OPTBIT_L) * ENABLE_FEATURE_LS_FOLLOWLINKS,
+ OPT_H = (1 << OPTBIT_H) * ENABLE_FEATURE_LS_FOLLOWLINKS,
+ OPT_h = (1 << OPTBIT_h) * ENABLE_FEATURE_HUMAN_READABLE,
+ OPT_T = (1 << OPTBIT_T) * ENABLE_FEATURE_AUTOWIDTH,
+ OPT_w = (1 << OPTBIT_w) * ENABLE_FEATURE_AUTOWIDTH,
+ OPT_color = (1 << OPTBIT_color) * ENABLE_FEATURE_LS_COLOR,