Commit Graph

14 Commits

Author SHA1 Message Date
Doug Barton
9b3f439482 Bring in the update from NetBSD 1.28:
"Fix WARNS=4 issues (-Wcast-qual -Wsign-compare)"

Because of code differences I had to hand-apply parts of the patch,
so responsibility for errors goes to me.

Obtained from:	lukem@NetBSD.org
2010-12-05 21:29:20 +00:00
Doug Barton
b9f9338ea8 Bring in a new feature, adding a -f option to readlink to print the path
of the target, similar to realpath(1). See the discussion at:
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=34662

This brings in the following changes:
1.24
"PR/34662: martijnb at atlas dot ipv6 dot stack dot nl: readlink doesn't
grok -f, and there's no alternative (+fix)

Patch applied with minor tweak (%y -> %R, as it was already taken) plus
some nits from myself. Thanks!"

Obtained from:	elad@NetBSD.org

1.25
"Fix a segfault when doing 'stat -f %R' on the stdin file handle, instead
fake the filename '(stdin)' like the %N format."

Obtained from:	mlelstv@NetBSD.org

1.27
"The ofmt variable is actually a bit mask (not the character that was
in the format string) so that we can "or" it with the bits in the
formats variable.  This fixes the missing " -> " in front of the real
path (when you use %SR).

Also, the ?: needs another space."

Obtained from:	atatat@NetBSD.org

I am purposely omitting the following changes:
1.23	A humanize_number(3) clone that should better be implemented by
	actually using humanize_number(3)
1.26	This is the removal of license clause 3 and 4, already handled
	by imp in r203971
2010-12-05 21:11:45 +00:00
Doug Barton
578800b575 Bring in the change from NetBSD 1.22:
"Fix a trivial truncation case, and eliminate a corner case that might
print a nul character."

I am purposely bypassing the following versions:
1.19	A build infrastructure change that does not apply to us
1.20	A feature I am not interested in, but don't object if someone else
	wants to pick it up
1.21	A build infrastructure change that does not apply to us

Obtained from:	atatat@NetBSD.org
2010-12-05 20:47:53 +00:00
Doug Barton
ccdbe8ce16 Bring in the change from NetBSD 1.18:
"If using stat (the -L flag) and it fails, fall back to lstat().  It
may be the case that we're examining a broken symlink, and anything is
better than nothing."

The changes in 1.14 through 1.17 were not relevant to us.

Obtained from:	atatat@NetBSD.org
2010-12-05 09:33:04 +00:00
Jilles Tjoelker
24d9be57ae stat: Allow -f %Sf to display the file flags symbolically.
I have changed the patch slightly to show '-' if there are no flags just
like ls -ldo does.

PR:		124349
Submitted by:	Ighighi
MFC after:	1 week
2010-04-24 13:53:12 +00:00
Warner Losh
89f84ab0a5 The NetBSD Foundation has granted permission to remove clause 3 and 4
from their software.

Obtained from:	NetBSD
2010-02-16 21:43:57 +00:00
Ed Schouten
42dc9c5abd Let stat(1) use fdevname(3).
Because we now have a reliable library function that converts file
descriptors to character device names, let stat(1) use this. This means
it can now do the following:

	$ stat -f %N
	/dev/pts/0

I've changed main() to set file properly, so output() is never called
with file set to NULL.

Approved by:	dougb (older version, still used devname)
2009-02-11 20:36:17 +00:00
Maxim Konovalov
df8a2f1a4b o Print an octal representation of suid, sgid and sticky bits with -x flag.
PR:		bin/131569
Submitted by:	Jaakko Heinonen
Reported by:	Yannick Cadin
MFC after:	1 week
2009-02-11 10:50:26 +00:00
Doug Barton
dad5d4e08c Resolve conflicts 2003-10-06 01:55:17 +00:00
Doug Barton
1cee9d8d65 Import NetBSD's 1.10 version, which includes the ability to display
the new inode birthtime field, a few other small cleanups, and
synchronization with our #include <sys/types.h>.

Approved by:	re (bmah)
Obtained from:	Andrew Brown <atatat@NetBSD.org>
2003-05-11 23:02:09 +00:00
Doug Barton
7d5b77ef5f Adjust the size passed to readlink so that the null termination
falls within the range of the path variable.

Cribbed from the latest NetBSD source.

Obtained from:	provos@NetBSD.org
2002-10-25 07:26:36 +00:00
Doug Barton
782ce28781 I was too conservative with my header changes, so restore some sanity
via bde. atatat@NetBSD.org made basically the same change in their
version, so bring over their CVS Id which I neglected last time.

Obtained from:	bde, Andrew Brown <atatat@NetBSD.org>
2002-08-15 04:58:46 +00:00
Doug Barton
5b812a140d A cooperative effort...
1. Update the code to the latest from NetBSD, which includes:
* A new command line option to suppress stat(2) errors
* Output is now done via stdio
* Fixes for bitwise OR'ing of letters

2. Andrew from NetBSD merged in our own Johan's readlink patches.

3. Andrew also merged in some brucifications.

I made some small contributions to the header cleanup, and tried
to generally improve the overall style(9)'ishness. I also documented
the new -q option and added the *LINKS to the Makefile.

All responsibility for mistakes in merging the contributions
from the above is mine.

Obtained from:	Andrew Brown <atatat@NetBSD.org>, bde, johan
2002-08-13 08:23:49 +00:00
Doug Barton
06b6d7d8a8 Virgin import of NetBSD's stat(1) 2002-06-06 19:27:17 +00:00