From b13b6183354e6c9d031951fa4f11bcb9b38ae251 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 25 Jan 2017 04:52:45 +0100 Subject: 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 --- coreutils/ls.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'coreutils') diff --git a/coreutils/ls.c b/coreutils/ls.c index a858a3217..6e0a52d75 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*)"."; -- cgit v1.2.3