Commit Graph

27 Commits

Author SHA1 Message Date
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 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
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
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
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
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
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 5885a35ae3 first attempt at making this a HOSTPROG 2003-07-20 14:12:13 +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
provos 32b88027c7 use readlink with bufsize - 1; approved thorpej. 2002-10-19 20:33:17 +00:00
atatat 3b13379090 Use limits.h instead of sys/syslimits.h since it's more potrable. 2002-08-13 20:15:06 +00:00
atatat 95c295f329 Style sync with FreeBSD. Changes via Doug Barton <DougB@FreeBSD.org>. 2002-08-13 14:05:41 +00:00
atatat 4f9dae6e41 Header reorganization makes a shorter list. From Doug Barton <DougB@FreeBSD.org> 2002-07-09 21:25:00 +00:00
atatat c18774b05c The bitwise or-ing together of letters is almost *guaranteed* to do
the wrong thing, as in this case.  I should read the preprocessor
output more often.
2002-07-09 17:22:26 +00:00
atatat 5ccfe86e65 A new command line option, -q, suppresses *stat(2) failure messages.
Output is now done via stdio, instead of with my stupid homegrown
buffering (I don't even know why I did it that way in the first
place).  Also, from Johan Karlsson <johan@freebsd.org>, eliminate a
spurious newline if no output was generated, and link stat(1) to
readlink(1) for similarity to OpenBSD.
2002-07-08 18:48:42 +00:00
atatat 4baf4e86ab When asked for the string representation of a device that isn't
found by devname(3), don't report a "bad format"...just use "???"
instead.
2002-05-31 16:45:16 +00:00
atatat 04712927f0 Add a simple format that translates to the current file number, fix an
off by one error, and #define a bunch more things to make it clearer.
2002-05-09 17:52:03 +00:00
atatat ba4e8c9674 Add a stat(1) program to /usr/bin. It provides a simple formatting
interface, with reasonable defaults, to the information provided by
stat(2) so that scripts can use the data therein much more easily.
2002-04-27 16:37:19 +00:00