History log of /freebsd-current/bin/ls/util.c
Revision Date Author Comments
# e043f372 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# e2662256 23-Oct-2022 Aymeric Wibo <obiwac@gmail.com>

ls(1): add a -v flag to sort naturally

Add a -v flag for ls which sorts entries following a natural ordering
using strverscmp(3) (e.g. "bloem1 bloem9 bloem10" as opposed to
"bloem1 bloem10 bloem9").

Update the manual page and add a test case.

Reviewed by: pauamma, bcr
Tested by: pstef
Differential Revision: https://reviews.freebsd.org/D36407


# e10ba800 16-Aug-2018 Kyle Evans <kevans@FreeBSD.org>

ls(1): Add --color=when

--color may be set to one of: 'auto', 'always', and 'never'.

'auto' is the default behavior- output colors only if -G or COLORTERM are
set, and only if stdout is a tty.

'always' is a new behavior- output colors always. termcap(5) will be
consulted unless TERM is unset or not a recognized terminal, in which case
ls(1) will fall back to explicitly outputting ANSI escape sequences.

'never' to turn off any environment variable and -G usage.

Reviewed by: cem, 0mp (both modulo last-minute manpage changes
Differential Revision: https://reviews.freebsd.org/D16741


# 0fdf7fa8 17-Jan-2018 Conrad Meyer <cem@FreeBSD.org>

Convert ls(1) to not use libxo(3)

libxo imposes a large burden on system utilities. In the case of ls, that
burden is difficult to justify -- any language that can interact with json
output can use readdir(3) and stat(2).

Logically, this reverts r291607, r285857, r285803, r285734, r285425,
r284494, r284489, r284252, and r284198.

Kyua tests continue to pass (libxo integration was entirely untested).

Reported by: many
Reviewed by: imp
Discussed with: manu, bdrewery
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13959


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 52e4a08c 09-Jun-2015 Marcel Moolenaar <marcel@FreeBSD.org>

Convert ls(1) to use libxo(3).

Obtained from: Phil Shafer <phil@juniper.net>
Sponsored by: Juniper Networks, Inc.


# 3c96f482 05-Jan-2013 Andrew Turner <andrew@FreeBSD.org>

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.


# dfd91f79 08-Nov-2012 Greg Lehey <grog@FreeBSD.org>

Replace spaces with tabs where appropriate.

Reminded by: jh@


# 9aa68a3f 07-Nov-2012 Greg Lehey <grog@FreeBSD.org>

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


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5ffbd51e 03-Apr-2008 Ruslan Ermilov <ru@FreeBSD.org>

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


# fe79420e 24-Mar-2006 John Baldwin <jhb@FreeBSD.org>

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


# 390a478e 16-Nov-2005 Ruslan Ermilov <ru@FreeBSD.org>

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


# 71b8b748 03-Jun-2005 Dima Dorfman <dd@FreeBSD.org>

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


# a89237ae 09-Feb-2005 Ruslan Ermilov <ru@FreeBSD.org>

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


# 9ddb49cb 10-Jan-2005 Warner Losh <imp@FreeBSD.org>

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


# 6449b88b 03-May-2004 Tim J. Robbins <tjr@FreeBSD.org>

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


# 107409f4 02-May-2004 Tim J. Robbins <tjr@FreeBSD.org>

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.


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# bc458f66 08-Sep-2003 Tim J. Robbins <tjr@FreeBSD.org>

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

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


# 40feca3a 03-May-2003 Mark Murray <markm@FreeBSD.org>

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

Tested on: i386, alpha


# 5eb43ac2 29-Jun-2002 David E. O'Brien <obrien@FreeBSD.org>

Consistently use __FBSDID


# 5f7ca9ae 28-Feb-2002 Andrey A. Chernov <ache@FreeBSD.org>

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

PR: 35421


# c73d77ce 03-Feb-2002 Mark Murray <markm@FreeBSD.org>

Use __FBSDID() and clean up the vendor tags.


# 9052855a 03-Feb-2002 Mark Murray <markm@FreeBSD.org>

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


# 46251dde 01-Feb-2002 Warner Losh <imp@FreeBSD.org>

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.


# 0e8d1551 28-Dec-2001 Josef Karthauser <joe@FreeBSD.org>

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


# 7304f61f 26-Nov-2001 Brian Feldman <green@FreeBSD.org>

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

Sponsored by: DARPA, NAI Labs


# 133099f3 21-Jul-2000 Brian Feldman <green@FreeBSD.org>

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


# ee579ffb 04-Jul-2000 Assar Westerlund <assar@FreeBSD.org>

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


# a04eaf5b 06-Jun-2000 Andrey A. Chernov <ache@FreeBSD.org>

Add -G to usage: if COLORLS


# 2a456239 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# f3a6a64e 02-Aug-1999 Sheldon Hearn <sheldonh@FreeBSD.org>

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


# 0ffc35a4 12-Oct-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

Doh. What was I smoking when I wrote this?

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


# d9a1c82a 24-Apr-1998 Andrey A. Chernov <ache@FreeBSD.org>

Fix nasty error in len_octal, result not initialized


# 70183462 24-Apr-1998 Andrey A. Chernov <ache@FreeBSD.org>

Fix ctype error #1 - chars must be unsigned


# a2a029d2 24-Apr-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

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


# 3a34dbf7 23-Apr-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

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


# 0d86878c 24-Apr-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

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.


# 7ea30648 21-Apr-1998 Dag-Erling Smørgrav <des@FreeBSD.org>

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


# febad2fc 07-Aug-1997 Steve Price <steve@FreeBSD.org>

Observe precedence set by Phillippe Charnier in adding an
rcsid.


# d46c1a60 07-Aug-1997 Steve Price <steve@FreeBSD.org>

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


# c4694019 01-Jul-1997 Bruce Evans <bde@FreeBSD.org>

Import Lite2's src/bin. All files in src/bin are off the vendor branch,
so this doesn't change the active versions.


# 36f763ab 26-Mar-1997 David E. O'Brien <obrien@FreeBSD.org>

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


# b97fa2ef 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

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.


# fb5cb208 13-Dec-1996 Steve Price <steve@FreeBSD.org>

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.


# 3cb7c0b1 31-Mar-1996 Andrey A. Chernov <ache@FreeBSD.org>

Use unsigned char for isprint


# c31c20bb 09-Oct-1994 Andrey A. Chernov <ache@FreeBSD.org>

Back out ctype fix, unneded with new ctype


# 89730b29 23-Sep-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# 24891fb1 21-Sep-1994 Andrey A. Chernov <ache@FreeBSD.org>

Make ls ctype-aware


# 4b88c807 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite bin Sources