diff options
-rw-r--r-- | coreutils/ls.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 3c659294c..d15588a13 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -109,8 +109,11 @@ | |||
109 | //usage:#define ls_full_usage "\n\n" | 109 | //usage:#define ls_full_usage "\n\n" |
110 | //usage: "List directory contents\n" | 110 | //usage: "List directory contents\n" |
111 | //usage: "\n -1 One column output" | 111 | //usage: "\n -1 One column output" |
112 | //usage: "\n -a Include names starting with ." | 112 | //usage: "\n -a Include names starting with ." IF_PLATFORM_MINGW32(" and hidden files") |
113 | //usage: "\n -A Like -a, but exclude . and .." | 113 | //usage: "\n -A Like -a, but exclude . and .." |
114 | //usage: IF_PLATFORM_MINGW32( | ||
115 | //usage: "\n -aa,-AA Like -a,-A but omit hidden system files" | ||
116 | //usage: ) | ||
114 | ////usage: "\n -C List by columns" - don't show, this is a default anyway | 117 | ////usage: "\n -C List by columns" - don't show, this is a default anyway |
115 | //usage: "\n -x List by lines" | 118 | //usage: "\n -x List by lines" |
116 | //usage: "\n -d List directory names, not contents" | 119 | //usage: "\n -d List directory names, not contents" |
@@ -340,6 +343,10 @@ struct globals { | |||
340 | /* Do time() just once. Saves one syscall per file for "ls -l" */ | 343 | /* Do time() just once. Saves one syscall per file for "ls -l" */ |
341 | time_t current_time_t; | 344 | time_t current_time_t; |
342 | #endif | 345 | #endif |
346 | #if ENABLE_PLATFORM_MINGW32 | ||
347 | int a_count, A_count; | ||
348 | # define HIDSYS (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM) | ||
349 | #endif | ||
343 | } FIX_ALIASING; | 350 | } FIX_ALIASING; |
344 | #define G (*(struct globals*)bb_common_bufsiz1) | 351 | #define G (*(struct globals*)bb_common_bufsiz1) |
345 | #define INIT_G() do { \ | 352 | #define INIT_G() do { \ |
@@ -974,7 +981,10 @@ static struct dnode **scan_one_dir(const char *path, unsigned *nfiles_p) | |||
974 | if (!cur) { | 981 | if (!cur) { |
975 | #else | 982 | #else |
976 | if (!cur || ((cur->dn_attr & FILE_ATTRIBUTE_HIDDEN) && | 983 | if (!cur || ((cur->dn_attr & FILE_ATTRIBUTE_HIDDEN) && |
977 | !(option_mask32 & (OPT_a|OPT_A)))) { | 984 | !(option_mask32 & (OPT_a|OPT_A))) || |
985 | (((cur->dn_attr & HIDSYS) == HIDSYS) && | ||
986 | MAX(G.a_count, G.A_count) > 1) | ||
987 | ) { | ||
978 | /* skip invalid or hidden files */ | 988 | /* skip invalid or hidden files */ |
979 | #endif | 989 | #endif |
980 | free(fullname); | 990 | free(fullname); |
@@ -1166,9 +1176,11 @@ int ls_main(int argc UNUSED_PARAM, char **argv) | |||
1166 | IF_FEATURE_LS_TIMESTAMPS(":c-u:u-c") /* mtime/atime */ | 1176 | IF_FEATURE_LS_TIMESTAMPS(":c-u:u-c") /* mtime/atime */ |
1167 | /* -w NUM: */ | 1177 | /* -w NUM: */ |
1168 | IF_FEATURE_LS_WIDTH(":w+") | 1178 | IF_FEATURE_LS_WIDTH(":w+") |
1179 | IF_PLATFORM_MINGW32(":aa:AA") | ||
1169 | , ls_longopts | 1180 | , ls_longopts |
1170 | IF_FEATURE_LS_WIDTH(, /*-T*/ NULL, /*-w*/ &G_terminal_width) | 1181 | IF_FEATURE_LS_WIDTH(, /*-T*/ NULL, /*-w*/ &G_terminal_width) |
1171 | IF_FEATURE_LS_COLOR(, &color_opt) | 1182 | IF_FEATURE_LS_COLOR(, &color_opt) |
1183 | IF_PLATFORM_MINGW32(, &G.a_count, &G.A_count) | ||
1172 | ); | 1184 | ); |
1173 | #if 0 /* option bits debug */ | 1185 | #if 0 /* option bits debug */ |
1174 | bb_error_msg("opt:0x%08x l:%x H:%x color:%x dirs:%x", opt, OPT_l, OPT_H, OPT_color, OPT_dirs_first); | 1186 | bb_error_msg("opt:0x%08x l:%x H:%x color:%x dirs:%x", opt, OPT_l, OPT_H, OPT_color, OPT_dirs_first); |