summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko2017-01-25 04:52:45 +0100
committerDenys Vlasenko2017-01-25 04:52:45 +0100
commitb13b6183354e6c9d031951fa4f11bcb9b38ae251 (patch)
tree382cb2426c2ee38e41ec350ed62a0e1b842e0fcd /coreutils
parent8a2657cbf5fe005914cf58836d2599e65e6c3e34 (diff)
downloadbusybox-b13b6183354e6c9d031951fa4f11bcb9b38ae251.zip
busybox-b13b6183354e6c9d031951fa4f11bcb9b38ae251.tar.gz
ftpd/ls: show directories first
Old TODO finally done function old new delta ls_main 548 568 +20 packed_usage 31116 31097 -19 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index a858a32..6e0a52d 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -1045,7 +1045,7 @@ static void scan_and_display_dirs_recur(struct dnode **dn, int first)
int ls_main(int argc UNUSED_PARAM, char **argv)
-{
+{ /* ^^^^^^^^^^^^^^^^^ note: if FTPD, argc can be wrong, see ftpd.c */
struct dnode **dnd;
struct dnode **dnf;
struct dnode **dnp;
@@ -1175,6 +1175,11 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
if (!(option_mask32 & (OPT_l|OPT_1|OPT_x|OPT_C)))
option_mask32 |= (isatty(STDOUT_FILENO) ? OPT_C : OPT_1);
+ if (ENABLE_FTPD && applet_name[0] == 'f') {
+ /* ftpd secret backdoor. dirs first are much nicer */
+ option_mask32 |= OPT_dirs_first;
+ }
+
argv += optind;
if (!argv[0])
*--argv = (char*)".";