summaryrefslogtreecommitdiff
path: root/bin/ls
AgeCommit message (Collapse)Author
2024-03-27printtime: use the Unix epoch if the file's timestamp is invalidTodd C. Miller
Fixes a crash in "ls -l" for files with bogus timestamp values. OK miod@ denis@
2023-10-07Simplify the display() function by getting rid of a useless bufferIngo Schwarze
on the stack. No functional change, +8 -15 LOC. Suggested by and OK millert@.
2023-10-07Improve horizontal alignment in long format when printing minorIngo Schwarze
device numbers greater than 999 by measuring the two widths needed for device numbers just like it is already done for other numbers. In the output, this only changes whitespace, but not the text. Ugly formatting reported by Crystal Kolipe <kolipe dot c at exoticsilicon dot com>. OK millert. Also tested by Crystal Kolipe.
2023-08-08Replace use of the old BSD st_*timensec members in struct stat withPhilip Guenther
the POSIX-standard st_*tim.tv_nsec members. ok millert@
2020-10-07If we are asked to print the total number of blocks, do so even ifTodd C. Miller
we have no entries to print (either due to an empty directory or an error). This makes the -l and -s options more consistent, and matches the behavior of AT&T and GNU ls. From FreeBSD (das). OK kn@
2020-07-06Always print the directory name in -R mode; matches historical behavior.Todd C. Miller
Previously, our ls would only print the directory name when listing more than one directory, which is the correct behavior for non-recursive ls but not for -R mode. OK deraadt@
2020-07-06Fix skipping of directories that begin with a '.' in -R mode.Todd C. Miller
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. OK deraadt@
2019-02-05dev_t is signed to permit passing -1 as an invalid condition, but theTheo de Raadt
decomposition into major and minor is unsigned, so we should print them with %u instead of %d. ok guenther
2018-09-13Fix warnings caused by user_from_uid() and group_from_gid() nowTodd C. Miller
returning const char *.
2018-02-04use sizeof, rather than the constant. on change in binary.Theo de Raadt
2018-02-04repair ugly indentsTheo de Raadt
2016-10-24Unify wording for LC_CTYPE in ENVIRONMENT:Ingo Schwarze
* Consistently use "character encoding locale" as suggested by stsp@. * Resolve various gratuitious wording variations. OK jmc@.
2016-09-08it seems we hyphenate it set-group-id;Jason McIntyre
from daniel bolgheroni
2016-08-16Nuke some erroneous leading whitespace.Kenneth R Westerback
2016-08-16Bring types of variables used with struct stat into the modern world.Kenneth R Westerback
Replace a couple of u_long paramaters with int as they were only passed int values and the function re-cast them to (int) anyway. Weird. ok tedu@
2016-08-15%*qd -> %*lld + (long long) for off_t.Kenneth R Westerback
Avoid some casts by changing printsize() to take an int (the only type actually passed via that parameter) instead of size_t. Tweaks & ok guenther@
2016-08-10fix HISTORY; from Sevan Janiyan <venture37 at geeklan dot co dot uk>;Ingo Schwarze
checked with http://minnie.tuhs.org/cgi-bin/utree.pl?file=V1/man/man1
2016-03-28remove unused variableCharles Longeau
ok schwarze@
2016-03-17simplify previous; ok bentleyJason McIntyre
2016-03-17Switch (non-curses, non-ksh) programs that use COLUMNS to a single idiom.Anthony J. Bentley
Previously behaviors were all over the map. This changes them to use COLUMNS first, and either terminal width or a hardcoded value (typically 80) as appropriate. ok deraadt@; man bits ok jmc@
2016-03-11Mark up COLUMNS as an environment variable.Anthony J. Bentley
ok jmc@ schwarze@
2016-01-18Fix a regression (and POSIX violation) introduced with UTF-8 support:Ingo Schwarze
When neither running on a terminal nor with -q, names must be passed through as they are, nothing must be replaced with question marks. Effectively, -q was always in effect. SMALL was not affected. Triggered by a different patch from Martijn van Duren <openbsd plus tech at list dot imperialat dot at>, who confirmed that this version is better. Identified as a regression by tedu@. OK sthen@.
2015-12-01Support UTF-8: use wcwidth(3) for column adjustment and replaceIngo Schwarze
non-printable Unicode codepoints and invalid bytes with ASCII question marks. No change for the SMALL version. Using ideas developed by tedu@, phessler@, bentley@ and feedback from many. OK yasuoka@ czarkoff@ sthen@.
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-04ls can use tame "stdio rpath getpw". It does uid/gid lookups, usingTheo de Raadt
the 4.4bsd libc caching varients called user_from_uid/group_from_uid, which are backed by getpw*/getgr* type functions. ok semarie
2015-06-25Put fts_close() where missing.Masao Uebayashi
Not bugs in short-lived commands that call exit() -> _exit() immediately, but for idempotency. Originally found in ls(1) by Valgrind. Changes for other commands are from deraadt@. Reviewed by me, tested in snapshots. OK deraadt@
2015-04-24improve wording.Igor Sobrado
ok jmc@
2015-04-18Convert many atoi() calls to strtonum(), adding range checks and failureTheo de Raadt
handling along the way. Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert
2015-03-15tzfile.h is an internal header that should never have been installed.Todd C. Miller
What's worse, the tzfile.h that gets installed is over 20 years old and doesn't match the real tzfile.h in libc/time. This makes the tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE define has been moved to time.h temporarily until its usage is replaced by 1900 in the tree. Actual removal of tzfile.h is pending a ports build. Based on a diff from deraadt@
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-05-06reallocarrayTed Unangst
2014-04-01slightly reword -f; ok sobrado schwarzeJason McIntyre
2014-03-31restore the traditional behavior of -f implying -a; apparently Keith BosticIgor Sobrado
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@
2014-03-31revert previous: i was wrong;Jason McIntyre
thanks thomas klausner for noticing
2014-03-30a pesky comma rendered the text describing how output is sorted relevantJason McIntyre
only to the "if more than one operand is given" scenario; replace it with a full stop and start a new paragraph; ok millert
2014-03-28expand STANDARDS somewhat; ok millertJason McIntyre
2014-01-09Per POSIX, times in the future should be reported with the yearPhilip Guenther
like files more than six months old. Use strftime() directly instead of breaking down the ctime() output on character positions. ok millert@
2013-11-21add unsigned char casts for specific calls to ctype.h macros.Theo de Raadt
ok guenther step
2013-05-30Fix column padding of inode numbers and block counts >2^32, as well asPhilip Guenther
display of directory block totals >2^32 ok tedu@
2013-04-23handle large ino_t; ok millertTheo de Raadt
2012-12-04remove some unnecessary sys/cdefs.h inclusionsTheo de Raadt
2012-07-12With the -l option, only call time() once per run instead of once per filePhilip Guenthe
ok deraadt@
2011-08-31use the same format/text, as far as possible, for date strings;Jason McIntyre
help/ok guenther millert
2011-03-05fix description of -g; from Pascal StumpfJason McIntyre
2011-03-05tweak; ok okanJason McIntyre
2011-03-04add support for the (POSIX) -H flagOkan Demirmen
feedback and ok millert@, sobrado@, jmc@
2010-09-12remove trailing spaces and tabs from source code; no binary change.Igor Sobrado
2010-09-03add an EXIT STATUS section for /bin;Jason McIntyre
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2009-08-21- more opaque removalJason McIntyre
- sort the flags list while here ok martynas tedu