History log of /freebsd-10-stable/bin/ls/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
313488 09-Feb-2017 ngie

MFC r289172,r290254:

r289172:

Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

r290254:

Remove unused variable (SRCDIR)


/freebsd-10-stable/bin/cat/tests/Makefile
/freebsd-10-stable/bin/date/tests/Makefile
/freebsd-10-stable/bin/expr/tests/Makefile
tests/Makefile
/freebsd-10-stable/bin/mv/tests/Makefile
/freebsd-10-stable/bin/pax/tests/Makefile
/freebsd-10-stable/bin/pkill/tests/Makefile
/freebsd-10-stable/bin/sh/tests/Makefile
/freebsd-10-stable/bin/sleep/tests/Makefile
/freebsd-10-stable/bin/test/tests/Makefile
/freebsd-10-stable/bin/tests/Makefile
/freebsd-10-stable/cddl/lib/tests/Makefile
/freebsd-10-stable/cddl/sbin/tests/Makefile
/freebsd-10-stable/cddl/tests/Makefile
/freebsd-10-stable/cddl/usr.bin/tests/Makefile
/freebsd-10-stable/cddl/usr.sbin/dtrace/tests/Makefile
/freebsd-10-stable/cddl/usr.sbin/tests/Makefile
/freebsd-10-stable/gnu/lib/tests/Makefile
/freebsd-10-stable/gnu/tests/Makefile
/freebsd-10-stable/gnu/usr.bin/diff/tests/Makefile
/freebsd-10-stable/gnu/usr.bin/tests/Makefile
/freebsd-10-stable/lib/atf/libatf-c++/tests/Makefile
/freebsd-10-stable/lib/atf/libatf-c++/tests/detail/Makefile
/freebsd-10-stable/lib/atf/libatf-c/tests/Makefile
/freebsd-10-stable/lib/atf/libatf-c/tests/detail/Makefile
/freebsd-10-stable/lib/atf/tests/Makefile
/freebsd-10-stable/lib/atf/tests/test-programs/Makefile
/freebsd-10-stable/lib/libc/tests/Makefile
/freebsd-10-stable/lib/libc/tests/Makefile.netbsd-tests
/freebsd-10-stable/lib/libc/tests/c063/Makefile
/freebsd-10-stable/lib/libc/tests/db/Makefile
/freebsd-10-stable/lib/libc/tests/gen/Makefile
/freebsd-10-stable/lib/libc/tests/gen/execve/Makefile
/freebsd-10-stable/lib/libc/tests/gen/posix_spawn/Makefile
/freebsd-10-stable/lib/libc/tests/hash/Makefile
/freebsd-10-stable/lib/libc/tests/inet/Makefile
/freebsd-10-stable/lib/libc/tests/locale/Makefile
/freebsd-10-stable/lib/libc/tests/net/Makefile
/freebsd-10-stable/lib/libc/tests/net/getaddrinfo/Makefile
/freebsd-10-stable/lib/libc/tests/regex/Makefile
/freebsd-10-stable/lib/libc/tests/rpc/Makefile
/freebsd-10-stable/lib/libc/tests/setjmp/Makefile
/freebsd-10-stable/lib/libc/tests/ssp/Makefile
/freebsd-10-stable/lib/libc/tests/stdio/Makefile
/freebsd-10-stable/lib/libc/tests/stdlib/Makefile
/freebsd-10-stable/lib/libc/tests/string/Makefile
/freebsd-10-stable/lib/libc/tests/sys/Makefile
/freebsd-10-stable/lib/libc/tests/termios/Makefile
/freebsd-10-stable/lib/libc/tests/time/Makefile
/freebsd-10-stable/lib/libc/tests/tls/Makefile
/freebsd-10-stable/lib/libc/tests/tls/dso/Makefile
/freebsd-10-stable/lib/libc/tests/ttyio/Makefile
/freebsd-10-stable/lib/libcrypt/tests/Makefile
/freebsd-10-stable/lib/libmp/tests/Makefile
/freebsd-10-stable/lib/libnv/tests/Makefile
/freebsd-10-stable/lib/libpam/libpam/tests/Makefile
/freebsd-10-stable/lib/librt/tests/Makefile
/freebsd-10-stable/lib/libthr/tests/Makefile
/freebsd-10-stable/lib/libthr/tests/dlopen/Makefile
/freebsd-10-stable/lib/libthr/tests/dlopen/dso/Makefile
/freebsd-10-stable/lib/libutil/tests/Makefile
/freebsd-10-stable/lib/msun/tests/Makefile
/freebsd-10-stable/lib/tests/Makefile
/freebsd-10-stable/libexec/atf/atf-check/tests/Makefile
/freebsd-10-stable/libexec/atf/atf-sh/tests/Makefile
/freebsd-10-stable/libexec/atf/tests/Makefile
/freebsd-10-stable/libexec/tests/Makefile
/freebsd-10-stable/sbin/devd/tests/Makefile
/freebsd-10-stable/sbin/dhclient/tests/Makefile
/freebsd-10-stable/sbin/growfs/tests/Makefile
/freebsd-10-stable/sbin/mdconfig/tests/Makefile
/freebsd-10-stable/sbin/tests/Makefile
/freebsd-10-stable/secure/lib/tests/Makefile
/freebsd-10-stable/secure/libexec/tests/Makefile
/freebsd-10-stable/secure/tests/Makefile
/freebsd-10-stable/secure/usr.bin/tests/Makefile
/freebsd-10-stable/secure/usr.sbin/tests/Makefile
/freebsd-10-stable/share/examples/tests/Makefile
/freebsd-10-stable/share/tests/Makefile
/freebsd-10-stable/tests/etc/Makefile
/freebsd-10-stable/tests/sys/mqueue/Makefile
/freebsd-10-stable/tests/sys/pjdfstest/tests/Makefile
/freebsd-10-stable/usr.bin/apply/tests/Makefile
/freebsd-10-stable/usr.bin/basename/tests/Makefile
/freebsd-10-stable/usr.bin/calendar/tests/Makefile
/freebsd-10-stable/usr.bin/cmp/tests/Makefile
/freebsd-10-stable/usr.bin/col/tests/Makefile
/freebsd-10-stable/usr.bin/comm/tests/Makefile
/freebsd-10-stable/usr.bin/cut/tests/Makefile
/freebsd-10-stable/usr.bin/dirname/tests/Makefile
/freebsd-10-stable/usr.bin/file2c/tests/Makefile
/freebsd-10-stable/usr.bin/grep/tests/Makefile
/freebsd-10-stable/usr.bin/gzip/tests/Makefile
/freebsd-10-stable/usr.bin/join/tests/Makefile
/freebsd-10-stable/usr.bin/jot/tests/Makefile
/freebsd-10-stable/usr.bin/lastcomm/tests/Makefile
/freebsd-10-stable/usr.bin/m4/tests/Makefile
/freebsd-10-stable/usr.bin/ncal/tests/Makefile
/freebsd-10-stable/usr.bin/printf/tests/Makefile
/freebsd-10-stable/usr.bin/sed/tests/Makefile
/freebsd-10-stable/usr.bin/tests/Makefile
/freebsd-10-stable/usr.bin/truncate/tests/Makefile
/freebsd-10-stable/usr.bin/uudecode/tests/Makefile
/freebsd-10-stable/usr.bin/uuencode/tests/Makefile
/freebsd-10-stable/usr.bin/xargs/tests/Makefile
/freebsd-10-stable/usr.bin/yacc/tests/Makefile
/freebsd-10-stable/usr.sbin/etcupdate/tests/Makefile
/freebsd-10-stable/usr.sbin/fstyp/tests/Makefile
/freebsd-10-stable/usr.sbin/newsyslog/tests/Makefile
/freebsd-10-stable/usr.sbin/nmtree/tests/Makefile
/freebsd-10-stable/usr.sbin/pw/tests/Makefile
/freebsd-10-stable/usr.sbin/sa/tests/Makefile
/freebsd-10-stable/usr.sbin/tests/Makefile
311998 12-Jan-2017 asomers

MFC r310118

Fix ls_tests:o_flag with ZFS TMPDIR

Unlike UFS or TMPFS, ZFS sets uarch automatically whenever a file is
updated. The test must explicitly clear uarch to be portable across
filesystems. Also, it doesn't need to run as root.

301627 08-Jun-2016 ngie

MFC r300939:

Use require.progs with bc instead of require.files with /usr/bin/bc

This will make things more flexible if the program path changes in the future,
and the test in and of itself doesn't call /usr/bin/bc -- it just calls bc

292049 10-Dec-2015 ngie

MFC r291919:

Enable bin/ls testcases disabled previously because of issues with how
kyua 0.11's version of report-junit was rendering non-printable characters

Upgrade to kyua 0.12 to obtain a fixed version of the command

Output verified with python 2.7.10's xml.dom.minidom module

Sponsored by: EMC / Isilon Storage Division

289965 25-Oct-2015 ngie

MFC r288330,r288423,r288678,r288905,r288906,r288907,r289102:

r288330:

Add initial testcases for bin/ls

Sponsored by: EMC / Isilon Storage Division

r288423:

Skip the B_flag testcase to stop blowing up freebsd-current@ with
"test failure emails" because kyua report-jenkins doesn't properly
escape non-printable chars

r288678:

Merge additional testcases and improvements to bin/ls/ls_tests from
^/user/ngie/more-tests.

- Additional testcases added:
-- ls -D
-- ls -F
-- ls -H
-- ls -L
-- ls -R
-- ls -S
-- ls -T
-- ls -b
-- ls -d
-- ls -f
-- ls -g
-- ls -h
-- ls -i
-- ls -k
-- ls -l
-- ls -m
-- ls -n
-- ls -o
-- ls -p
-- ls -q/ls -w
-- ls -r
-- ls -s
-- ls -t
-- ls -u
-- ls -y
- Socket file creation is limited to the ls -F testcase, greatly speeding up
the test process
- The ls -C testcase was made more robust by limiting the number of columns
via COLUMNS and by dynamically formulating the columns/lines.
- Add `atf_test_case` before all testcase `head` functions.

Sponsored by: EMC / Isilon Storage Division

r288905:

Add some more syncs to quiesce the filesystem after creating the
files to see if this fixes deterministic Jenkin failures

r288906:

Explicitly set BLOCKSIZE to 512 in the environment

r288907:

Call sync consistently using atf_check

Remove superfluous sync's

r289102:

Remove all of the syncs

They're unnecessary as shown by further testing on my VM

Requested by: jhb

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


254627 21-Aug-2013 ken

Expand the use of stat(2) flags to allow storing some Windows/DOS
and CIFS file attributes as BSD stat(2) flags.

This work is intended to be compatible with ZFS, the Solaris CIFS
server's interaction with ZFS, somewhat compatible with MacOS X,
and of course compatible with Windows.

The Windows attributes that are implemented were chosen based on
the attributes that ZFS already supports.

The summary of the flags is as follows:

UF_SYSTEM: Command line name: "system" or "usystem"
ZFS name: XAT_SYSTEM, ZFS_SYSTEM
Windows: FILE_ATTRIBUTE_SYSTEM

This flag means that the file is used by the
operating system. FreeBSD does not enforce any
special handling when this flag is set.

UF_SPARSE: Command line name: "sparse" or "usparse"
ZFS name: XAT_SPARSE, ZFS_SPARSE
Windows: FILE_ATTRIBUTE_SPARSE_FILE

This flag means that the file is sparse. Although
ZFS may modify this in some situations, there is
not generally any special handling for this flag.

UF_OFFLINE: Command line name: "offline" or "uoffline"
ZFS name: XAT_OFFLINE, ZFS_OFFLINE
Windows: FILE_ATTRIBUTE_OFFLINE

This flag means that the file has been moved to
offline storage. FreeBSD does not have any special
handling for this flag.

UF_REPARSE: Command line name: "reparse" or "ureparse"
ZFS name: XAT_REPARSE, ZFS_REPARSE
Windows: FILE_ATTRIBUTE_REPARSE_POINT

This flag means that the file is a Windows reparse
point. ZFS has special handling code for reparse
points, but we don't currently have the other
supporting infrastructure for them.

UF_HIDDEN: Command line name: "hidden" or "uhidden"
ZFS name: XAT_HIDDEN, ZFS_HIDDEN
Windows: FILE_ATTRIBUTE_HIDDEN

This flag means that the file may be excluded from
a directory listing if the application honors it.
FreeBSD has no special handling for this flag.

The name and bit definition for UF_HIDDEN are
identical to the definition in MacOS X.

UF_READONLY: Command line name: "urdonly", "rdonly", "readonly"
ZFS name: XAT_READONLY, ZFS_READONLY
Windows: FILE_ATTRIBUTE_READONLY

This flag means that the file may not written or
appended, but its attributes may be changed.

ZFS currently enforces this flag, but Illumos
developers have discussed disabling enforcement.

The behavior of this flag is different than MacOS X.
MacOS X uses UF_IMMUTABLE to represent the DOS
readonly permission, but that flag has a stronger
meaning than the semantics of DOS readonly permissions.

UF_ARCHIVE: Command line name: "uarch", "uarchive"
ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE
Windows name: FILE_ATTRIBUTE_ARCHIVE

The UF_ARCHIVED flag means that the file has changed and
needs to be archived. The meaning is same as
the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and
the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute.

msdosfs and ZFS have special handling for this flag.
i.e. they will set it when the file changes.

sys/param.h: Bump __FreeBSD_version to 1000047 for the
addition of new stat(2) flags.

chflags.1: Document the new command line flag names
(e.g. "system", "hidden") available to the
user.

ls.1: Reference chflags(1) for a list of file flags
and their meanings.

strtofflags.c: Implement the mapping between the new
command line flag names and new stat(2)
flags.

chflags.2: Document all of the new stat(2) flags, and
explain the intended behavior in a little
more detail. Explain how they map to
Windows file attributes.

Different filesystems behave differently
with respect to flags, so warn the
application developer to take care when
using them.

zfs_vnops.c: Add support for getting and setting the
UF_ARCHIVE, UF_READONLY, UF_SYSTEM, UF_HIDDEN,
UF_REPARSE, UF_OFFLINE, and UF_SPARSE flags.

All of these flags are implemented using
attributes that ZFS already supports, so
the on-disk format has not changed.

ZFS currently doesn't allow setting the
UF_REPARSE flag, and we don't really have
the other infrastructure to support reparse
points.

msdosfs_denode.c,
msdosfs_vnops.c: Add support for getting and setting
UF_HIDDEN, UF_SYSTEM and UF_READONLY
in MSDOSFS.

It supported SF_ARCHIVED, but this has been
changed to be UF_ARCHIVE, which has the same
semantics as the DOS archive attribute instead
of inverse semantics like SF_ARCHIVED.

After discussion with Bruce Evans, change
several things in the msdosfs behavior:

Use UF_READONLY to indicate whether a file
is writeable instead of file permissions, but
don't actually enforce it.

Refuse to change attributes on the root
directory, because it is special in FAT
filesystems, but allow most other attribute
changes on directories.

Don't set the archive attribute on a directory
when its modification time is updated.
Windows and DOS don't set the archive attribute
in that scenario, so we are now bug-for-bug
compatible.

smbfs_node.c,
smbfs_vnops.c: Add support for UF_HIDDEN, UF_SYSTEM,
UF_READONLY and UF_ARCHIVE in SMBFS.

This is similar to changes that Apple has
made in their version of SMBFS (as of
smb-583.8, posted on opensource.apple.com),
but not quite the same.

We map SMB_FA_READONLY to UF_READONLY,
because UF_READONLY is intended to match
the semantics of the DOS readonly flag.
The MacOS X code maps both UF_IMMUTABLE
and SF_IMMUTABLE to SMB_FA_READONLY, but
the immutable flags have stronger meaning
than the DOS readonly bit.

stat.h: Add definitions for UF_SYSTEM, UF_SPARSE,
UF_OFFLINE, UF_REPARSE, UF_ARCHIVE, UF_READONLY
and UF_HIDDEN.

The definition of UF_HIDDEN is the same as
the MacOS X definition.

Add commented-out definitions of
UF_COMPRESSED and UF_TRACKED. They are
defined in MacOS X (as of 10.8.2), but we
do not implement them (yet).

ufs_vnops.c: Add support for getting and setting
UF_ARCHIVE, UF_HIDDEN, UF_OFFLINE, UF_READONLY,
UF_REPARSE, UF_SPARSE, and UF_SYSTEM in UFS.
Alphabetize the flags that are supported.

These new flags are only stored, UFS does
not take any action if the flag is set.

Sponsored by: Spectra Logic
Reviewed by: bde (earlier version)


248342 15-Mar-2013 joel

Add a few examples.

Obtained from: OpenBSD


245091 06-Jan-2013 andrew

When WCHAR_MIN == 0 the check if a wchar_t value will always be true. In
this case skip the test as gcc complains it is always true.


242840 09-Nov-2012 peter

Undo over-aggressive conversion of spaces to tabs. ie: those within
format strings, "period, space, space" in comment text, etc.


242807 08-Nov-2012 grog

Replace spaces with tabs where appropriate.

Reminded by: jh@


242725 08-Nov-2012 grog

Add y flag and environment variable LS_SAMESORT to specify the same
sorting order for time and name with the -t option. IEEE Std 1003.2
(POSIX.2) mandates that the -t option sort in descending order, and
that if two files have the same timestamp, they should be sorted in
ascending order of their names. The -r flag reverses both of these
sort orders, so they're never the same. This creates significant
problems for sequentially named files stored on FAT file systems,
where it can be impossible to list them in the order in which they
were created.

Add , (comma) option to print file sizes grouped and separated by
thousands using the non-monetary separator returned by localeconv(3),
typically a comma or period.

MFC after: 14 days


242722 07-Nov-2012 grog

Sort option parsing as far as practical.


241014 27-Sep-2012 mdf

Fix bin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou


235655 19-May-2012 marcel

Add build opton MK_LS_COLORS to control whether ls(1) supports colors
(and thus needs to depend on libtermcap). Embedded systems may not
want or need colors.

Obtained from: Juniper Networks, Inc.


226546 19-Oct-2011 des

If ls was invoked with -i but neither -l nor -s, blocksize was used in
display() to calculate column widths, but was not initialized in
main(). This resulted in a division by zero.

Noticed by: Michael Butler <imb@protected-networks.net>


226509 18-Oct-2011 des

When calculating the width of the blocksize column, ls(1) used 512-byte
units (as returned by stat(2)) instead of BLOCKSIZE units.

Submitted by: Paul Schenkeveld
MFC after: 3 weeks


225847 28-Sep-2011 ed

Get rid of major/minor number distinction.

As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.

Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):

"If the file is a character special or block special file, the
size of the file may be replaced with implementation-defined
information associated with the device in question."

This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.

Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).


221845 13-May-2011 pluknet

Update sticky(7) cross references.

PR: docs/124468
X-MFC with: r218998


205793 28-Mar-2010 ed

Change all our own code to use st_*tim instead of st_*timespec.

Also remove some local patches to diff(1) which are now unneeded.


203665 08-Feb-2010 jh

Make sure that FTS_COMFOLLOW is not set when the -P option is in effect.
Otherwise the -i option will show the inode number of the referenced file
for symbolic links given on the command line. Similarly, the file color
was printed according to the link target in colorized output.

PR: bin/102394
Reviewed by: jilles
MFC after: 2 weeks


202945 24-Jan-2010 jh

Fixes for ls(1) long format (-l) output:

- Allow -h option to work if the listing contains at least one device
file.
- Align major and minor device numbers correctly to the size field.

PR: bin/125678
Approved by: trasz (mentor)
MFC after: 1 month


202944 24-Jan-2010 jh

Print full path in the error message. It's possible that fts(3)
provides an empty fts_name and reporting the full path is more
appropriate especially with the -R option.

PR: bin/107515
Submitted by: bde
Approved by: trasz (mentor)
MFC after: 1 week


198056 13-Oct-2009 jilles

ls: Make -p not inhibit following symlinks.

According to the man page, when neither -H/-L nor -F/-d/-l are given, -H is
implied. This agrees with POSIX, GNU ls and Solaris ls. This means that -p,
although it is very similar to -F, does not prevent the implicit following
of symlinks.

PR: standards/128546


196773 02-Sep-2009 trasz

Fix regression introduced in r196712 - the 'name' string needs
to be rewritten for each file we want to check ACL on. Without
this change, ls(1) would check only the ACL on the first file
to list.


196712 31-Aug-2009 trasz

Add NFSv4 ACL support to ls(1).


191003 13-Apr-2009 trasz

Add reference to strmode(3).


177942 05-Apr-2008 imp

Turn a tab into a space. This fixes a misalignment for ls -l.

Tabs Noticed by: Antoine Brodin


177908 04-Apr-2008 ru

- Add -D to usage().
- Bump document date for the addition of the -D option.
- Reformat a sentence to look like a real sentence.


177907 04-Apr-2008 grog

Add -D option to specify exact format of date and time output with ls -l.


163480 18-Oct-2006 ru

Avoid a spurious warning for each whiteout found during "ls -lW".

# ls -lW
total 2
-rw-r--r-- 1 root wheel 6 Oct 18 14:46 file1
ls: ./file2: No such file or directory
w--------- 0 root wheel 0 Jan 1 1970 file2


163263 12-Oct-2006 ru

- Improve description of the -A option.
- Document how whiteouts look in the long output. [1]
- Sort entry types.
- Fix description of the socket type.

PR: docs/51921 [1]


162379 17-Sep-2006 ru

Markup fixes.


157101 24-Mar-2006 jhb

Change the -S and -t options to override each other so that the last one
specified wins to make their interaction less confusing.


157100 24-Mar-2006 jhb

Fix a bug such that if you enabled sorting by size (-S) and enabled a
flag to use a time other than modtime (-c, -u, or -U), the output would
actually be sorted by the specified time rather than size. This does
alter the behavior in the case where both -S and -t are specified. Now,
-S is always preferred. Previously, -t was preferred if one of -c, -u, or
-U was specified, and -S was preferred otherwise. Perhaps -S and -t should
override each other (last one specified wins).


157099 24-Mar-2006 jhb

Add a few more references to -U.


157098 24-Mar-2006 jhb

Add a new -U flag to instruct ls to use the birthtime for printing or
sorting.

Submitted by: Andrzej Tobola ato at iem dot pw dot edu dot pl
MFC after: 1 week


152547 17-Nov-2005 ru

-mdoc sweep.


152469 16-Nov-2005 ru

Having three options (-a, -A, -I) controlling the output of dotted
files is too much and hard to follow. Instead, make the -I option
just mean "do not automatically set -A for root". That is, if -A
is explicitly set, -I is ignored. Also, document -I in usage().
(The ls.c diff is better viewed relative to rev. 1.80.)

No objection: mux
Silence from: mnag
MFC after: 3 days


152281 10-Nov-2005 mux

Mention the non-standardness of the -I option in ls(1).

Spotted by: ru
MFC after: 3 days


152256 10-Nov-2005 mux

Add a -I option to disable the automatic -A flag for the super-user.

PR: bin/86710
Submitted by: Marcus Alves Grando
MFC after: 3 days


149826 06-Sep-2005 rse

fix typos: decribed -> described, preceeded -> preceded


149676 31-Aug-2005 garys

Improved descriptions of block size handling.

PR: docs/84765
Submitted by: garys
Approved by: keramida
MFC after: 3 days


146926 03-Jun-2005 dd

Remove the EXAMPLES section that describes how to sort by size using
sort(1). This functionality is provided by the -S option now, and it
is useful even though a similar effect is achievable with sort(1),
since the latter doesn't work in combination with -h. This option is
also present in NetBSD, OpenBSD, and GNU fileutils, so there's clearly
a demand for it.

Noticed by: asmodai


146925 03-Jun-2005 dd

Improve wording: A sort is "in" a particular order, not "by" a
particular order.


146924 03-Jun-2005 dd

Add the -S option to sort files by size. NetBSD and OpenBSD already
have this option with identical semantics (sorting large files first).
-r can be used to reverse the sort if that is desired.

PR: 81625
Submitted by: Kostas Blekos <mplekos@physics.upatras.gr>, keramida


141846 13-Feb-2005 ru

Expand *n't contractions.


141578 09-Feb-2005 ru

Sync program's usage() with manpage's SYNOPSIS.


140353 16-Jan-2005 ru

Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.


140050 11-Jan-2005 joerg

The total sum of blocks for the -l and -s option is printed always,
regardless whether the output is to a terminal or not. As this is
consistent with the SUSPv2 specification (even though we do not
otherwise fully implement SUSPv2's ls(1) options), document this as it
is now, rather than trying to change the behaviour itself.

PR: docs/76072
Submitted by: Sebastian Rey <Sebastian.rey@gmx.net>
MFC after: 1 week


139969 10-Jan-2005 imp

/*- or .\"- or #- to begin license clauses.


131484 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


130967 23-Jun-2004 dwmalone

Fix some style bugs I introduced pointed out by bde. Also add a blank
line after the empty variable declarations.

Reviewed by: md5


130926 22-Jun-2004 dwmalone

Use nanoseconds and then lexicographic ordering when the seconds of
the [acm]time are the same. I was going to use Scott's patch, but I
couldn't get the style quite right, so I used a patch of my own.

Submitted by: Scott Mitchell <scott+freebsd at fishballoon.org>
MFC after: 3 weeks


130237 08-Jun-2004 das

If we are asked to print the total number of blocks, do so even if we
have no entries to print (either due to an empty directory or an
error). This makes the -l and -s options more consistent, like
Solaris and (Debian) Linux. To make this happen, tweak two
optimizations on the second call to display():

- Don't skip display() altogether, even if list == NULL.
- Don't skip the call to the printfn in display() if we
need to print the total.

PR: 45723


130236 08-Jun-2004 das

Remove from the printfns the assumption that dp->list != NULL. Even
if there are no entries, these functions may be called to print the
total number of blocks (0) for consistency's sake.


130029 03-Jun-2004 le

Plug small memory leak.

PR: bin/67392
Submitted by: Matthew Emmerton <matt@gsicomp.on.ca>
MFC in: 1 week


129719 25-May-2004 pjd

Use humanize_number(3).

Reminded by: jhb


129297 16-May-2004 ru

Punctuation.


128868 03-May-2004 tjr

Only add the widths together for printable characters in prn_normal();
unprintable characters have a "width" of -1.


128823 02-May-2004 tjr

Treat filenames as multibyte character strings (according to the current
LC_CTYPE setting) when determining which characters are printable.
This is an often-requested feature.

Use wcwidth() to determine the number of column positions a character
takes up, although there are still a few places left where we assume
1 byte = 1 column position, e.g. line-wrapping when handling the -m option.

The error handling here is somewhat more complicated than usual: we do
our best to show what we can of a filename in the presence of conversion
errors, instead of simply aborting.


127958 06-Apr-2004 markm

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


127795 03-Apr-2004 bmilekic

Stop iterating over ACLs if we've already determined we
will print them (i.e., number of successful calls to acl_get_entry()
exceeds 3). This makes O(1) what was O(num_TYPE_ACCESS_ACLs).

This is a slightly modified version of submitter's patch.

PR: bin/65042
Submitted by: Christian S.J. Peron <maneo@bsdpro.com>


127269 21-Mar-2004 tjr

Document incorrect handling of multibyte characters in filenames.


126458 01-Mar-2004 cperciva

Fixes to output of `ls -lh` for certain file sizes:
1. Sizes in the range 1000 -- 1023 units require four characters width
for the integer; increase the field width to accomodate this.
2. Sizes in the range 9.95 -- 10 units were being displayed as "10.0"
units; adjust the logic to fix this, and now that we've got an extra
character of field width, print fractional units if the size is less
than 99.95 units.
3. Don't display sub-byte precision.

This should mean that the following sizes are displayed:
0B .. 1023B
1.0U .. 9.9U
10.0U .. 99.9U
100U .. 1023U
for values of U in "KMGTPE".

PR: bin/63547
Pointy hat to: cperciva
Approved by: rwatson (mentor)


124825 22-Jan-2004 cperciva

Fix alignment of size field in `ls -lh` -- the width was being computed
from log[10](largest file size), but when outputting in human-friendly
format the width is always at most 4. (eg. "123K", " 12K", "1.2K".)

PR: bin/59320
Approved by: rwatson (mentor)


123089 01-Dec-2003 obrien

Do something sensible if both -h and -k are given.

Approved by: re(scottl)


121124 16-Oct-2003 tjr

Handle realloc() failure correctly.


119914 09-Sep-2003 tjr

Add the -m, -w and -x options to ls's usage message.

PR: 51493
Submitted by: Walter Belgers
MFC after: 1 month


118665 08-Aug-2003 schweikh

Note in STANDARDS that -gno are not (yet?) POSIX conformant.

Spotted by: harti
MFC after: 3 days


117389 10-Jul-2003 brueffer

-l prints all permissions, not just owner and group

PR: 54294
Submitted by: Per Hedeland <per@hedeland.org>
MFC after: 3 days


116282 13-Jun-2003 markm

Get this area compiling with the highest WARNS= that it works with.
Obsolete WFORMAT= junk also removed where possible.

OK'ed by: obrien
Tested on: sparc64, alpha, i386


114791 06-May-2003 trhodes

df(1) and ls(1) print units in 'four or fewer' not 'three or less'.

PR: 35523
Submitted by: Tomas Svensson <tsn@gbdev.net>


114583 03-May-2003 markm

Fix a bazillion warnings. This makes almost the whole of src/bin/*
WARNS=6, std=c99 clean.

Tested on: i386, alpha


114047 26-Apr-2003 rwatson

When mac_from_text() fails with -Z, print "-" rather than "" so that
scripts parsing ls(1) output can still count columns.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


109601 20-Jan-2003 chris

Reference maclabel(7).

Sponsored by: DARPA, Network Associates Laboratories


108066 19-Dec-2002 tjr

pathconf() and acl_get_file() follow links so they cannot be used to
determine whether a symlink has an ACL. Instead, assume that symbolic
links don't have ACLs and don't bother checking. Avoids spurious
ENOENT warnings when listing directories containing broken symlinks
on filesystems with ACLs enabled.

Pointed out by: rwatson, bde


108057 18-Dec-2002 rwatson

Improve handling of symlink targets when listing MAC labels: don't
do the wrong thing when the symlink doesn't have a target, by
considering !f_label in the construction of ch_options.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


107229 25-Nov-2002 ru

mdoc(7) police: markup fixes.

Approved by: re


106479 06-Nov-2002 tjr

Use warn() instead of perror() or fprintf() where appropriate.


106371 03-Nov-2002 tjr

Print a `+' character after the standard UNIX permission fields in long
listings if the file has an extended ACL (more than the required 3 entries).
This is what Solaris and IRIX do, and what the withdrawn POSIX.2c standard
required.

Reviewed by: rwatson (an earlier version of the patch)


106053 27-Oct-2002 wollman

Do not include <sys/syslimits.h> directly; it is not intended for general
consumption.


105836 24-Oct-2002 rwatson

Attempt improved use of fts results: use the correct path to the
object to retrieve label information on, rather than directly
consuming the fts-provided paths (none of which are quite right).
This is based on the similar readlink() code, and may contain
the same bugs.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


105832 24-Oct-2002 rwatson

Teach "ls -Z" to use the policy-agnostic MAC label interfaces rather
than the LOMAC-specific interfaces for listing MAC labels. This permits
ls to view MAC labels in a manner similar to getfmac, when ls is used
with the -l argument. Next generation LOMAC will use the MAC Framework
so should "just" work with this and other policies. Not the prettiest
code in the world, but then, neither is ls(1).

Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


105780 23-Oct-2002 markm

Constify, staticify, rationalise types and fix other related warnings.


105778 23-Oct-2002 markm

Constify to squash some warnings.


105390 18-Oct-2002 tjr

Print non-printing characters in directory names, as well as file names,
as `?' or `\ooo', depending on whether the -b or -B flags were used.

PR: 43995
MFC after: 1 month


105375 18-Oct-2002 dd

Output "human-readable" values with a non-0 precision where
appropriate. Before this, a 2.9 GB file was misleadingly reported as
"2G". This mostly brings unit_adjust() in line with what is in du(1).

Reviewed by: jmallett
Approved by: nik


103726 21-Sep-2002 wollman

Make the threatened fts(3) ABI fix. FTSENT now avoids the use of the struct
hack, thereby allowing future extensions to the structure (e.g., for extended
attributes) without rebreaking the ABI. FTSENT now contains a pointer to the
parent stream, which fts_compar() can then take advantage of, avoiding the
undefined behavior previously warned about. As a consequence of this change,
the prototype of the comparison function passed to fts_open() has changed
to reflect the required amount of constness for its use. All callers in the
tree are updated to use the correct prototype.

Comparison functions can now make use of the new parent pointer to access
the new stream-specific private data pointer, which is intended to assist
creation of reentrant library routines which use fts(3) internally.

Not objected to in spirit by: -arch


102577 29-Aug-2002 keramida

Fix a warning of "possibly used before initialisation".

Reviewed by: tjr


102410 25-Aug-2002 charnier

Replace various spellings with FALLTHROUGH which is lint()able


102230 21-Aug-2002 trhodes

s/filesystem/file system/ as discussed on -developers


102091 19-Aug-2002 ru

mdoc(7) police: fixed the document date.

Submitted by: iedowse


101677 11-Aug-2002 schweikh

Fix typos; each file has at least one s/seperat/separat/
(I skipped those in contrib/, gnu/ and crypto/)
While I was at it, fixed a lot more found by ispell that I
could identify with certainty to be errors. All of these
were in comments or text, not in actual code.

Suggested by: bde
MFC after: 3 days


99744 10-Jul-2002 dillon

err() is documented as allowing NULL for the format string but GCC isn't
happy about it any more so change the usage to make buildworld work again.


99109 30-Jun-2002 obrien

Consistently use __FBSDID


97803 04-Jun-2002 tjr

Ignore empty COLUMNS environment variable. COLUMNS should take precedence
over TTY width found via ioctl() (SUSv3)


97463 29-May-2002 ru

mdoc(7) police: markup nits.


96892 19-May-2002 tjr

Add missing options required by SUSv3:
-m List files across the page, separated by commas.
-p Print a slash after directory names
-x Same as -C but sort across the columns rather than down

Submitted by: Kyle Martin <mkm@ieee.org>


96702 16-May-2002 trhodes

Consistancy check s/file system/filesystem/

Reviewed by: brian


96681 15-May-2002 billf

restore missing default case removed in ls.c:r1.57

add break statements to default cases where missing.

Submitted by: bde


96649 15-May-2002 jmallett

Make 'user' and 'group' const as to not discard the qualifier from the
functions we use to assign them. Doesn't seem to be anything else that
relies on these being non-const.


96648 15-May-2002 jmallett

Remove an empty default case to make this syntactically correct. Not there
is as good as blaknk.


94868 16-Apr-2002 charnier

ls(1) is utility not function


94712 15-Apr-2002 jwd

Document option to option dependancy. Fix typo.

MFC after: 1 week


93229 26-Mar-2002 ru

Install sys/security/lomac/*.h to /usr/include/security/lomac/.

Install sys/<arch>/include/pc/*.h to /usr/include/machine/pc/.

PR: docs/29534

Install sys/netatm/*/*.h to /usr/include/netatm/*/.

Don't install compatibility symlinks for <machine/soundcard.h>
and <machine/joystick.h>. Three years is enough to be aware of
the change, and these weren't visible in the SHARED=symlinks
case.

Back out include/Makefile,v 1.160 that was a null change anyway
due to the bug in the path, and we now don't want to install
these headers because they would otherwise be invisible in the
SHARED=symlinks case.

Don't install IPFILTER headers. Userland utilities fetch them
directly, and they were not visible in the SHARED=symlinks case.

Resurrect SHARED=symlinks in Makefile.inc1.

PR: bin/28002

Prodded by: bde
MFC after: 2 weeks


92294 14-Mar-2002 rwatson

NAI DBA update.


91498 28-Feb-2002 ache

Add (unsigned char) cast lost in WARNS=4 fixes which break 8bit locales

PR: 35421


91212 25-Feb-2002 bde

#include <time.h> for the definition of time functions instead of
depending on namespace pollution 2 layers deep in <sys/stat.h>.

Removed unused includes.


90878 19-Feb-2002 imp

Fixed divots that I created when I moved prototypes of group_from_gid
and user_from_uid to grp.h and pwd.h. Update the man pages.

Submitted by: David Malone
Pointy hat to: imp


90167 04-Feb-2002 kris

Correct inadvertent style botches in previous commit.


90166 04-Feb-2002 kris

Lock down with WFORMAT=1 except those directories with unfixed warnings.
Tested on i386 and alpha.


90153 03-Feb-2002 markm

Use __FBSDID() and clean up the vendor tags.


90150 03-Feb-2002 markm

WARNS=4 fixes, plus a healthy dose of fixes inspired by lint.


90115 02-Feb-2002 imp

Fix unused variable.


90110 02-Feb-2002 imp

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.


89132 09-Jan-2002 ru

mdoc(7) police: tidy up.


88672 29-Dec-2001 bde

Fixed style bug (unsorting of SRCS) in rev.1.15.


88671 29-Dec-2001 bde

Fixed style bugs in revs. 1.6, 1.10 and 1.12.


88670 29-Dec-2001 bde

Fixed missing DPADD and disordered LDADD in rev.1.17

Fixed setting of WARNS in rev.1.16. Options should normally be set using
using "?=", not using "=", so that the setting is easy to override on the
command line, and setting WARNS to 0 should not be an exception.


88668 29-Dec-2001 joe

LSCOLOURS should be spelt LSCOLORS.

Submitted by: Jordan DeLong <fracture@allusion.net


88604 29-Dec-2001 ben

Remove part of a diff committed at the end of the file.


88603 29-Dec-2001 joe

Force raw printing of non-printable characters via the -w option.

PR: bin/28007


88602 29-Dec-2001 joe

Restore these files to shiny KNF.


88595 28-Dec-2001 joe

Convert some spaces into tabs that I missed first time around.


88594 28-Dec-2001 joe

Revert most of rev 1.42, to restore KNF style.

Requested by: bde


88591 28-Dec-2001 joe

Add a new flag, -h which when combined with the -l option causes
file sizes to be displayed with unit suffixes; Byte, Kilobyte,
Megabyte, Gigabyte, Terabyte and Petabyte in order to reduce the
number of digits to three or less.

Submitted by: nik


88588 28-Dec-2001 joe

Make it clearer what changed to a user using the old format of LSCOLORS.


88587 28-Dec-2001 joe

Mop up some warnings.


88586 28-Dec-2001 joe

Make the style more consistent throughout the file.


88584 28-Dec-2001 joe

Use the default colour instead if a bad colour specification is given.


88583 28-Dec-2001 joe

Revamp the colour support to allow for bold characters. Colours
are now defined using the characters a-h and A-H for the bold
variants. The old way using 0-7 for the colours still works, but
prints a message asking the user to switch.

PR: bin/27374


87432 06-Dec-2001 keramida

Make a bit more clear the types of characters that -B option will
print in octal.

Reviewed by: roam, silence on -doc


87353 04-Dec-2001 ru

mdoc(7) police: s/LKM/KLD/, sort xrefs.


87323 04-Dec-2001 obrien

Default to WARNS=2. Binary builds that cannot handle this must explicitly
set WARNS=0.

Reviewed by: mike


86922 26-Nov-2001 green

Add LOMAC options (the "Z" flag in both cases) to display extra information
in ls(1) and ps(1).

Sponsored by: DARPA, NAI Labs


81687 15-Aug-2001 ru

mdoc(7) police: utilize the new .Ex macro.


80187 23-Jul-2001 dd

Don't use the pronoun "you".

Reviewed by: sheldonh, mpp


80138 22-Jul-2001 dd

Don't put a shell prompt in the example since none of the other man
pages do it. Also, don't use brackets to indicate optional options in
the example; instead, add a paragraph below the example explaining it.


80074 21-Jul-2001 ben

Add missing closing parenthesis.


80072 21-Jul-2001 obrien

Show an example of how to sort a file listing by size. Hopefully this
will reduce the number of people calling for this functionality to be
added to ls(1).


79754 15-Jul-2001 dd

Remove whitespace at EOL.


75126 03-Apr-2001 ru

Drop support for -DRELEASE_BUILD_FIXIT and -DCRUNCHED_BINARY in
${CFLAGS}. The only supported method thus is -DRELEASE_CRUNCH.


74581 21-Mar-2001 ache

Silence minor cc warning


74566 21-Mar-2001 ache

Use nl_langinfo instead of %Ef


72432 13-Feb-2001 ru

mdoc(7) police: use the default ``file ...'' feature of the .Ar macro.


71895 01-Feb-2001 ru

mdoc(7) police: split punctuation characters + misc fixes.


70436 28-Dec-2000 hoek

grammar gnit: "relationships (plural) _are_ complex"


70056 15-Dec-2000 ru

Prepare for mdoc(7)NG.


68935 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


64604 13-Aug-2000 joe

Un-deprecate the -G flag at obrien's request. Colour sequences are still
dependent upon the output being directed to a terminal however.
(Use the CLICOLOR_FORCE variable to force output).


64570 12-Aug-2000 joe

Correct spelling: depricated -> deprecated.


64568 12-Aug-2000 joe

A change to the way that colours are switched on in ls. The -G
flag has been depricated, although it still works with a warning
message, and replaced with an environment variable CLICOLOR (command
line interface colour). This could be used by other tools that
want to be able to control colour output.

In addition if the environment variable CLICOLOR_FORCE is defined
colour sequences are output irrespective of whether the output is
directed to a terminal (as long as TERM references a colour capable
terminal of course ;)

PR: bin/20291 and bin/20483


64561 12-Aug-2000 joe

".It" -> ".It Ev" in a couple of places.


63748 22-Jul-2000 green

Add the missing flags to ls(1)'s usage: -Bb.


62779 07-Jul-2000 sheldonh

Explain the dependence of colour support on the capabilities of the
terminal emulator.

As pointed out by jhb, a more scalable solution would be preferable
when multiple applications in the base system begin linking against
libh.

Submitted by: Doug Barton <DougB@gorean.org>


62597 04-Jul-2000 assar

make sure we do not write out non-printable characters in file names
and symbolic links (by default)

PR: bin/19354
Reviewed by: silence on -current


61952 22-Jun-2000 sheldonh

Fix changes from 1.34 through 1.37:

Remove newly added hard sentence breaks.
Mark ANSI up as a type name (Tn).
Avoid parenthesized sentences and paragraphs.


61921 21-Jun-2000 joe

Order the ENVIRONMENT section alphabetically.


61920 21-Jun-2000 joe

I broke locale sensitive ordering of date and month in
the long -l output format with the last commit. Fix it
by replacing the "%b %e" strftime format with "%Ef".

Make a note in the manual page that the LANG environment
variable affects the running of ls.

Reviewed by: ache


61814 18-Jun-2000 joe

Don't assume that the output of strftime for "%c" ("national
representation of time and date") won't change in time. Instead
of hard coding the locations of the time elements and hoping that
they don't move use strftime to generate the desired formats in
the first place.

PR: bin/7826


61749 17-Jun-2000 joe

Switch over to using the new fflagstostr and strtofflags library calls.


61338 06-Jun-2000 ache

Fix one conditionalization in my prev. commit


61337 06-Jun-2000 ache

Greately simplify oxtabs fix by simple setting f_notabs for f_color


61336 06-Jun-2000 ache

Honor f_notabs flag even in COLORLS


61334 06-Jun-2000 ache

Back out spaces to TABs replace removing for COLORLS
Rewrite corresponding comment to say what happens in reality with oxtabs
and current terminal column.


61325 06-Jun-2000 ache

Don't replace TABs with spaces for COLORLS because "some terminals get confused"
as comment says. I know no terminal confused by this. If even such terminal
exists, it must be termcap flag for this, not hardcoded in ls.


61324 06-Jun-2000 ache

Add -G to usage: if COLORLS


61323 06-Jun-2000 ache

Staticize more functions


61322 06-Jun-2000 ache

Move colorquit() prototype to extern.h
Add "extern" to variables declarations in extern.h to not make them
commons into each compiled file.


61321 06-Jun-2000 ache

Make signal handler safe - don't use stdio (pointed by bde)
Staticize some color functions
Add yet one tolower() call which is forgotten after check
Don't check for OOPS - not really needed


61316 06-Jun-2000 ache

Reflect reality:
yellow -> brown
white -> light grey


61296 05-Jun-2000 ache

Get rid of curses completely - use tgoto instead of tparm


61295 05-Jun-2000 cracauer

Do SIGINT cleanup for SIGQUIT as well.


61294 05-Jun-2000 ache

Kill yourself in ^C handler, not exit(1) to allow script to sense signal


61292 05-Jun-2000 ache

Cosmetique of prev. optimization - don't use global variable


61291 05-Jun-2000 ache

Don't use curses includes, include termcap.h instead
Don't use curses functions, use tputs instead
Add ^C reaction - reset colors
Optimization - don't turn off colors after EACH file printed.
Fix wrong ctype macro arg type in LSCOLORS parsing


61289 05-Jun-2000 ache

Don't use curses includes, include termcap.h instead
Add ^C reaction set


61288 05-Jun-2000 ache

Don't use ncurses, use termcap
Add DPADD


61271 05-Jun-2000 joe

Don't look up the ANSI sequences each time a colour is changed,
this is extremely inefficient, instead write them all down at the
beginning.

The correct sequence to switch colours off is to first use 'op' if
it exists, otherwise use 'oc'. If neither of these exist then we
shouldn't be doing colour with this terminal.

Reviewed by: ache


61269 05-Jun-2000 joe

Disable colour support in ls when building the fixit floppy, and make
a note of it in the release Makefile.


61268 05-Jun-2000 joe

* Re-implement colour support using termcap's AF and AB capabilities
to manage the ANSI colour sequences. Colour support is disabled
unless the TERM environment variable references a valid termcap.

* Allow optional compilation of the colour support in the Makefile,
defaulting to yes. This allows us to switch it off for fixit
floppies and other mediums where space is an issue and the extra
bloat of statically linking with ncurses isn't acceptable.

* Display a warning if colour is requested with '-G' but support
for it isn't compiled in.


61178 02-Jun-2000 joe

Add colour support to /bin/ls (at a cost of 1056 bytes on my system).

It is not switched on by default and must be enabled with the -G
flag. When using ls -G the output behaviour is modified with ANSI
colour sequences wrapped around filenames to help distinguish file
types. (Colours can be redefined in the LSCOLORS environment
variable as described in the manual page.)

Colour support is silently disabled (if switched on) if stdout
isn't a tty.

Based on: asami's colorls port.
PR: bin/18900 && ports/18616.


57695 02-Mar-2000 sheldonh

Remove more single-space hard sentence breaks.


57663 01-Mar-2000 sheldonh

Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.


57003 05-Feb-2000 joe

Revert part of the last commit, remove {g|s}etflags from the libc
interface, and statically link them to the programs using them.
These functions, upon reflection and discussion, are too generically
named for a library interface with such specific functionality.
Also the api that they use, whilst ok for private use, isn't good
enough for a libc function.

Additionally there were complications with the build/install-world
process. It depends heavily upon xinstall, which got broken by
the change in api, and caused bootstrap problems and general mayhem.

There is work in progress to address future problems that may be
caused by changes in install-chain tools, and better names for
{g|s}etflags can be derived when some future program requires them.
For now the code has been left in src/lib/libc/gen (it started off
in src/bin/ls).

It's important to provide library functions for manipulating file
flag strings if we ever want this interface to be adopted outside
of the source tree, but now isn't necessarily the right moment
with 4.0-release just around the corner.

Approved: jkh


56692 27-Jan-2000 joe

Historically file flags (schg, uschg, etc) have been converted from
string to u_long and back using two functions, flags_to_string and
string_to_flags, which co-existed with 'ls'. As time has progressed
more and more other tools have used these private functions to
manipulate the file flags.

Recently I moved these functions from /usr/src/bin/ls to libutil,
but after some discussion with bde it's been decided that they
really ought to go in libc.

There are two already existing libc functions for manipulating file
modes: setmode and getmode. In keeping with these flags_to_string
has been renamed getflags and string_to_flags to setflags.

The manual page could probably be improved upon ;)


55514 06-Jan-2000 bde

Print negative minor numbers in hex. Negative minor numbers are
essentially large unsigned ones, and we already print minor
numbers > 255 in hex.


55302 01-Jan-2000 joe

Added missing DPADD's. Removed unrequired SRCS's.

Obtained from: bde


55271 30-Dec-1999 joe

Retire stat_flags.c; it's now in libutil.


55270 30-Dec-1999 joe

Moved flags_to_string and string_to_flags into libutil. It's used in
many places nowadays.


54948 21-Dec-1999 roberto

Fix a bug where a pointer would be one character too far after putting
a '\0' at the end of a string.

Submitted by: Martin Birgmeier <Martin.Birgmeier@aon.at>


54827 19-Dec-1999 roberto

Rewriting of flags_to_string() and string_to_flags() to use an array.

PR: bin/3648
Submitted by: Martin Birgmeier <mbirg@austria.ds.philips.com>


52319 16-Oct-1999 obrien

Add `n' to the synopsis.

Forgotten by: sheldonh


50471 27-Aug-1999 peter

$Id$ -> $FreeBSD$


50204 23-Aug-1999 chris

Backed out my -n change to imply -l by request of sheldonh.


50200 23-Aug-1999 chris

Make -n flag compliant to the Single Unix Specification.

To quote their ls(1) specification:

-n
The same as -l, except that the owner's UID and GID numbers are
written, rather than the associated character strings.

Reviewed by: green


50051 19-Aug-1999 sheldonh

Take integer rounding into account in the buffer size approximation
macro. So now it's (1 +) for the sign and (+ 1) for rounding.

Reported by: bde


50050 19-Aug-1999 sheldonh

Style issues in previous commit:

Use an upward approximation of the number of characters required
for decimal representations of uid_t, gid_t and u_quad_t, intead
of arbitrary values that may not be safe in the future.

Fix disordering.

Requested by: bde


49373 02-Aug-1999 sheldonh

Add -n option to print numeric user and group IDs instead of names
in a long (-l) listing.

MFC-jockies should make sure that bde's concerns regarding the number
of digits required to represent a uid_t and the use of snprintf
on the associated PR have been addressed before going wild.

PR: 12866
Reported by: Philip Kizer <pckizer@nostrum.com>
Obtained from: NetBSD


47367 21-May-1999 jmz

Chflags was clearing all flags supplied on the command line after a
clearing flag like dump or noschg, etc.

PR: bin/10071
Submitted by: Andreas Klussmann <andreas@infosys.heitec.net>


46684 08-May-1999 kris

Various spelling/formatting changes.

Submitted by: Philippe Charnier <charnier@xp11.frmug.org>


46125 27-Apr-1999 hoek

.Xr chflags 1 ,


41431 30-Nov-1998 billf

changable -> changeable

PR: docs/8697
Submitted by: Sascha Blank <blank@fox.uni-trier.de>


40300 13-Oct-1998 des

Doh. What was I smoking when I wrote this?

PR: bin/8301
Submitted by: Tetsuya Furukawa <tetsuya@secom-sis.co.jp>


39934 04-Oct-1998 jkh

Null commit, just to test something. Please ignore.


38026 02-Aug-1998 hoek

Add missing "else", without whom the prev. commit is a null change.
Fix a 2nd level indentation style bug.


37932 29-Jul-1998 hoek

Allow env. variable LS_COLWIDTHS to specify minimum column widths,
effectively overriding the dynamically-sized-column feature. This
is mostly useful for non-interactive use, where it may be necessary
to ensure that listings taken at different times have columns that
line-up correctly. I have been assured that at least one large,
well-known program will soon be taking advantage of this. :-)

PR: bin/7011
Submitted by: Joel Ray Holveck <joelh@gnu.org>


36047 15-May-1998 charnier

Correct use of .Nm. Typo.


36014 13-May-1998 phk

.Sh ENVIRONMENT VARIABLES -> .Sh ENVIRONMENT

PR: 6599
Reviewed by: phk
Submitted by: Josh Gilliam <josh@quick.net>


35515 29-Apr-1998 imp

Add note about BLOCKSIZE variable to -s flag.


35441 25-Apr-1998 ache

Fix nasty error in len_octal, result not initialized


35440 25-Apr-1998 ache

Fix ctype error #1 - chars must be unsigned


35435 24-Apr-1998 des

Remove the bogus -? option after reading the getopt() manual :)


35426 24-Apr-1998 des

o Removed two unused variables (f_dirname and f_newline) in ls.c

o Added the -H and -P options for treatment of symbolic links.

o Removed the #ifdef BSD4_4_LITE, since it does not seem to do anything
useful

o Fixed up prn_octal() so its output looks more like that of AT&T Unices
when -b is given.

The next two lines apply only to the first two changes above:

PR: bin/6140
Submitted by: Max Euston


35417 24-Apr-1998 des

o Renamed '-b' (show unprintables in octal) to '-B'

o Added a new '-b' which behaves as in AT&T Unices (show unprintables in
octal, using C escape codes when possible)

o Added '?' to the getopt() string, since the code in the switch considers
it as a valid option.


35373 21-Apr-1998 des

Added -b option to display unprintables in octal.
PR: 1315


32361 09-Jan-1998 jb

Make a couple of the stat flags dependent on the sys/stat.h header file
that this source is compiled against. This source is referenced by
install which is needed as a build tool and must be able to compile
against NetBSD headers and libraries if we have a hope of supporting
another architecture.

With this change, that's two working programs down and 3945 (?) to go.
The other one was make, but that didn't need any changes to work under
FreeBSD/Alpha. 8-)


31989 25-Dec-1997 hoek

Use consistent spelling,
writeable -> writable (recall prior debate over this? :-)
initialise -> initialize
recognise -> recognize

Merry Christmas! :)


29563 18-Sep-1997 charnier

environmental -> environment.


29560 18-Sep-1997 sef

Fix sorting of directories when doing '-d'.

PR: bin/4558
Submitted by: Keith Bostic


27967 07-Aug-1997 steve

Observe precedence set by Phillippe Charnier in adding an
rcsid.


27958 07-Aug-1997 steve

Remove #if(n)def BSD_4_4_LITE cruft and sccsid -> rcsid.


26360 02-Jun-1997 julian

Submitted by: Whistle Communications (archie Cobbs)

These changes add the ability to specify that a UFS file/directory
cannot be unlinked. This is basically a scaled back version
of the IMMUTABLE flag. The reason is to allow an administrator
to create a directory hierarchy that a group of users
can arbitrarily add/delete files from, but that the hierarchy
itself is safe from removal by them.
If the NOUNLINK definition is set to 0
then this results in no change to what happens normally.
(and results in identical binary (in the kernel)).
It can be proven that if this bit is never set by the admin,
no new behaviour is introduced..
Several "good idea" comments from reviewers plus one grumble
about creeping featurism.

This code is in production in 2.2 based systems


25280 29-Apr-1997 dfr

Enable whiteout code since we now have the lite2 support for them.


24348 28-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


24301 26-Mar-1997 obrien

make usage() and SYNOPSIS agree with each other and add missing options
documented in the DESCRIPTION section.


23460 07-Mar-1997 mpp

Typo fix.


23091 25-Feb-1997 mpp

Add a missing period in the -o option description.

Document the depreciated -g option.

Inspired by: OpenBSD PR# 119


22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


21547 11-Jan-1997 mpp

Minor mdoc cleanup.


21546 11-Jan-1997 mpp

Add a blurb describing the fact that ls will print the
year in place of the hour/minute fields if the time is
more than 6 months in the past or future.

Also some minor mdoc cleanup.


21545 11-Jan-1997 mpp

Make ls include the year when displaying times that are more than
6 months into the future. Closes PR# 1657.

Submitted by: Sakari Jalowaara <sja.home.tekla.fi>


20960 28-Dec-1996 ache

Use strcoll instead of strcmp for file names comparation

Should be in 2.2


20417 14-Dec-1996 steve

Merge Lite2 mods, and -Wall cleaning. undelete(2) cruft
not yet implemented is protected by a define (BSD4_4_LITE)
that should be removed when this call is supported by the
kernel.


17891 29-Aug-1996 wosch

[HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41


17852 27-Aug-1996 adam

set error status on exit, to be consistent with manpage and standard commands.


14952 31-Mar-1996 ache

Use unsigned char for isprint


13513 20-Jan-1996 mpp

Remove unused include of utmp.h from print.c. Closes PR# 486.

Submitted by: Tom Samplonius <tom@haven.uniserve.com>


13120 30-Dec-1995 joerg

Print dev minor #'s > 255 in hex.

Reviewed by: jkh, kuku, phk


11808 26-Oct-1995 ache

Change locale to LC_ALL, there no bitmask


11745 23-Oct-1995 ache

Change LC_ALL to LC_CTYPE|LC_TIME - small optimization


11740 23-Oct-1995 ache

Add setlocale LC_ALL


11015 26-Sep-1995 mpp

Uncomment out references to FIFOs for the -F and -l options.
Also mention sockets in the text for -F.

Partially obtained from the NetBSD commit mail list.


9991 08-Aug-1995 ache

Change ctime to strftime %c to use national date/time representation


9987 07-Aug-1995 wollman

Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.


8855 30-May-1995 rgrimes

Remove trailing whitespace.

Reviewed by: phk


7282 23-Mar-1995 phk

Having BLOCKSIZE=K and using "-k" option ls would use 2K block size...


7165 19-Mar-1995 joerg

You will find enclosed some changes to make gcc -Wall more happy in
/usr/src/bin. Note that some patches are still needed in that directory.

I (Joerg) finished most of Philippe's cleanup. /bin/sh will still
need *allot* of work, however.

Submitted by: charnier@lirmm.fr (Philippe Charnier)


5158 18-Dec-1994 joerg

Make ls recognize the COLUMNS environmental variable, even
in cases where it does not run on a terminal. This is important
e.g. for commands like

env COLUMNS=132 ls -CR | lpr -Psome-wide-printer


3459 09-Oct-1994 ache

Back out ctype fix, unneded with new ctype


3044 24-Sep-1994 dg

Added $Id$


2955 21-Sep-1994 ache

Make ls ctype-aware


2889 19-Sep-1994 pst

Add support for '-k' option to print file allocation space in 'K' instead of
system blocks.

This is semi-original code, not the same way this crufty option was handled
in FreeBSD 1.x.


1557 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1556,
which included commits to RCS files with non-trunk default branches.