*: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
This commit is contained in:
@@ -46,12 +46,12 @@
|
||||
*/
|
||||
# undef CONFIG_FEATURE_LS_TIMESTAMPS
|
||||
# undef ENABLE_FEATURE_LS_TIMESTAMPS
|
||||
# undef USE_FEATURE_LS_TIMESTAMPS
|
||||
# undef SKIP_FEATURE_LS_TIMESTAMPS
|
||||
# undef IF_FEATURE_LS_TIMESTAMPS
|
||||
# undef IF_NOT_FEATURE_LS_TIMESTAMPS
|
||||
# define CONFIG_FEATURE_LS_TIMESTAMPS 1
|
||||
# define ENABLE_FEATURE_LS_TIMESTAMPS 1
|
||||
# define USE_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__
|
||||
# define SKIP_FEATURE_LS_TIMESTAMPS(...)
|
||||
# define IF_FEATURE_LS_TIMESTAMPS(...) __VA_ARGS__
|
||||
# define IF_NOT_FEATURE_LS_TIMESTAMPS(...)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -138,15 +138,15 @@ SPLIT_SUBDIR = 2,
|
||||
/* "[-]e", I think we made this one up */
|
||||
static const char ls_options[] ALIGN1 =
|
||||
"Cadil1gnsxQAk" /* 13 opts, total 13 */
|
||||
USE_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
|
||||
USE_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */
|
||||
USE_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */
|
||||
USE_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */
|
||||
USE_FEATURE_LS_RECURSIVE("R") /* 1, 25 */
|
||||
USE_FEATURE_HUMAN_READABLE("h") /* 1, 26 */
|
||||
USE_SELINUX("K") /* 1, 27 */
|
||||
USE_SELINUX("Z") /* 1, 28 */
|
||||
USE_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */
|
||||
IF_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
|
||||
IF_FEATURE_LS_SORTFILES("SXrv") /* 4, 21 */
|
||||
IF_FEATURE_LS_FILETYPES("Fp") /* 2, 23 */
|
||||
IF_FEATURE_LS_FOLLOWLINKS("L") /* 1, 24 */
|
||||
IF_FEATURE_LS_RECURSIVE("R") /* 1, 25 */
|
||||
IF_FEATURE_HUMAN_READABLE("h") /* 1, 26 */
|
||||
IF_SELINUX("K") /* 1, 27 */
|
||||
IF_SELINUX("Z") /* 1, 28 */
|
||||
IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 30 */
|
||||
;
|
||||
enum {
|
||||
//OPT_C = (1 << 0),
|
||||
@@ -232,7 +232,7 @@ struct dnode { /* the basic node */
|
||||
const char *fullname; /* the dir entry name */
|
||||
int allocated;
|
||||
struct stat dstat; /* the file stat info */
|
||||
USE_SELINUX(security_context_t sid;)
|
||||
IF_SELINUX(security_context_t sid;)
|
||||
struct dnode *next; /* point at the next node */
|
||||
};
|
||||
|
||||
@@ -277,9 +277,9 @@ enum {
|
||||
/* memset: we have to zero it out because of NOEXEC */
|
||||
#define INIT_G() do { \
|
||||
memset(&G, 0, sizeof(G)); \
|
||||
USE_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \
|
||||
USE_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \
|
||||
USE_FEATURE_LS_TIMESTAMPS(time(¤t_time_t);) \
|
||||
IF_FEATURE_AUTOWIDTH(tabstops = COLUMN_GAP;) \
|
||||
IF_FEATURE_AUTOWIDTH(terminal_width = TERMINAL_WIDTH;) \
|
||||
IF_FEATURE_LS_TIMESTAMPS(time(¤t_time_t);) \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
|
||||
{
|
||||
struct stat dstat;
|
||||
struct dnode *cur;
|
||||
USE_SELINUX(security_context_t sid = NULL;)
|
||||
IF_SELINUX(security_context_t sid = NULL;)
|
||||
|
||||
if ((all_fmt & FOLLOW_LINKS) || force_follow) {
|
||||
#if ENABLE_SELINUX
|
||||
@@ -332,7 +332,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f
|
||||
cur->fullname = fullname;
|
||||
cur->name = name;
|
||||
cur->dstat = dstat;
|
||||
USE_SELINUX(cur->sid = sid;)
|
||||
IF_SELINUX(cur->sid = sid;)
|
||||
return cur;
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ static void showfiles(struct dnode **dn, int nfiles)
|
||||
column_width = len;
|
||||
}
|
||||
column_width += tabstops +
|
||||
USE_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + )
|
||||
IF_SELINUX( ((all_fmt & LIST_CONTEXT) ? 33 : 0) + )
|
||||
((all_fmt & LIST_INO) ? 8 : 0) +
|
||||
((all_fmt & LIST_BLOCKS) ? 5 : 0);
|
||||
ncols = (int) (terminal_width / column_width);
|
||||
@@ -912,7 +912,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
|
||||
int dndirs;
|
||||
int i;
|
||||
/* need to initialize since --color has _an optional_ argument */
|
||||
USE_FEATURE_LS_COLOR(const char *color_opt = "always";)
|
||||
IF_FEATURE_LS_COLOR(const char *color_opt = "always";)
|
||||
|
||||
INIT_G();
|
||||
|
||||
@@ -927,13 +927,13 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
|
||||
#endif
|
||||
|
||||
/* process options */
|
||||
USE_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;)
|
||||
IF_FEATURE_LS_COLOR(applet_long_options = ls_color_opt;)
|
||||
#if ENABLE_FEATURE_AUTOWIDTH
|
||||
opt_complementary = "T+:w+"; /* -T N, -w N */
|
||||
opt = getopt32(argv, ls_options, &tabstops, &terminal_width
|
||||
USE_FEATURE_LS_COLOR(, &color_opt));
|
||||
IF_FEATURE_LS_COLOR(, &color_opt));
|
||||
#else
|
||||
opt = getopt32(argv, ls_options USE_FEATURE_LS_COLOR(, &color_opt));
|
||||
opt = getopt32(argv, ls_options IF_FEATURE_LS_COLOR(, &color_opt));
|
||||
#endif
|
||||
for (i = 0; opt_flags[i] != (1U<<31); i++) {
|
||||
if (opt & (1 << i)) {
|
||||
|
||||
Reference in New Issue
Block a user