Commit Graph

64 Commits

Author SHA1 Message Date
apb 64d2b8e0ba Use vis(3) encoding when a string format is modified by the '#' flag.
Also bump copyright years.
2011-09-22 20:23:55 +00:00
apb 9438a85a85 More corrections to format compatibility between stat(1), find(1) -ls,
and ls(1) -lT.
2011-09-16 14:32:53 +00:00
wiz 8438689645 Remove unnecessary Ns. 2011-09-16 13:33:13 +00:00
apb 229948abdb Anothe difference in output format: stat -f "%Z" does not add any
space in "major,minor" for device nodes, whereas both "ls -l" and
"find -ls" add at least one space.
2011-09-16 11:06:27 +00:00
apb 7f5f7e4b90 Add examples of formats for stat(1) to simulate "find -ls" and "ls -lTd". 2011-09-15 19:56:35 +00:00
joerg fb1e3f6f7d static + __dead 2011-09-06 18:31:22 +00:00
christos 9590e2915d document non-literal format strings 2011-08-17 13:22:33 +00:00
christos c544446f26 Add verbose mode for readlink. 2011-02-16 23:08:29 +00:00
njoly d1860447da Do not crash if a date cannot be represented (localtime returning
NULL), use the Epoch value instead.
2011-01-15 22:54:10 +00:00
dholland c79b866358 Don't pass unused argument. From Doug Barton. 2010-12-16 05:42:14 +00:00
dholland f0a79c06c5 Use strlcpy, not strncpy, when the desired semantics are strlcpy's
rather than strncpy's.
2010-12-16 05:30:16 +00:00
dholland 436ec2bec5 Improve previous with comments. 2010-11-25 04:33:30 +00:00
dholland 09bec75330 Don't printf time_t with %d; fixes PR 44128 from yamt. With this change it
successfully prints mtimes after 2038.
2010-11-24 22:57:53 +00:00
joerg a3d484cd9e \\ -> \e 2010-04-05 21:25:01 +00:00
enami fc5eb1b7ac Since we have st_birthtime in struct stat, it is in default display. 2010-03-11 21:37:01 +00:00
lukem b33c816619 Fix WARNS=4 issues (-Wcast-qual -Wsign-compare) 2009-04-13 23:02:36 +00:00
wiz a6a4761c6a Drop trailing space. 2008-11-07 16:49:45 +00:00
reed a798b8c1a1 Be consistent: document the birthtime field of struct stat for
the "B" field specifier.
2008-11-07 15:33:31 +00:00
wiz 1f8562f538 Fix three variable names.
From Todd T. Fries via Jason McIntyre.
2008-10-20 08:37:25 +00:00
atatat 23a609536c 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.
2008-05-16 17:58:33 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
mlelstv 5c1a4dd94c Fix a segfault when doing 'stat -f %R' on the stdin file handle, instead
fake the filename '(stdin)' like the %N format.
2008-02-09 09:18:07 +00:00
atatat e1aff854df Put back the NetBSD tag 2007-11-10 03:12:10 +00:00
wiz ed200f5855 Document the flags displayed by the default format, and mention their short
names. From espie@openbsd via jmc@openbsd.
2007-11-07 23:01:33 +00:00
wiz e2d8a15c15 Make sentence easier to parse. From jsing@openbsd via jmc@openbsd. 2007-11-07 22:27:50 +00:00
elad 2a7d09e7cd 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!
2006-10-07 10:41:50 +00:00
wiz 7cb5118cfd Sort SEE ALSO. Drop trailing space. 2005-06-26 10:16:46 +00:00
atatat 277396bd87 Bend the 'L', 'M', and 'H' modifiers to work on the size, whereby it
is rounded to the nearest kilobyte, megabyte, or gigabyte.
Implemented at lukem's request since some things can't deal with
overly large numbers when files are really large.

Have to do something like humanize_number(3), but that interface isn't
really what I'm looking for.  I think.  More examination required.
2005-06-23 03:13:24 +00:00
atatat fab1a5fa39 Fix a trivial truncation case, and eliminate a corner case that might
print a nul character.
2005-04-22 03:36:48 +00:00
wiz 3c0fa0f019 Some fixes from jmc@openbsd. 2005-04-04 13:34:40 +00:00
jmc 2afa8931db Now that tools/compat provides a check, make sure st_birthtimensec exists
before using it
2005-01-13 00:53:14 +00:00
yamt 075d5146c6 correct examples. 2005-01-08 03:46:05 +00:00
atatat fa01c2e835 Add "dirname"- and "basename"-like functionality to stat(1) by way of
the "high" and "low" selectors on the filename.
2004-12-31 03:24:31 +00:00
wiz d05a042013 Sort options. Use more mdoc macros. Some nit fixes. Bump date. 2004-09-01 23:26:10 +00:00
yamt 1575138bfb document default format. 2004-09-01 22:18:20 +00:00
jmc b2f782612f Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
2004-06-20 22:20:14 +00:00
atatat 90bf99f1fb 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.
2004-05-28 04:48:31 +00:00
atatat f9130f0cc1 Take the time to set gottime so that you don't have to waste time
trying to figure out why the time isn't the time you expected all the
time.
2003-10-29 04:25:46 +00:00
lukem 6182ef67e2 be consistent using #if HAVE_STRUCT_STAT_ST_xxx (versus #ifdef) 2003-10-27 00:16:21 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
chs 8caf978ec2 fix for systems which don't have st_*timespec. PR 23214. 2003-10-26 20:43:13 +00:00
atatat d5fb781871 More properly host-tool-ify stat 2003-07-25 03:21:15 +00:00
lukem 49671e2e2b * don't compile in support for st_birth #ifdef HOSTPROG
* remove %B (birth) from default format strings, since %B isn't available
  #ifdef HOSTPROG, and it's not standard enough to be fussed about anyway
2003-07-23 07:23:23 +00:00
lukem 4b391b57bf pass in -DHOSTPROG if a HOSTPROG 2003-07-22 13:58:49 +00:00
agc 8a3e64ceb9 Fix a tyop - we want the readlink binary and manual pages when HOSTPROG
is not defined.
2003-07-21 10:16:55 +00:00
lukem 5885a35ae3 first attempt at making this a HOSTPROG 2003-07-20 14:12:13 +00:00
wiz 9029b1ef5d Bump date for last. 2003-05-08 13:07:10 +00:00
atatat ee00aa727c Add %B to print the st_birthtime of an inode (adjusting the "raw"
format and "shell" format appropriately), and rename the st_*timespec
fields in the shell-style output to be st_*time, since that's what
they really are.
2003-05-08 13:05:38 +00:00
atatat ebe81c7ec3 Fix the sample output in one of the examples 2003-02-21 18:50:10 +00:00