From 5f97f1a29a9265f82315131d2e8a5b4d7674848c Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 3 Apr 2014 09:21:04 +0200 Subject: [PATCH] ls(1): Restore the traditional behavior of -f implying -a. OpenBSD's commit msg: ------ restore the traditional behavior of -f implying -a; apparently Keith Bostic forgot to restore it when the -f flag was put back on 2nd of September 1989, after being removed on 16th of August as a consequence of issues getting it working over NFS, so deviation from traditional UNIX behavior in all BSDs looks like an historical accident; as a side effect, this change accommodates behavior of this option to IEEE Std 1003.1-2008 (``POSIX.1''). joint work with jmc@ (who found the inaccuracy in our implementation), schwarze@ (who provided a detailed tracking of historical facts) and millert@ ok millert@, schwarze@ ------ The same patch has been pushed to NetBSD and FreeBSD too. Submitted-by: Igor Sobrado Taken-from: OpenBSD --- bin/ls/ls.1 | 4 +++- bin/ls/ls.c | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/ls/ls.1 b/bin/ls/ls.1 index 6419620898..f2c24835d3 100644 --- a/bin/ls/ls.1 +++ b/bin/ls/ls.1 @@ -31,7 +31,7 @@ .\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" $FreeBSD: src/bin/ls/ls.1,v 1.86 2005/02/13 22:25:09 ru Exp $ .\" -.Dd September 25, 2008 +.Dd March 4, 2014 .Dt LS 1 .Os .Sh NAME @@ -169,6 +169,8 @@ Use time when file status was last changed for sorting or printing. Directories are listed as plain files (not searched recursively). .It Fl f Output is not sorted. +This option implies +.Fl a . .It Fl g This option is deprecated and is only available for compatibility with diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 3800d16499..604d4ad38d 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -32,7 +32,6 @@ * @(#) Copyright (c) 1989, 1993, 1994 The Regents of the University of California. All rights reserved. * @(#)ls.c 8.5 (Berkeley) 4/2/94 * $FreeBSD: src/bin/ls/ls.c,v 1.78 2004/06/08 09:30:10 das Exp $ - * $DragonFly: src/bin/ls/ls.c,v 1.17 2008/01/19 15:33:42 matthias Exp $ */ #include @@ -245,6 +244,9 @@ main(int argc, char *argv[]) case 'S': f_sortsize = 1; break; + case 'f': + f_nosort = 1; + /* FALLTHROUGH */ case 'a': fts_options |= FTS_SEEDOT; /* FALLTHROUGH */ @@ -256,9 +258,6 @@ main(int argc, char *argv[]) f_listdir = 1; f_recursive = 0; break; - case 'f': - f_nosort = 1; - break; case 'g': /* Compatibility with 4.3BSD. */ break; case 'h': -- 2.41.0