Apply diff from Igor Sobrado <isd@orion.ciencias.uniovi.es>:

We have written a diff to our ls(1) to recover the traditional behaviour
of -f implying -a.  This change does not only accommodates POSIX.1
but also matches traditional UNIX.

OpenBSD commit message:

CVSROOT:        /cvs
Module name:    src
Changes by:     sobrado@cvs.openbsd.org 2014/03/31 14:54:37

Modified files:
        bin/ls         : ls.1 ls.c

Log message:
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@
This commit is contained in:
wiz 2014-04-02 10:55:47 +00:00
parent a3979e7b1b
commit ac632886e5
2 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ls.1,v 1.75 2014/02/21 02:42:41 christos Exp $ .\" $NetBSD: ls.1,v 1.76 2014/04/02 10:55:47 wiz Exp $
.\" .\"
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994 .\" Copyright (c) 1980, 1990, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -32,7 +32,7 @@
.\" .\"
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" @(#)ls.1 8.7 (Berkeley) 7/29/94
.\" .\"
.Dd February 20, 2014 .Dd April 2, 2014
.Dt LS 1 .Dt LS 1
.Os .Os
.Sh NAME .Sh NAME
@ -127,6 +127,8 @@ after each that is a
.Tn FIFO . .Tn FIFO .
.It Fl f .It Fl f
Output is not sorted. Output is not sorted.
This option turns on
.Fl a .
.It Fl g .It Fl g
The same as The same as
.Fl l , .Fl l ,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ls.c,v 1.73 2014/02/22 13:08:13 mlelstv Exp $ */ /* $NetBSD: ls.c,v 1.74 2014/04/02 10:55:47 wiz Exp $ */
/* /*
* Copyright (c) 1989, 1993, 1994 * Copyright (c) 1989, 1993, 1994
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\
#if 0 #if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94"; static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else #else
__RCSID("$NetBSD: ls.c,v 1.73 2014/02/22 13:08:13 mlelstv Exp $"); __RCSID("$NetBSD: ls.c,v 1.74 2014/04/02 10:55:47 wiz Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -207,6 +207,9 @@ ls_main(int argc, char *argv[])
case 'R': case 'R':
f_recursive = 1; f_recursive = 1;
break; break;
case 'f':
f_nosort = 1;
/* FALLTHROUGH */
case 'a': case 'a':
fts_options |= FTS_SEEDOT; fts_options |= FTS_SEEDOT;
/* FALLTHROUGH */ /* FALLTHROUGH */
@ -230,9 +233,6 @@ ls_main(int argc, char *argv[])
f_listdir = 1; f_listdir = 1;
f_recursive = 0; f_recursive = 0;
break; break;
case 'f':
f_nosort = 1;
break;
case 'i': case 'i':
f_inode = 1; f_inode = 1;
break; break;