summaryrefslogtreecommitdiffstats
path: root/bin/ls/print.c
Commit message (Collapse)AuthorAgeFilesLines
* Undo over-aggressive conversion of spaces to tabs. ie: those withinpeter2012-11-091-2/+2
| | | | format strings, "period, space, space" in comment text, etc.
* Replace spaces with tabs where appropriate.grog2012-11-081-5/+5
| | | | Reminded by: jh@
* Add y flag and environment variable LS_SAMESORT to specify the samegrog2012-11-081-1/+5
| | | | | | | | | | | | | | | | | 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
* Fix bin/ build with a 64-bit ino_t.mdf2012-09-271-2/+4
| | | | Original code by: Gleb Kurtsou
* Get rid of major/minor number distinction.ed2011-09-281-9/+2
| | | | | | | | | | | | | | | | | | | | | | 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).
* Fixes for ls(1) long format (-l) output:jh2010-01-241-12/+26
| | | | | | | | | | - 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
* Fix regression introduced in r196712 - the 'name' string needstrasz2009-09-021-5/+9
| | | | | | 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.
* Add NFSv4 ACL support to ls(1).trasz2009-08-311-52/+54
|
* Turn a tab into a space. This fixes a misalignment for ls -l.imp2008-04-051-2/+2
| | | | Tabs Noticed by: Antoine Brodin
* Add -D option to specify exact format of date and time output with ls -l.grog2008-04-041-7/+10
|
* Avoid a spurious warning for each whiteout found during "ls -lW".ru2006-10-181-2/+3
| | | | | | | | # 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
* Add a new -U flag to instruct ls to use the birthtime for printing orjhb2006-03-241-0/+2
| | | | | | | sorting. Submitted by: Andrzej Tobola ato at iem dot pw dot edu dot pl MFC after: 1 week
* /*- or .\"- or #- to begin license clauses.imp2005-01-101-1/+1
|
* Remove from the printfns the assumption that dp->list != NULL. Evendas2004-06-081-2/+6
| | | | | if there are no entries, these functions may be called to print the total number of blocks (0) for consistency's sake.
* Use humanize_number(3).pjd2004-05-251-58/+5
| | | | Reminded by: jhb
* Treat filenames as multibyte character strings (according to the currenttjr2004-05-021-1/+2
| | | | | | | | | | | | | 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.
* Remove clause 3 from the UCB licenses.markm2004-04-061-4/+0
| | | | OK'ed by: imp, core
* Stop iterating over ACLs if we've already determined webmilekic2004-04-031-5/+11
| | | | | | | | | | 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>
* Fixes to output of `ls -lh` for certain file sizes:cperciva2004-03-011-4/+4
| | | | | | | | | | | | | | | | | | | | | 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)
* Fix alignment of size field in `ls -lh` -- the width was being computedcperciva2004-01-221-2/+2
| | | | | | | | 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)
* Handle realloc() failure correctly.tjr2003-10-161-2/+5
|
* Fix a bazillion warnings. This makes almost the whole of src/bin/*markm2003-05-031-22/+21
| | | | | | WARNS=6, std=c99 clean. Tested on: i386, alpha
* pathconf() and acl_get_file() follow links so they cannot be used totjr2002-12-191-0/+8
| | | | | | | | | 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
* Use warn() instead of perror() or fprintf() where appropriate.tjr2002-11-061-6/+4
|
* Print a `+' character after the standard UNIX permission fields in longtjr2002-11-031-0/+53
| | | | | | | | 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)
* Teach "ls -Z" to use the policy-agnostic MAC label interfaces ratherrwatson2002-10-241-2/+2
| | | | | | | | | | | 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
* Constify, staticify, rationalise types and fix other related warnings.markm2002-10-231-8/+8
|
* Print non-printing characters in directory names, as well as file names,tjr2002-10-181-1/+1
| | | | | | | as `?' or `\ooo', depending on whether the -b or -B flags were used. PR: 43995 MFC after: 1 month
* Output "human-readable" values with a non-0 precision wheredd2002-10-181-7/+9
| | | | | | | | 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
* Fix a warning of "possibly used before initialisation".keramida2002-08-291-2/+1
| | | | Reviewed by: tjr
* Consistently use __FBSDIDobrien2002-06-301-4/+2
|
* Add missing options required by SUSv3:tjr2002-05-191-2/+47
| | | | | | | | -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>
* restore missing default case removed in ls.c:r1.57billf2002-05-151-0/+1
| | | | | | add break statements to default cases where missing. Submitted by: bde
* #include <time.h> for the definition of time functions instead ofbde2002-02-251-2/+1
| | | | | | depending on namespace pollution 2 layers deep in <sys/stat.h>. Removed unused includes.
* Use __FBSDID() and clean up the vendor tags.markm2002-02-031-5/+6
|
* WARNS=4 fixes, plus a healthy dose of fixes inspired by lint.markm2002-02-031-13/+12
|
* o __P has been reovedimp2002-02-021-45/+25
| | | | | | | | | 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.
* LSCOLOURS should be spelt LSCOLORS.joe2001-12-291-1/+1
| | | | Submitted by: Jordan DeLong <fracture@allusion.net
* Restore these files to shiny KNF.joe2001-12-291-43/+43
|
* Convert some spaces into tabs that I missed first time around.joe2001-12-281-30/+30
|
* Revert most of rev 1.42, to restore KNF style.joe2001-12-281-49/+49
| | | | Requested by: bde
* Add a new flag, -h which when combined with the -l option causesjoe2001-12-281-1/+71
| | | | | | | | 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
* Make it clearer what changed to a user using the old format of LSCOLORS.joe2001-12-281-3/+3
|
* Mop up some warnings.joe2001-12-281-2/+2
|
* Make the style more consistent throughout the file.joe2001-12-281-58/+71
|
* Use the default colour instead if a bad colour specification is given.joe2001-12-281-1/+1
|
* Revamp the colour support to allow for bold characters. Coloursjoe2001-12-281-15/+39
| | | | | | | | 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
* Add LOMAC options (the "Z" flag in both cases) to display extra informationgreen2001-11-261-0/+2
| | | | | | in ls(1) and ps(1). Sponsored by: DARPA, NAI Labs
* Silence minor cc warningache2001-03-211-1/+1
|
* Use nl_langinfo instead of %Efache2001-03-211-6/+7
|
OpenPOWER on IntegriCloud