Commit Graph

308 Commits

Author SHA1 Message Date
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Kenneth D. Merry
7da1a731c6 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)
2013-08-21 23:04:48 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Joel Dahl
e9e3a1ab1f Add a few examples.
Obtained from:	OpenBSD
2013-03-15 20:12:54 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Andrew Turner
3c96f482d9 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.
2013-01-06 02:50:38 +00:00
Peter Wemm
d272a5b786 Undo over-aggressive conversion of spaces to tabs. ie: those within
format strings, "period, space, space" in comment text, etc.
2012-11-09 20:19:56 +00:00
Greg Lehey
dfd91f79a3 Replace spaces with tabs where appropriate.
Reminded by: jh@
2012-11-08 23:45:19 +00:00
Simon J. Gerraty
7cd2dcf076 Updated/new Makefile.depend 2012-11-08 21:24:17 +00:00
Greg Lehey
9aa68a3ffa 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
2012-11-08 00:24:26 +00:00
Greg Lehey
44f17a8111 Sort option parsing as far as practical. 2012-11-07 23:37:24 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Matthew D Fleming
6db1a7f11e Fix bin/ build with a 64-bit ino_t.
Original code by:	Gleb Kurtsou
2012-09-27 23:31:12 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Marcel Moolenaar
6663ff446e 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.
2012-05-19 18:05:00 +00:00
Dag-Erling Smørgrav
4d4dcc7aef 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>
2011-10-19 15:35:41 +00:00
Dag-Erling Smørgrav
cf1479392e 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
2011-10-18 13:10:46 +00:00
Ed Schouten
9f365aa1d6 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).
2011-09-28 18:53:36 +00:00
Sergey Kandaurov
e2ea39cbdb Update sticky(7) cross references.
PR:		docs/124468
X-MFC with:	r218998
2011-05-13 16:29:57 +00:00
Ed Schouten
99742a231f 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.
2010-03-28 13:16:08 +00:00
Jaakko Heinonen
1fe8c2a989 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
2010-02-08 15:42:55 +00:00
Jaakko Heinonen
55926a6616 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
2010-01-24 19:23:07 +00:00
Jaakko Heinonen
ba027bbf9a 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
2010-01-24 19:17:35 +00:00
Jilles Tjoelker
5c3743e3bb 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
2009-10-13 21:51:50 +00:00
Edward Tomasz Napierala
a34292623f 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.
2009-09-02 20:50:39 +00:00
Edward Tomasz Napierala
f7b8687a93 Add NFSv4 ACL support to ls(1). 2009-08-31 20:53:01 +00:00
Edward Tomasz Napierala
3f772eca32 Add reference to strmode(3). 2009-04-13 15:29:14 +00:00
Warner Losh
2af52e0724 Turn a tab into a space. This fixes a misalignment for ls -l.
Tabs Noticed by: Antoine Brodin
2008-04-05 21:26:25 +00:00
Ruslan Ermilov
5ffbd51eb0 - Add -D to usage().
- Bump document date for the addition of the -D option.
- Reformat a sentence to look like a real sentence.
2008-04-04 05:55:42 +00:00
Greg Lehey
2269fa5765 Add -D option to specify exact format of date and time output with ls -l. 2008-04-04 03:57:46 +00:00
Ruslan Ermilov
b912fe73ee 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
2006-10-18 10:58:27 +00:00
Ruslan Ermilov
32fcd4577f - 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]
2006-10-12 10:08:52 +00:00
Ruslan Ermilov
9badf57f01 Markup fixes. 2006-09-17 17:40:07 +00:00
John Baldwin
93a5035fd7 Change the -S and -t options to override each other so that the last one
specified wins to make their interaction less confusing.
2006-03-24 17:09:03 +00:00
John Baldwin
86cca1e75e 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).
2006-03-24 16:47:22 +00:00
John Baldwin
bea12be630 Add a few more references to -U. 2006-03-24 16:43:58 +00:00
John Baldwin
fe79420eb7 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
2006-03-24 16:38:02 +00:00
Ruslan Ermilov
8af1113166 -mdoc sweep. 2005-11-17 12:15:23 +00:00
Ruslan Ermilov
390a478eb0 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
2005-11-16 07:13:37 +00:00
Maxime Henrion
86e79d090b Mention the non-standardness of the -I option in ls(1).
Spotted by:	ru
MFC after:	3 days
2005-11-10 14:26:50 +00:00
Maxime Henrion
7b7d153b21 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
2005-11-10 00:02:32 +00:00
Ralf S. Engelschall
f93a0797e0 fix typos: decribed -> described, preceeded -> preceded 2005-09-06 20:14:39 +00:00
Gary W. Swearingen
34602d8e7e Improved descriptions of block size handling.
PR:             docs/84765
Submitted by:   garys
Approved by:    keramida
MFC after:      3 days
2005-08-31 17:58:38 +00:00
Dima Dorfman
24b0280f8c 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
2005-06-03 11:38:35 +00:00
Dima Dorfman
77a15272e7 Improve wording: A sort is "in" a particular order, not "by" a
particular order.
2005-06-03 11:22:06 +00:00
Dima Dorfman
71b8b74887 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
2005-06-03 11:05:58 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
a89237ae95 Sync program's usage() with manpage's SYNOPSIS. 2005-02-09 17:37:39 +00:00
Ruslan Ermilov
6fca4c7c3f Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.
2005-01-16 16:41:59 +00:00
Joerg Wunsch
1c7adc9b77 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
2005-01-11 08:51:21 +00:00
Warner Losh
9ddb49cbe4 /*- or .\"- or #- to begin license clauses. 2005-01-10 08:39:26 +00:00
Ruslan Ermilov
eccea571a7 Mechanically kill hard sentence breaks. 2004-07-02 21:04:19 +00:00
David Malone
f137c9c100 Fix some style bugs I introduced pointed out by bde. Also add a blank
line after the empty variable declarations.

Reviewed by:	md5
2004-06-23 08:26:31 +00:00
David Malone
60e52383e7 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
2004-06-22 16:02:29 +00:00
David Schultz
70bad4f75b 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
2004-06-08 09:30:10 +00:00
David Schultz
48a91b69b8 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.
2004-06-08 09:27:42 +00:00
Lukas Ertl
7fcc4669d8 Plug small memory leak.
PR:             bin/67392
Submitted by:   Matthew Emmerton <matt@gsicomp.on.ca>
MFC in:         1 week
2004-06-03 15:04:00 +00:00
Pawel Jakub Dawidek
478aa80510 Use humanize_number(3).
Reminded by:	jhb
2004-05-25 14:53:47 +00:00
Ruslan Ermilov
2d3640781e Punctuation. 2004-05-16 21:34:49 +00:00
Tim J. Robbins
6449b88bf1 Only add the widths together for printable characters in prn_normal();
unprintable characters have a "width" of -1.
2004-05-03 11:48:55 +00:00
Tim J. Robbins
107409f46e 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.
2004-05-02 11:25:37 +00:00
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Bosko Milekic
263377339c 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>
2004-04-03 16:55:56 +00:00
Tim J. Robbins
f791df19bd Document incorrect handling of multibyte characters in filenames. 2004-03-21 11:16:24 +00:00
Colin Percival
310924af3d 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)
2004-03-01 19:25:27 +00:00
Colin Percival
d3b68bf14c 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)
2004-01-22 04:33:00 +00:00
David E. O'Brien
d5f9f41c7b Do something sensible if both -h and -k are given.
Approved by:	re(scottl)
2003-12-01 19:10:29 +00:00
Tim J. Robbins
c5bc87095b Handle realloc() failure correctly. 2003-10-16 07:07:20 +00:00
Tim J. Robbins
bc458f6637 Add the -m, -w and -x options to ls's usage message.
PR:		51493
Submitted by:	Walter Belgers
MFC after:	1 month
2003-09-09 12:02:52 +00:00
Jens Schweikhardt
a3c75939e8 Note in STANDARDS that -gno are not (yet?) POSIX conformant.
Spotted by:	harti
MFC after:	3 days
2003-08-08 17:04:17 +00:00
Christian Brueffer
d18ff742dc -l prints all permissions, not just owner and group
PR:		54294
Submitted by:	Per Hedeland <per@hedeland.org>
MFC after:	3 days
2003-07-10 20:53:56 +00:00
Mark Murray
eac4bdcca4 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
2003-06-13 07:04:02 +00:00
Tom Rhodes
bf88fa9352 df(1) and ls(1) print units in 'four or fewer' not 'three or less'.
PR:		35523
Submitted by:	Tomas Svensson <tsn@gbdev.net>
2003-05-06 21:54:46 +00:00
Mark Murray
40feca3a99 Fix a bazillion warnings. This makes almost the whole of src/bin/*
WARNS=6, std=c99 clean.

Tested on:	i386, alpha
2003-05-03 16:39:34 +00:00
Robert Watson
317f1d53c8 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
2003-04-26 02:31:26 +00:00
Chris Costello
d2e59e8d5d Reference maclabel(7).
Sponsored by:	DARPA, Network Associates Laboratories
2003-01-20 21:25:00 +00:00
Tim J. Robbins
3fceb9fd5b 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
2002-12-19 01:13:23 +00:00
Robert Watson
3c3f5f9cab 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
2002-12-18 21:05:15 +00:00
Ruslan Ermilov
1734e39a1a mdoc(7) police: markup fixes.
Approved by:	re
2002-11-25 13:52:57 +00:00
Tim J. Robbins
e09fdabddf Use warn() instead of perror() or fprintf() where appropriate. 2002-11-06 01:18:12 +00:00
Tim J. Robbins
dd9aaeb0f7 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)
2002-11-03 07:29:08 +00:00
Garrett Wollman
688dfe4533 Do not include <sys/syslimits.h> directly; it is not intended for general
consumption.
2002-10-27 17:44:33 +00:00
Robert Watson
4df6daba42 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
2002-10-24 01:01:53 +00:00
Robert Watson
4d33b62edc 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
2002-10-24 00:07:30 +00:00
Mark Murray
ca2993fb41 Constify, staticify, rationalise types and fix other related warnings. 2002-10-23 10:20:01 +00:00
Mark Murray
099bda679e Constify to squash some warnings. 2002-10-23 10:15:44 +00:00
Tim J. Robbins
1656f85050 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
2002-10-18 10:59:45 +00:00
Dima Dorfman
598420ee63 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
2002-10-18 04:06:59 +00:00
Garrett Wollman
0d3bcc2e80 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
2002-09-21 01:28:41 +00:00
Giorgos Keramidas
872b3fe268 Fix a warning of "possibly used before initialisation".
Reviewed by:	tjr
2002-08-29 14:29:09 +00:00
Philippe Charnier
0d9f1a69d8 Replace various spellings with FALLTHROUGH which is lint()able 2002-08-25 13:01:47 +00:00
Tom Rhodes
7d971bbf29 s/filesystem/file system/ as discussed on -developers 2002-08-21 17:32:44 +00:00
Ruslan Ermilov
84a0a0eeac mdoc(7) police: fixed the document date.
Submitted by:	iedowse
2002-08-19 07:15:20 +00:00
Jens Schweikhardt
2b239dd118 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
2002-08-11 13:05:30 +00:00
Matthew Dillon
5ad9e45f96 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.
2002-07-10 20:44:55 +00:00
David E. O'Brien
5eb43ac2f7 Consistently use __FBSDID 2002-06-30 05:13:54 +00:00
Tim J. Robbins
a28edf9a4a Ignore empty COLUMNS environment variable. COLUMNS should take precedence
over TTY width found via ioctl() (SUSv3)
2002-06-04 10:11:29 +00:00
Ruslan Ermilov
3f0e2b01ff mdoc(7) police: markup nits. 2002-05-29 15:09:49 +00:00