Home | History | Annotate | only in /src/bin/ls
History log of /src/bin/ls
RevisionDateAuthorComments
 1.15 17-May-2020  christos No ACL support for install media (SMALLPROG)
 1.14 14-Dec-2006  he branches: 1.14.78;
Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
o Bump libutil minor version number
o Fix uses to include <util.h> to pick up the function definitions
o Fix most uses of flags_to_string() to release the now-malloc()ed result
 1.13 03-Nov-2001  lukem change from WARNS?=1 to WARNS?=2 for bin/
 1.12 19-Oct-2001  lukem enable WARNS?= 2
 1.11 17-May-1999  lukem Rename ls.c::main() -> ls.c::ls_main(), and add a wrapper in main.c::main().
This allows other programs to link in against ls (e.g, ftpd), without having
to have hacks to deal with multiple main()s.

Yes, I know this is ugly. The clean alternative (move lots of this
into libutil, yada yada yada) isn't fun, and the effort probably isn't
justified...
 1.10 20-Jul-1997  christos Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.
 1.9 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.8 21-Mar-1995  cgd convert to new RCS id conventions.
 1.7 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.6 28-Jan-1994  cgd don't need -lutil
 1.5 07-Aug-1993  mycroft New version from uunet, with -k option readded, and 4.4 ffs--specific stuff
in `#ifdef notyet'.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.14.78.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.14.78.1 21-Apr-2020  martin Sync with HEAD
 1.17 07-Aug-2003  agc branches: 1.17.98;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.16 29-Jul-2000  lukem convert to new KNF
 1.15 23-Jul-2000  mycroft ts_nsec -> tv_nsec, per POSIX.
 1.14 09-Oct-1998  enami - To make this file compile again on NetBSD, force to use
old (i.e. posix version of timespec) code if defined(__NetBSD__).
- Introduce some macro for readability.
 1.13 08-Oct-1998  wsanchez Global replace:
-#ifdef _POSIX_SOURCE
+#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined (_XOPEN_SOURCE)
 1.12 08-Oct-1998  wsanchez Handle non-POSIX version of timespec.
 1.11 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.10 08-Jul-1996  mycroft Stylistic change of no consequence.
 1.9 08-Jul-1996  mycroft Compare nanosecond field in timestamps.
Always do name comparison if other sort field is equal.
 1.8 21-Mar-1995  cgd branches: 1.8.6;
convert to new RCS id conventions.
 1.7 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.6 05-Dec-1993  mycroft Patches from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de> to allow
sorting by size.
 1.5 07-Aug-1993  mycroft New version from uunet, with -k option readded, and 4.4 ffs--specific stuff
in `#ifdef notyet'.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.6.1 10-Dec-1996  mycroft From trunk:
Various changes to make the sorting deterministic (and correct).
 1.17.98.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.17.98.1 21-Apr-2020  martin Sync with HEAD
 1.17 29-Aug-2011  joerg branches: 1.17.44;
Move usage and mark it static+dead
 1.16 14-Dec-2006  he Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
o Bump libutil minor version number
o Fix uses to include <util.h> to pick up the function definitions
o Fix most uses of flags_to_string() to release the now-malloc()ed result
 1.15 14-Sep-2003  jschauma Implement '-b' option, which, following FreeBSD, Linux and (I think) Solaris
prints octal escapes for nongraphic characters.
 1.14 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.13 29-Jul-2000  lukem convert to new KNF
 1.12 22-Jun-2000  assar make sure to print file names consistenly in column mode
 1.11 17-Jun-2000  assar branches: 1.11.2;
Do not modify the file name when not printing non-printables, also do
it consistently with the file name and possible symbolic link target.

fixes bin/10385 and bin/10384
 1.10 17-May-1999  lukem branches: 1.10.6;
Rename ls.c::main() -> ls.c::ls_main(), and add a wrapper in main.c::main().
This allows other programs to link in against ls (e.g, ftpd), without having
to have hacks to deal with multiple main()s.

Yes, I know this is ugly. The clean alternative (move lots of this
into libutil, yada yada yada) isn't fun, and the effort probably isn't
justified...
 1.9 12-Feb-1999  kleink Implement 1003.2 -m option (stream output format).
 1.8 10-Oct-1998  mrg create a "stat_flags.h" to go with stat_flags.c
 1.7 18-Jan-1998  lukem * implement -x; sort columns across the page rather than down the page
* in printcol(), don't bother building an index to the linked list if
only printing one column with printscol()...
* implement -n; prevent [gu]id->name mapping in long listings.
inspired by openbsd, but does *not* imply -l by itself.
* fix sorting with -d (or mismatched types in general). (from openbsd).
* document -g. (from openbsd).
 1.6 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.5 21-Mar-1995  cgd convert to new RCS id conventions.
 1.4 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.3 25-Jan-1994  cgd (1) fixup getbsize() calls
(2) convert to use err(), warn(), and warnx(), as appropriate.
 1.2 05-Dec-1993  mycroft Patches from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de> to allow
sorting by size.
 1.1 07-Aug-1993  mycroft branches: 1.1.1;
New file.
Note: This version of ls has deprecated the `-g' option. This is for POSIX
compatibility, I think.
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.10.6.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.11.2.1 26-Jun-2000  assar merge in fixes for printing of strange filenames in column mode from trunk
approved by releng-1-5
 1.17.44.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.17.44.1 21-Apr-2020  martin Sync with HEAD
 1.83 06-Nov-2024  jschauma Correct details around when '-s' prints 'total': this is controlled by
whether we are using multi-column output (-C, -x) or single column output
(-1, -m) with the rationale being that multi-column output is intended
for human consumption.

Based on input from kre@
 1.82 05-Nov-2024  jschauma Note that when '-s' is combined with '-1', the 'total' is _not_ printed.
 1.81 16-May-2020  christos branches: 1.81.8;
Add ACL support for FFS. From FreeBSD.
 1.80 03-Jul-2017  wiz branches: 1.80.6;
Remove workaround for ancient HTML generation code.
 1.79 10-Aug-2016  sevan ls was there from v1.
Confirmed from the TUHS & cat-v.org hosted copies of man pages
 1.78 18-Oct-2014  jschauma Remove the confusing reference to 'file sizes' in the short description of
the '-l' flag. As explained in the Long Format section, the total is of
the blocks used by the files, and only applies to directories.
 1.77 02-Apr-2014  wiz Wording improvement for previous.
From jmc@OpenBSD via Igor Sobrado.
 1.76 02-Apr-2014  wiz 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@
 1.75 21-Feb-2014  christos Add -X (don't cross mount points when recursing) from tls@
 1.74 20-Feb-2014  wiz Use .Nm for 'ls'.
 1.73 20-Feb-2014  christos Add -O (only leaf files) and -P (print full path), from tls@
 1.72 20-Nov-2012  abs PR/47167
ls.1:
- Sort options in `SYNOPSIS', the option list, and texts within
the man page;
- improve wording;
- improve macro usage;
- use more consistency regarding (locations for) information about
which options override which;
- cross-reference `-d' and `-R';
- simplify description of `-k', removing redundant and unneeded
information;
- sort entry type list (but leave `-a' and `-A' as they are, given
their meaning);
- correct / augment description of `BLOCKSIZE' environment variable
in `ENVIRONMENT' section;
- bump date.

ls.c:
- Sort options in `usage';
- augment comment about when to figure out block size.
 1.71 21-Oct-2012  wiz Use more markup.
 1.70 21-Oct-2012  jschauma clarify that BLOCKSIZE also influences the total in long output
 1.69 02-Apr-2011  mbalmer branches: 1.69.4; 1.69.10;
Wording fixes from Ryo HAYASAKA, thanks.
 1.68 15-Mar-2011  wiz Remove trailing whitespace. Add -M to usage.
 1.67 15-Mar-2011  erh PR#7540, add a -M option to ls which causes sizes (and number of blocks) to be
displayed with comma separators (or a locale specific separator).
 1.66 17-Dec-2010  njoly Fix cross-reference, dir(5) -> dirent(3).
 1.65 14-May-2010  joerg Reorder sections to canonical order. Use .Ex -std
 1.64 05-Apr-2010  joerg \\ -> \e
 1.63 25-Sep-2008  lukem Change '-n' so that it implies '-l' rather than requires '-l'.
Brings ls(1) closer to POSIX.1 2004.
Per discussion with Thomas Klausner and Igor Sobrado.
 1.62 22-Sep-2006  elad PR/33635: Anne Bennett: Document 'a' and 'A' flags in ls(1).
strmode(3) already documented these, so use the description from there.
 1.61 21-Aug-2006  christos from zafer: you can have either -k or -h but not both since it does not make
sense.
 1.60 08-Apr-2006  wiz branches: 1.60.2;
Fix date (no leading zero), fix xref: sticky(7) not (8).
 1.59 08-Apr-2006  jschauma Address PR 30374 as suggested in there:

"Modify the man page to match the behaviour of "ls -q",

(done by yamt@ previously)

...
modify both the behaviour and documentation for "ls -b" and "ls -B" to
make spaces readily apparent. This could be done by adding VIS_WHITE
to the flags passed to strvis(3) in the safe_print() function in
src/bin/ls/util.c."

'ls -b' now yields foo\sbar (whitespace) foo\tbar (tab) foo\rbar (CR).
'ls -B' now yields foo\040bar foo\011bar foo\015bar.
 1.58 08-Apr-2006  yamt s/non-graphic/non-printable/ to match with the code.
 1.57 26-Oct-2005  jschauma Rather than '-h' suppressing '-s' when using '-l', make it display
the blocks used in human readable form, as suggested by Alan Barrett
and Daniel Carosone.
 1.56 23-Oct-2005  jschauma document that -h makes -l suppress -s.
(Ie 'ls -lhs' == 'ls -lh')
 1.55 10-Oct-2005  wiz Bump date for previous.
 1.54 10-Oct-2005  jschauma Document that '-g' overrides -1, -C, -m, and -x, but is _always_
overridden by '-l', even if '-g' was specified last.
 1.53 13-Aug-2005  elad Document -L correctly. PR #30430.
 1.52 17-Jun-2005  hira Sort options (description).
 1.51 11-May-2005  pooka Clarify the description for -s to include a pointer to an explanation
on how BLOCKSIZE affects the parameter.
 1.50 09-Jan-2005  jschauma The '-l' option *always* prints a total, not only if output is to a
terminal.
 1.49 06-Aug-2004  jschauma Clarify meaning of '-c' flag by using similar wording as for '-u' flag.
 1.48 26-Dec-2003  wiz Crossreference -h and -k. Use Aq instead of \*[Lt]\*[Gt].
 1.47 26-Dec-2003  grant implement -h(umanize).

from David P. Reese Jr. in PR bin/23870.
 1.46 22-Sep-2003  wiz Bump date for previous; comma cleanup.
 1.45 22-Sep-2003  jschauma After last weeks addition of the '-b' flag, add '-B' and '-w' flags,
suggested by uwe@, inspired by FreeBSD. The three flags override
each other (and the '-q' flag) and behave as follows:

-B Force printing of non-printable characters in file names as
\xxx, where xxx is the numeric value of the character in octal.

-b As -B, but use C escape codes whenever possible.

-w Force raw printing of non-printable characters. This is the
default when output is not to a terminal.
 1.44 14-Sep-2003  wiz Bump date for previous.
 1.43 14-Sep-2003  jschauma Implement '-b' option, which, following FreeBSD, Linux and (I think) Solaris
prints octal escapes for nongraphic characters.
 1.42 02-Sep-2003  wiz Sort options (AaBb...).
 1.41 28-Aug-2003  wiz From FreeBSD bug report 54294, via Jonathan Gray and then jmc@openbsd:
-l option to ls(1) gives all permissions, not just owner and group.
 1.40 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.39 07-May-2003  grant make -g behave as it should according to SUSv3 (long listing without
owner).

ok'd by kleink@.
 1.38 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.37 10-Feb-2003  grant some mdoc improvements.

ok'd by wiz.
 1.36 09-Nov-2002  enami Default .Ar arugment is sufficient.
 1.35 25-Sep-2002  wiz New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.
 1.34 24-Jun-2002  kleink Note that -T is to be used with -l; synced with FreeBSD via Michal
Pasternak on current-users.
 1.33 29-Apr-2002  kleink branches: 1.33.2;
Add missing -p to synopsis; from Ryan Younce in PR misc/16555.
 1.32 08-Feb-2002  ross Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
 1.31 03-Feb-2002  fair Add explanation of directory sizes, and a reference to dir(5),
per PR 14291.
 1.30 20-Dec-2001  wiz Use standard headers.
 1.29 20-Dec-2001  wiz Whitespace nits.
 1.28 08-Jul-2001  simonb Xref getbsize(3).
 1.27 04-Sep-2000  kleink For commands and utilities, use EXIT STATUS rather than RETURN VALUES as
appropriate (and documented in mdoc(7)).
 1.26 28-Aug-2000  hubertf Add 'RETURN VALUE' section header.
 1.25 28-May-2000  bjh21 branches: 1.25.2;
Add Ev tag to COLUMNS
 1.24 05-Jan-2000  mjl branches: 1.24.2;
Add description of FIFOs in long display (was commented out).
 1.23 17-Feb-1999  kleink Add support for the XCU5 -p option (-F restricted to directories).
 1.22 12-Feb-1999  kleink Implement 1003.2 -m option (stream output format).
 1.21 03-Jan-1999  lukem update date
 1.20 03-Jan-1999  lukem refer to chflags(1) for more info on file flags.
split up explanation of long format into a list
 1.19 01-Jun-1998  hubertf Document ls -F's output for sockets;
per PR 5520 by Matt Debergalis <deberg@big-veronica.ai.mit.edu>
 1.18 20-Mar-1998  fair correct HISTORY section of ls(1) to note that Ls(1) exited in 5th Edition UNIX from Bell Labs; add that version to At macro in mdoc, all per PR#4790
 1.17 18-Jan-1998  lukem * implement -x; sort columns across the page rather than down the page
* in printcol(), don't bother building an index to the linked list if
only printing one column with printscol()...
* implement -n; prevent [gu]id->name mapping in long listings.
inspired by openbsd, but does *not* imply -l by itself.
* fix sorting with -d (or mismatched types in general). (from openbsd).
* document -g. (from openbsd).
 1.16 20-Oct-1997  enami Fix .Nm usage.
 1.15 09-Sep-1997  jtc Changed order of STANDARDS and HISTORY subheads to conform with
specification in mdoc(7).
 1.14 05-Dec-1995  jtc ENVIRONMENTAL -> ENVIRONMENT
 1.13 26-Sep-1995  jtc Uncomment text that describes that a vertical bar is printed after each
pathname that is a FIFO when the -F option is used.
 1.12 25-Jul-1995  jtc Use "utility" instead of "command". Modern definitions of these terms
are distinct (See POSIX.2 glossary).

A utility is a executable, script or shell builtin; while a command
can be any of those things plus lists, pipelines, compound commands
(if, for, while) and shell function definitions.
 1.11 21-Mar-1995  cgd convert to new RCS id conventions.
 1.10 27-Dec-1994  mycroft Sync with CSRG.
 1.9 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.8 05-Mar-1994  chopps added missing -A and -o to options summary list.
 1.7 11-Jan-1994  jtc Fix spelling errors.
 1.6 05-Dec-1993  mycroft Patches from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de> to allow
sorting by size.
 1.5 07-Aug-1993  mycroft New version from uunet, with -k option readded, and 4.4 ffs--specific stuff
in `#ifdef notyet'.
 1.4 01-Aug-1993  mycroft Add RCS indentifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 07-Sep-1995  jtc imported from 44lite2
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.24.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.2.1 28-Aug-2000  hubertf Pull up to netbsd-1-5 branch, OK'd by thorpej:

Log Message:
> Add 'RETURN VALUE' section header.

Files & Revisionis:
> cvs rdiff -r1.19 -r1.20 basesrc/bin/cat/cat.1
> cvs rdiff -r1.12 -r1.13 basesrc/bin/chmod/chmod.1
> cvs rdiff -r1.14 -r1.15 basesrc/bin/cp/cp.1
> cvs rdiff -r1.8 -r1.9 basesrc/bin/dd/dd.1
> cvs rdiff -r1.9 -r1.10 basesrc/bin/echo/echo.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/expr/expr.1
> cvs rdiff -r1.25 -r1.26 basesrc/bin/ls/ls.1
> cvs rdiff -r1.10 -r1.11 basesrc/bin/mkdir/mkdir.1
> cvs rdiff -r1.23 -r1.24 basesrc/bin/mt/mt.1
> cvs rdiff -r1.12 -r1.13 basesrc/bin/mv/mv.1
> cvs rdiff -r1.16 -r1.17 basesrc/bin/pwd/pwd.1
> cvs rdiff -r1.9 -r1.10 basesrc/bin/rm/rm.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/rmdir/rmdir.1
> cvs rdiff -r1.35 -r1.36 basesrc/bin/sh/sh.1
> cvs rdiff -r1.11 -r1.12 basesrc/bin/sleep/sleep.1
> cvs rdiff -r1.20 -r1.21 basesrc/bin/stty/stty.1
 1.33.2.1 24-Jun-2002  lukem Pull up revision 1.34 (requested by kleink in ticket #360):
Note that -T is to be used with -l; synced with FreeBSD via Michal
Pasternak on current-users.
 1.60.2.1 27-Aug-2006  riz Pull up following revision(s) (requested by christos in ticket #53):
bin/df/df.c: revision 1.71
bin/mv/mv.c: revision 1.36
bin/ls/ls.1: revision 1.61
bin/ls/ls.c: revision 1.60
-h and -[mgk] are mutually exclusive. Only use the last specified. [from zafer]
Use one variable instead of 3 flags to hold the scale, so that we don't have
to reset each flag.
from zafer: you can have either -k or -h but not both since it does not make
sense.
- detect buffer overflow.
- if we have a trailing slash, don't add another one.
 1.69.10.3 19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.69.10.2 25-Feb-2013  tls resync with head
 1.69.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.69.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.69.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.69.4.1 30-Oct-2012  yamt sync with head
 1.80.6.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.80.6.1 21-Apr-2020  martin Sync with HEAD
 1.81.8.1 02-Aug-2025  perseant Sync with HEAD
 1.79 11-Dec-2024  simonb Use the number of blocks used in the current directory instead of the
total file byte count when printing the initial "total" line with the
-h option combined with -s or -l options.
 1.78 02-Feb-2024  christos branches: 1.78.2;
PR/57892: Roberto Branco: Print full pathname in error messages
 1.77 07-Jul-2020  christos branches: 1.77.6;
Fix skipping of directories that begin with a '.' in -R mode.
It is not enough to avoid displaying the contents of the directory,
we need to set FTS_SKIP to avoid descending into any subdirs too.
Otherwise, if a ".foo" directory has a subdirectory "bar", ls will
descend into bar and display its contents. From Todd Miller
 1.76 06-Feb-2017  rin branches: 1.76.12;
white space
 1.75 30-May-2016  dholland branches: 1.75.2; 1.75.4;
PR 50997 David Binderman: fix format strings
 1.74 02-Apr-2014  wiz 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@
 1.73 22-Feb-2014  mlelstv add u option to getopt again.
 1.72 21-Feb-2014  christos Add -X (don't cross mount points when recursing) from tls@
 1.71 20-Feb-2014  christos Add -O (only leaf files) and -P (print full path), from tls@
 1.70 20-Nov-2012  abs PR/47167
ls.1:
- Sort options in `SYNOPSIS', the option list, and texts within
the man page;
- improve wording;
- improve macro usage;
- use more consistency regarding (locations for) information about
which options override which;
- cross-reference `-d' and `-R';
- simplify description of `-k', removing redundant and unneeded
information;
- sort entry type list (but leave `-a' and `-A' as they are, given
their meaning);
- correct / augment description of `BLOCKSIZE' environment variable
in `ENVIRONMENT' section;
- bump date.

ls.c:
- Sort options in `usage';
- augment comment about when to figure out block size.
 1.69 29-Aug-2011  joerg branches: 1.69.2; 1.69.8;
Move usage and mark it static+dead
 1.68 15-Mar-2011  erh PR#7540, add a -M option to ls which causes sizes (and number of blocks) to be
displayed with comma separators (or a locale specific separator).
 1.67 08-Jul-2010  rmind Add #include <sys/param.h> for howmany().
 1.66 14-Feb-2009  lukem fix -Wsign-compare issues
 1.65 25-Sep-2008  lukem branches: 1.65.6;
Change '-n' so that it implies '-l' rather than requires '-l'.
Brings ls(1) closer to POSIX.1 2004.
Per discussion with Thomas Klausner and Igor Sobrado.
 1.64 20-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
 1.63 14-Dec-2006  he branches: 1.63.12;
Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
o Bump libutil minor version number
o Fix uses to include <util.h> to pick up the function definitions
o Fix most uses of flags_to_string() to release the now-malloc()ed result
 1.62 14-Dec-2006  christos Pass lint. From Anon Ymous
 1.61 23-Sep-2006  elad PR/34499: mac at S dot culver dot net: ls allocates more memory than needed
Applied patch, thanks!
 1.60 21-Aug-2006  christos from zafer: you can have either -k or -h but not both since it does not make
sense.
 1.59 22-Mar-2006  christos branches: 1.59.2;
Coverity CID 1755: Add fts_close() in traverse.
 1.58 26-Oct-2005  jschauma Rather than '-h' suppressing '-s' when using '-l', make it display
the blocks used in human readable form, as suggested by Alan Barrett
and Daniel Carosone.
 1.57 14-Oct-2005  jschauma Honor the COLUMNS variable even when producing output not to a terminal,
as long as a specific format (that could use COLUMNS) was requested.
This makes

env COLUMNS=50 ls -C > file

not surprise the user who clearly wanted some specific output in the file.
 1.56 17-Jun-2005  hira - Add -h to usage.
- Use set/getprogname(3).
 1.55 26-Dec-2003  simonb Fix bug with previous change- always initialise d.s_block. Now "ls -1sh"
works.
XXX: ls -sh now always uses 4 chars for the size column width even if it
needs less than that.
 1.54 26-Dec-2003  simonb KNF - wrap long lines.
 1.53 26-Dec-2003  grant implement -h(umanize).

from David P. Reese Jr. in PR bin/23870.
 1.52 22-Sep-2003  jschauma After last weeks addition of the '-b' flag, add '-B' and '-w' flags,
suggested by uwe@, inspired by FreeBSD. The three flags override
each other (and the '-q' flag) and behave as follows:

-B Force printing of non-printable characters in file names as
\xxx, where xxx is the numeric value of the character in octal.

-b As -B, but use C escape codes whenever possible.

-w Force raw printing of non-printable characters. This is the
default when output is not to a terminal.
 1.51 14-Sep-2003  jschauma Implement '-b' option, which, following FreeBSD, Linux and (I think) Solaris
prints octal escapes for nongraphic characters.
 1.50 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.49 30-May-2003  simonb Pass a NULL to getbsize() for any arguments that aren't needed, and
remove the otherwise unused variables.
 1.48 11-May-2003  kleink If both -g and -l options are present, let -l take precedence over -g,
as requested by several users.

POSIX-2001 is unclear on conflicting option letters as far as the -g
option is concerned; a clarification request will be made.

Addresses PR bin/21519 by Geoff Wing.
 1.47 07-May-2003  simonb Add a FALLTHROUGH to keep lint happy.
 1.46 07-May-2003  grant make -g behave as it should according to SUSv3 (long listing without
owner).

ok'd by kleink@.
 1.45 27-Sep-2002  simonb Need to initialise the blocksize variable if the -i option is used
too. The code in display() could possibly be a bit smarter about this
requirement...

Fixes the problem in PR bin/18321 from David Laight and PR bin/18436
from FUKAUMI Naoki.
 1.44 14-Sep-2002  sommerfeld Use the output blocksize when computing how much room to leave for the
-s option, to suppress unnecessary leading spaces.
 1.43 29-Jul-2000  lukem convert to new KNF
 1.42 17-Jun-2000  assar Do not modify the file name when not printing non-printables, also do
it consistently with the file name and possible symbolic link target.

fixes bin/10385 and bin/10384
 1.41 06-Mar-2000  enami branches: 1.41.2;
- Fix a typo that when group_from_gid is failed (though it merely fails
on NetBSD), numeric gid string is used as `user'.
- Don't mix use %u and %d for numeric uid/gid.
- Share temporary buffer.
 1.40 09-Nov-1999  drochner Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
 1.39 02-Nov-1999  tron Call setlocale(3) to use localization in "ls" as suggested by
Jens A Nilsson in PR bin/8730.
 1.38 17-May-1999  lukem branches: 1.38.2;
Rename ls.c::main() -> ls.c::ls_main(), and add a wrapper in main.c::main().
This allows other programs to link in against ls (e.g, ftpd), without having
to have hacks to deal with multiple main()s.

Yes, I know this is ugly. The clean alternative (move lots of this
into libutil, yada yada yada) isn't fun, and the effort probably isn't
justified...
 1.37 04-May-1999  simonb If an error is encountered, exit with non-zero status.

Based on FreeBSD fix (in 1996!), and fixes PR bin/7514 from
Jorgen Pehrson.
 1.36 17-Feb-1999  kleink branches: 1.36.2;
Add support for the XCU5 -p option (-F restricted to directories).
 1.35 12-Feb-1999  kleink Implement 1003.2 -m option (stream output format).
 1.34 04-Nov-1998  christos %q -> %ll
 1.33 04-Nov-1998  christos include termios.h for struct winsize
 1.32 13-Oct-1998  wsanchez Check for NULL value returned by user_from_uid and group_from_gid and DTRT,
rather than crash.
 1.31 19-Aug-1998  thorpej Add some braces to make egcs happy.
 1.30 28-Jul-1998  mycroft Delint.
 1.29 28-Jul-1998  mycroft Delint.
 1.28 27-Jul-1998  mycroft Slight code reduction.
 1.27 27-Jul-1998  mycroft __AUDIT__ cleanup.
 1.26 16-May-1998  lukem * blocks can be 64bit (not u_long), so calculate and display accordingly
* cleanup some other typedamage (int is as good as u_long)
* remove unused variables
 1.25 03-Feb-1998  mycroft Deal with GCC warning.
 1.24 18-Jan-1998  lukem * implement -x; sort columns across the page rather than down the page
* in printcol(), don't bother building an index to the linked list if
only printing one column with printscol()...
* implement -n; prevent [gu]id->name mapping in long listings.
inspired by openbsd, but does *not* imply -l by itself.
* fix sorting with -d (or mismatched types in general). (from openbsd).
* document -g. (from openbsd).
 1.23 17-Jan-1998  mycroft Automatically resize the major and minor number fields, and DTRT if the size
field is not the same size.
 1.22 30-Jul-1997  thorpej branches: 1.22.2;
Add some casts to printf args to keep the compiler happy on the Alpha.
 1.21 20-Jul-1997  christos include <pwd.h> and <grp.h> to bring prototypes into scope.
 1.20 20-Jul-1997  christos remove user_from_uid and group_from_gid prototypes.
 1.19 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.18 09-Jul-1996  mycroft Sort FTS_NS entries by name, just so the order is well-defined.
 1.17 08-Jul-1996  mycroft Partition FTS_NS entries from others, to avoid confusing qsort().
Don't bother to order the FTS_NS entries amongst themselves.
 1.16 14-Feb-1996  jtc branches: 1.16.4;
Changed so that COLUMNS environment variable will override the value
obtained via the TIOCGWINSIZ ioctl. This is required by POSIX.2, see
section 4.39.5.3.
 1.15 07-Sep-1995  jtc Sync with 4.4lite2
 1.14 21-Mar-1995  cgd convert to new RCS id conventions.
 1.13 27-Dec-1994  mycroft Sync with CSRG.
 1.12 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.11 08-Apr-1994  jtc Changed traverse() and display() so that errors are reported when
they are first detected in display(), rather than waiting until later
in traverse().

The old code allowed "Can not read directory" error messages to be
left unreported unless the -R (recurse) option was used.
 1.10 04-Apr-1994  chopps "yet" on quad_t/off_t things. (not noticed on i386 becuase of endian I guess.)
 1.9 25-Jan-1994  cgd (1) fixup getbsize() calls
(2) convert to use err(), warn(), and warnx(), as appropriate.
 1.8 05-Dec-1993  mycroft Patches from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de> to allow
sorting by size.
 1.7 07-Aug-1993  mycroft New version from uunet, with -k option readded, and 4.4 ffs--specific stuff
in `#ifdef notyet'.
 1.6 01-Aug-1993  mycroft Add RCS identifiers.
 1.5 26-May-1993  deraadt previous patch to ls.c wasn't quite correct. This patch from same author.
 1.4 24-May-1993  deraadt first environment variable was trounced in the case of
"ls -l". Patch from <bob@obiwan.uucp> Bob Willcox
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 07-Sep-1995  jtc imported from 44lite2
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.16.4.1 10-Dec-1996  mycroft From trunk:
Various changes to make the sorting deterministic (and correct).
 1.22.2.1 09-Feb-1998  mellon Pull up 1.23 (mycroft)
 1.36.2.1 09-Sep-2000  he Pull up revision 1.37 (requested by hubertf):
Exit with non-zero status if an error was encountered. Fixes
PR#7514.
 1.38.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.41.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.59.2.1 27-Aug-2006  riz Pull up following revision(s) (requested by christos in ticket #53):
bin/df/df.c: revision 1.71
bin/mv/mv.c: revision 1.36
bin/ls/ls.1: revision 1.61
bin/ls/ls.c: revision 1.60
-h and -[mgk] are mutually exclusive. Only use the last specified. [from zafer]
Use one variable instead of 3 flags to hold the scale, so that we don't have
to reset each flag.
from zafer: you can have either -k or -h but not both since it does not make
sense.
- detect buffer overflow.
- if we have a trailing slash, don't add another one.
 1.63.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.65.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.69.8.2 19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.69.8.1 25-Feb-2013  tls resync with head
 1.69.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.69.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.75.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.75.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.76.12.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.76.12.1 21-Apr-2020  martin Sync with HEAD
 1.77.6.1 20-Jul-2024  martin Pull up following revision(s) (requested by rin in ticket #743):

bin/ls/ls.c: revision 1.78

PR/57892: Roberto Branco: Print full pathname in error messages
 1.78.2.1 02-Aug-2025  perseant Sync with HEAD
 1.20 11-Dec-2024  simonb Use the number of blocks used in the current directory instead of the
total file byte count when printing the initial "total" line with the
-h option combined with -s or -l options.
 1.19 20-Feb-2014  christos branches: 1.19.26; 1.19.38;
Add -O (only leaf files) and -P (print full path), from tls@
 1.18 15-Mar-2011  erh branches: 1.18.4; 1.18.10;
PR#7540, add a -M option to ls which causes sizes (and number of blocks) to be
displayed with comma separators (or a locale specific separator).
 1.17 14-Feb-2009  lukem fix -Wsign-compare issues
 1.16 26-Dec-2003  grant branches: 1.16.40;
implement -h(umanize).

from David P. Reese Jr. in PR bin/23870.
 1.15 22-Sep-2003  jschauma After last weeks addition of the '-b' flag, add '-B' and '-w' flags,
suggested by uwe@, inspired by FreeBSD. The three flags override
each other (and the '-q' flag) and behave as follows:

-B Force printing of non-printable characters in file names as
\xxx, where xxx is the numeric value of the character in octal.

-b As -B, but use C escape codes whenever possible.

-w Force raw printing of non-printable characters. This is the
default when output is not to a terminal.
 1.14 14-Sep-2003  jschauma Implement '-b' option, which, following FreeBSD, Linux and (I think) Solaris
prints octal escapes for nongraphic characters.
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.12 07-May-2003  grant make -g behave as it should according to SUSv3 (long listing without
owner).

ok'd by kleink@.
 1.11 17-Jun-2000  assar Do not modify the file name when not printing non-printables, also do
it consistently with the file name and possible symbolic link target.

fixes bin/10385 and bin/10384
 1.10 17-Feb-1999  kleink branches: 1.10.8;
Add support for the XCU5 -p option (-F restricted to directories).
 1.9 16-May-1998  lukem * blocks can be 64bit (not u_long), so calculate and display accordingly
* cleanup some other typedamage (int is as good as u_long)
* remove unused variables
 1.8 17-Jan-1998  mycroft Automatically resize the major and minor number fields, and DTRT if the size
field is not the same size.
 1.7 21-Mar-1995  cgd branches: 1.7.4;
convert to new RCS id conventions.
 1.6 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.5 07-Aug-1993  mycroft New version from uunet, with -k option readded, and 4.4 ffs--specific stuff
in `#ifdef notyet'.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7.4.3 09-Feb-1998  mellon Pull up 1.8 (mycroft)
 1.7.4.2 09-Feb-1998  mellon Undo accidental commit on branch
 1.7.4.1 17-Jan-1998  mycroft Automatically resize the major and minor number fields, and DTRT if the size
field is not the same size.
 1.10.8.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.16.40.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.18.10.1 19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19.38.1 02-Aug-2025  perseant Sync with HEAD
 1.19.26.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.19.26.1 21-Apr-2020  martin Sync with HEAD
 1.5 05-Sep-2016  sevan branches: 1.5.14;
Drop main() prototype.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 14-Dec-2006  christos branches: 1.3.10;
Pass lint. From Anon Ymous
 1.2 29-Jul-2000  lukem convert to new KNF
 1.1 17-May-1999  lukem Rename ls.c::main() -> ls.c::ls_main(), and add a wrapper in main.c::main().
This allows other programs to link in against ls (e.g, ftpd), without having
to have hacks to deal with multiple main()s.

Yes, I know this is ugly. The clean alternative (move lots of this
into libutil, yada yada yada) isn't fun, and the effort probably isn't
justified...
 1.3.10.1 18-May-2008  yamt sync with head.
 1.5.14.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.5.14.1 21-Apr-2020  martin Sync with HEAD
 1.59 11-Dec-2024  simonb Use the number of blocks used in the current directory instead of the
total file byte count when printing the initial "total" line with the
-h option combined with -s or -l options.
 1.58 06-Nov-2024  jschauma In multi-column output, print the 'total' line even if we ended up
using only a single column (e.g., COLUMNS is small or the filenames
are long).
 1.57 17-May-2020  christos branches: 1.57.8;
No ACL support for install media (SMALLPROG)
 1.56 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.55 10-May-2014  martin branches: 1.55.24;
PR bin/48798: fix format for ino_t.
Slightly modifed variant of the patch provided by Thomas Schmitt.
 1.54 22-Feb-2014  mlelstv branches: 1.54.2;
fix -w output
 1.53 20-Feb-2014  christos Add -O (only leaf files) and -P (print full path), from tls@
 1.52 02-May-2013  zafer remove whitespace from end of file.
introduced by erh in 1.49
 1.51 29-Jun-2012  yamt branches: 1.51.2;
handle realloc failure
 1.50 15-Mar-2011  christos branches: 1.50.4;
- use printf(3) "'" format to do thousands grouping instead of custom version.
- fix sign format inconsistencies.
 1.49 15-Mar-2011  erh PR#7540, add a -M option to ls which causes sizes (and number of blocks) to be
displayed with comma separators (or a locale specific separator).
 1.48 18-Aug-2010  enami Fix broken indentation. No functional change.
 1.47 02-Apr-2010  christos make it obvious to grep that we are checking ctime.
 1.46 01-Apr-2010  christos handle ctime returning NULL
 1.45 14-Feb-2009  lukem fix -Wsign-compare issues
 1.44 28-Dec-2008  christos branches: 1.44.2;
prepare for 64 bit dev_t
 1.43 02-Nov-2008  ahoka Implement a printtotal function to avoid code repetition.
 1.42 14-Dec-2006  christos Pass lint. From Anon Ymous
 1.41 31-Oct-2005  jschauma Somehow missed this in the last commit, where I only changed the commentary
to reflect the actual change (plus minor nits). So here's the actual change:

Rather than '-h' suppressing '-s' when using '-l', make it display
the blocks used in human readable form, as suggested by Alan Barrett
and Daniel Carosone.

(Missing bits spotted, as usual, by wiz@.)
 1.40 17-Nov-2004  mycroft Print some future timestamps with HH:MM rather than YYYY, so that we get
something reasonable if we're using a file server whose time is slightly
ahead.
 1.39 09-Aug-2004  jschauma If a files date is any time in the future (not six months or more),
use "date "+%b %e %Y"" format. This is what SUSv3 says.
Ok jdolecek, dsl
 1.38 26-Dec-2003  grant implement -h(umanize).

from David P. Reese Jr. in PR bin/23870.
 1.37 22-Sep-2003  jschauma After last weeks addition of the '-b' flag, add '-B' and '-w' flags,
suggested by uwe@, inspired by FreeBSD. The three flags override
each other (and the '-q' flag) and behave as follows:

-B Force printing of non-printable characters in file names as
\xxx, where xxx is the numeric value of the character in octal.

-b As -B, but use C escape codes whenever possible.

-w Force raw printing of non-printable characters. This is the
default when output is not to a terminal.
 1.36 14-Sep-2003  jschauma Implement '-b' option, which, following FreeBSD, Linux and (I think) Solaris
prints octal escapes for nongraphic characters.
 1.35 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.34 07-May-2003  grant make -g behave as it should according to SUSv3 (long listing without
owner).

ok'd by kleink@.
 1.33 09-Nov-2002  enami Cosmetic changes.
 1.32 01-Aug-2002  christos don't include utmp.h
 1.31 04-Feb-2001  christos fix nested extern.
 1.30 29-Jul-2000  lukem convert to new KNF
 1.29 22-Jun-2000  assar make sure to print file names consistenly in column mode
 1.28 17-Jun-2000  assar branches: 1.28.2;
Do not modify the file name when not printing non-printables, also do
it consistently with the file name and possible symbolic link target.

fixes bin/10385 and bin/10384
 1.27 09-Nov-1999  drochner branches: 1.27.2;
Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
 1.26 17-Feb-1999  kleink branches: 1.26.6;
Add support for the XCU5 -p option (-F restricted to directories).
 1.25 12-Feb-1999  kleink Implement 1003.2 -m option (stream output format).
 1.24 04-Nov-1998  christos %q -> %ll
 1.23 04-Nov-1998  christos conservative casts for printfs.
 1.22 28-Jul-1998  mycroft Delint.
 1.21 16-May-1998  lukem * blocks can be 64bit (not u_long), so calculate and display accordingly
* cleanup some other typedamage (int is as good as u_long)
* remove unused variables
 1.20 21-Jan-1998  mycroft If a time stamp is 6 months or more in the future, display the year in the
short form. Also, cache the current time.
 1.19 18-Jan-1998  lukem * implement -x; sort columns across the page rather than down the page
* in printcol(), don't bother building an index to the linked list if
only printing one column with printscol()...
* implement -n; prevent [gu]id->name mapping in long listings.
inspired by openbsd, but does *not* imply -l by itself.
* fix sorting with -d (or mismatched types in general). (from openbsd).
* document -g. (from openbsd).
 1.18 17-Jan-1998  mycroft Automatically resize the major and minor number fields, and DTRT if the size
field is not the same size.
 1.17 30-Jul-1997  thorpej branches: 1.17.2;
Add some casts to printf args to keep the compiler happy on the Alpha.
 1.16 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.15 11-Dec-1996  thorpej Do multicolumn output in a way that's a little more likely to always
line up evenly. From D'Arcy J.M. Cain <darcy@druid.com>, PR #2965.
 1.14 07-Sep-1995  jtc Sync with 4.4lite2
 1.13 21-Mar-1995  cgd convert to new RCS id conventions.
 1.12 27-Dec-1994  mycroft Sync with CSRG.
 1.11 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.10 04-Apr-1994  chopps "yet" on quad_t/off_t things. (not noticed on i386 becuase of endian I guess.)
 1.9 27-Mar-1994  cgd off_t exp.
 1.8 25-Jan-1994  cgd (1) fixup getbsize() calls
(2) convert to use err(), warn(), and warnx(), as appropriate.
 1.7 13-Jan-1994  jtc The working directory is changed back when fts_children() returns,
so their fts_accpath members no longer have the correct relative
path. We can solve this problem by looking at the parent's path
via p->fts_parent->fts_accpath.
 1.6 14-Oct-1993  jtc POSIX.2 says to print a pipe character after fifo names when using
the -F option.
 1.5 07-Aug-1993  mycroft New version from uunet, with -k option readded, and 4.4 ffs--specific stuff
in `#ifdef notyet'.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 07-Sep-1995  jtc imported from 44lite2
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.17.2.2 09-Feb-1998  mellon Pull up 1.18 (mycroft)
 1.17.2.1 29-Jan-1998  mellon Pull up 1.20 (mycroft)
 1.26.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.27.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.28.2.1 26-Jun-2000  assar merge in fixes for printing of strange filenames in column mode from trunk
approved by releng-1-5
 1.44.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.50.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.50.4.1 30-Oct-2012  yamt sync with head
 1.51.2.2 19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.2.1 23-Jun-2013  tls resync from head
 1.54.2.1 10-Aug-2014  tls Rebase.
 1.55.24.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.55.24.1 21-Apr-2020  martin Sync with HEAD
 1.57.8.1 02-Aug-2025  perseant Sync with HEAD
 1.22 14-Dec-2006  he Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
o Bump libutil minor version number
o Fix uses to include <util.h> to pick up the function definitions
o Fix most uses of flags_to_string() to release the now-malloc()ed result
 1.21 14-Dec-2006  he The "#ifdef UNUSED_BLOCK" in stat_flags.c wasn't so unused after
all -- it was used by the mtree source. So, instead do an "#ifdef
MTREE", and define that one when building mtree.
 1.20 14-Dec-2006  christos Pass lint. From Anon Ymous
 1.19 25-May-2004  hannken Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.

- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
Snapshots may not be opened for writing and the attributes are read-only.
Use the mtime as the time this snapshot was taken.
Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
 1.18 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.17 13-Aug-2003  itojun use bounded string op
 1.16 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.15 16-Nov-2002  itojun we can't do {} while (0) for TEST() macro since it has "break" which
goes out of the switch statement. from shin-ichi kaneta.
 1.14 09-Nov-2002  enami Cosmetic changes.
 1.13 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.12 29-Jan-2002  tv Add hooks to make mtree compilable from src/tools.
 1.11 18-Oct-2001  lukem fix strlcpy length in previous...
 1.10 18-Oct-2001  lukem make this WARNS=2 safe
 1.9 18-Oct-2001  lukem flags_to_strings() changes:

- fix bug where the 'clear' flag was set outside of main loop, so
"dump,uchg,arch" on a file with flags would clear all the bits
(because "dump" sets 'clear'). noted in FreeBSD PR 10071, and fix
obtained from FreeBSD.

- enforce right-most priority on arguments by clearing the appropriate
bit in the opposite set; if a string of "nouchg,uchg" is given,
chflags(8) would clear uchg because it applies the "set" bits before
clearing the "clear" bits. now, "uchg" sets UF_IMMUTABLE in setp
and also resets it in clrp, solving this problem

- constify second arg (the `default' arg)
 1.8 29-Jul-2000  lukem convert to new KNF
 1.7 03-Jan-1999  lukem * parse `nonodump' (synonym for `dump'; both are inverse of `nodump').
from Brian C. Grayson <bgrayson@marvin.ece.utexas.edu> in [bin/3932]
* don't depend on a fallthrough in one case; explicitly return like
all other cases.
* include "stat_flags.h" instead of "ls.h" and "extern.h"; other
programs use this file and don't need the other cruft.
 1.6 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.5 07-Sep-1995  jtc Sync with 4.4lite2
 1.4 21-Mar-1995  cgd convert to new RCS id conventions.
 1.3 27-Dec-1994  mycroft Sync with CSRG.
 1.2 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.1 22-Sep-1994  mycroft branches: 1.1.1;
Initial revision
 1.1.1.2 07-Sep-1995  jtc imported from 44lite2
 1.1.1.1 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.5 14-Dec-2006  he Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
o Bump libutil minor version number
o Fix uses to include <util.h> to pick up the function definitions
o Fix most uses of flags_to_string() to release the now-malloc()ed result
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.3 18-Oct-2001  lukem flags_to_strings() changes:

- fix bug where the 'clear' flag was set outside of main loop, so
"dump,uchg,arch" on a file with flags would clear all the bits
(because "dump" sets 'clear'). noted in FreeBSD PR 10071, and fix
obtained from FreeBSD.

- enforce right-most priority on arguments by clearing the appropriate
bit in the opposite set; if a string of "nouchg,uchg" is given,
chflags(8) would clear uchg because it applies the "set" bits before
clearing the "clear" bits. now, "uchg" sets UF_IMMUTABLE in setp
and also resets it in clrp, solving this problem

- constify second arg (the `default' arg)
 1.2 29-Jul-2000  lukem convert to new KNF
 1.1 10-Oct-1998  mrg create a "stat_flags.h" to go with stat_flags.c
 1.34 29-Aug-2011  joerg branches: 1.34.44;
Move usage and mark it static+dead
 1.33 15-Mar-2011  wiz Add -M to usage.
 1.32 06-Jun-2007  soda modify a comment in previous change
 1.31 05-Jun-2007  wiz Apply SODA Nuriyuki's patch for multibyte support.
Based on soda-revised2.patch (in private mail) with a change from
soda on tech-userlevel.

Ok christos@.
 1.30 14-Dec-2006  christos Pass lint. From Anon Ymous
 1.29 08-Apr-2006  jschauma Address PR 30374 as suggested in there:

"Modify the man page to match the behaviour of "ls -q",

(done by yamt@ previously)

...
modify both the behaviour and documentation for "ls -b" and "ls -B" to
make spaces readily apparent. This could be done by adding VIS_WHITE
to the flags passed to strvis(3) in the safe_print() function in
src/bin/ls/util.c."

'ls -b' now yields foo\sbar (whitespace) foo\tbar (tab) foo\rbar (CR).
'ls -B' now yields foo\040bar foo\011bar foo\015bar.
 1.28 17-Jun-2005  hira - Add -h to usage.
- Use set/getprogname(3).
 1.27 22-Sep-2003  jschauma After last weeks addition of the '-b' flag, add '-B' and '-w' flags,
suggested by uwe@, inspired by FreeBSD. The three flags override
each other (and the '-q' flag) and behave as follows:

-B Force printing of non-printable characters in file names as
\xxx, where xxx is the numeric value of the character in octal.

-b As -B, but use C escape codes whenever possible.

-w Force raw printing of non-printable characters. This is the
default when output is not to a terminal.
 1.26 14-Sep-2003  jschauma Implement '-b' option, which, following FreeBSD, Linux and (I think) Solaris
prints octal escapes for nongraphic characters.
 1.25 02-Sep-2003  wiz Sort options (AaBb...).
 1.24 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.23 09-Nov-2002  enami Cosmetic changes.
 1.22 20-Dec-2001  soren Oops, pasto.
 1.21 20-Dec-2001  soren Sync getopt() / man page with actual getopt options.
 1.20 29-Jul-2000  lukem convert to new KNF
 1.19 22-Jun-2000  assar make sure to print file names consistenly in column mode
 1.18 17-Jun-2000  assar branches: 1.18.2;
Do not modify the file name when not printing non-printables, also do
it consistently with the file name and possible symbolic link target.

fixes bin/10385 and bin/10384
 1.17 17-Feb-1999  kleink branches: 1.17.8;
Add support for the XCU5 -p option (-F restricted to directories).
 1.16 12-Feb-1999  kleink Implement 1003.2 -m option (stream output format).
 1.15 28-Jul-1998  mycroft Delint.
 1.14 18-Jan-1998  lukem * implement -x; sort columns across the page rather than down the page
* in printcol(), don't bother building an index to the linked list if
only printing one column with printscol()...
* implement -n; prevent [gu]id->name mapping in long listings.
inspired by openbsd, but does *not* imply -l by itself.
* fix sorting with -d (or mismatched types in general). (from openbsd).
* document -g. (from openbsd).
 1.13 20-Jul-1997  christos Fix compiler warnings.
Add WARNS=1
 1.12 07-Sep-1995  jtc Sync with 4.4lite2
 1.11 21-Mar-1995  cgd convert to new RCS id conventions.
 1.10 27-Dec-1994  mycroft Sync with CSRG.
 1.9 25-Oct-1994  mycroft Add `-o' option to usage string.
 1.8 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.7 25-Jan-1994  cgd (1) fixup getbsize() calls
(2) convert to use err(), warn(), and warnx(), as appropriate.
 1.6 05-Dec-1993  mycroft Patches from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de> to allow
sorting by size.
 1.5 07-Aug-1993  mycroft New version from uunet, with -k option readded, and 4.4 ffs--specific stuff
in `#ifdef notyet'.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 07-Sep-1995  jtc imported from 44lite2
 1.1.1.2 22-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.17.8.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.18.2.1 26-Jun-2000  assar merge in fixes for printing of strange filenames in column mode from trunk
approved by releng-1-5
 1.34.44.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.34.44.1 21-Apr-2020  martin Sync with HEAD

RSS XML Feed