summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-12-19 05:16:28 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2010-12-19 05:16:28 (GMT)
commit163d86435729cc53d6d4088129f2cde106dd1318 (patch)
tree3116ade782677adf9416c3dd9c79ed402893a69d
parentd87815d5e0721176ee13776956f648e660c895d5 (diff)
downloadbusybox-163d86435729cc53d6d4088129f2cde106dd1318.tar.gz
busybox-163d86435729cc53d6d4088129f2cde106dd1318.tar.bz2
ls: make -F not follow symlinks of the command line
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/ls.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index f515f9f..02e26be 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -155,15 +155,17 @@ enum {
OPT_Q = (1 << 10),
//OPT_A = (1 << 11),
//OPT_k = (1 << 12),
- OPTBIT_color = 13
+ OPTBIT_F = 13
+ 4 * ENABLE_FEATURE_LS_TIMESTAMPS
- + 4 * ENABLE_FEATURE_LS_SORTFILES
+ + 4 * ENABLE_FEATURE_LS_SORTFILES,
+ OPTBIT_color = OPTBIT_F
+ 2 * ENABLE_FEATURE_LS_FILETYPES
+ 1 * ENABLE_FEATURE_LS_FOLLOWLINKS
+ 1 * ENABLE_FEATURE_LS_RECURSIVE
+ 1 * ENABLE_FEATURE_HUMAN_READABLE
+ 2 * ENABLE_SELINUX
+ 2 * ENABLE_FEATURE_AUTOWIDTH,
+ OPT_F = (1 << OPTBIT_F) * ENABLE_FEATURE_LS_FILETYPES,
OPT_color = 1 << OPTBIT_color,
};
@@ -1066,8 +1068,10 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
dn = NULL;
nfiles = 0;
do {
- /* NB: follow links on command line unless -l or -s */
- cur = my_stat(*argv, *argv, !(all_fmt & (STYLE_LONG|LIST_BLOCKS)));
+ /* NB: follow links on command line unless -l, -s or -F */
+ cur = my_stat(*argv, *argv,
+ !((all_fmt & (STYLE_LONG|LIST_BLOCKS)) || (option_mask32 & OPT_F))
+ );
argv++;
if (!cur)
continue;