Commit Graph

93 Commits

Author SHA1 Message Date
wiz 33b95c7f55 readlink: sort SEE ALSO 2022-07-21 10:08:28 +00:00
kre a71e9960ca Add an Xr to realpath(1) (which does much the same as readlink -f).
Try not to forget the damn comma!
2022-07-21 10:00:31 +00:00
kre ba4e23c9ed Remove the notge (I added a day or so ago) about IFS interfering with -s
output (potentially) - it is almost certainly wrong.
2022-06-24 13:11:44 +00:00
uwe 4e8d1a3bc0 stat(1): Fix two more -width. 2022-06-23 23:41:26 +00:00
uwe fc5c743ea0 stat(1): Misc fixes. 2022-06-22 22:41:13 +00:00
wiz 192ee4d07b Use \(em, fix macro usage 2022-06-22 22:25:23 +00:00
wiz 540a4f0552 Remove dot at end of SEE ALSO. 2022-06-22 22:25:08 +00:00
uwe e4c7d7d38d readlink(1): Add italic correction. 2022-06-22 19:27:47 +00:00
uwe b9ad256709 readlink(1): Add missing .El, use non-random .Bl -width 2022-06-22 19:18:17 +00:00
kre 5996912d34 Some corrections to stat to make it more reasonable, and comply with
the man page, in particular, in one of the EXAMPLES it is claimed:

     This example produces output very similar to that from find ... -ls
     (except that find(1) displays the time in a different format, and find(1)
     sometimes adds one or more spaces after the comma in “major,minor” for
     device nodes):

and then uses %9Z in the format, but conveniently does not use a
device file to demonstrate.

If it had, the result would have been:

   8033      0 brw-r-----    1 root              operator                  4,       51 Jun  8 02:44:45 2022 /dev/sd3

Note the spaces which were claimed to exist (sometimes) in find(1) output
but not with stat.   Oops.

Omitting those spaces seems like a good idea, so does using the same
field width for the result in both cases, rather than producing 9 chars
in the ordinary file case, and 19 (2 * 9 + 1) in the device case (for %9Z).

Now we will get:

   8033      0 brw-r-----    1 root              operator             4,51   Jun  8 02:44:45 2022 /dev/sd3

While here, also make the file number (%@) when reading stdin be 0, it is
not the 1st file in the arg list.

Some (very minor) KNF applied at the same time.

In stat.1 make these changes explicit.
2022-06-22 18:20:30 +00:00
kre 14ef4b89e1 Divide stat.1 into stat.1 (now only includes stat(1)) and readlink.1
Apologies to cvs commit purists, but making this division required
line by line reading of the man pages, and I simply could not resist
also correcting some errors, addressing some omissions, improving some
wording ... all at the same time.
2022-06-22 18:02:43 +00:00
rillig c59c199782 stat: fix undefined behavior when calling ctype functions
lint says: warning: argument to 'function from <ctype.h>' must be cast
to 'unsigned char', not to 'unsigned int' [342]
2021-08-27 18:11:07 +00:00
mrg 078f2392b1 avoid a GCC stringop truncate warning. 2020-09-07 00:46:38 +00:00
mrg 80df6cf66d adjust fallthru comment. 2019-10-04 11:12:16 +00:00
mrg 21303c93e9 convert HAVE_GCC == 7 to HAVE_GCC >= 7. 2019-09-29 23:44:58 +00:00
mrg 97ee1e16ff rework the previous to only apply if !HOSTPROG 2019-02-04 10:03:16 +00:00
mrg a5ca97c6e5 apply -Wno-error=implicit-fallthrough on files that have fallthru
comments but are missed by the current checker.
2019-02-04 09:51:47 +00:00
mrg e79f0588d7 avoid a potential buffer truncation. 2019-02-04 08:07:33 +00:00
kre 3777c939b3 Handle the new %f (as an addition to the strftime format - -t arg)
correctly, in particular %%f does not contain the %f format, and like
all strftime conversions, %f can occur more than once (not that it is
likely to happen, but just in case...)
2017-09-21 22:53:19 +00:00
kre 79b3cfa2ed KNF, and since this gets compiled as a tool, avoid C99 declarations. 2017-09-21 18:50:08 +00:00
kre ac205bb2d4 Set the default time format for linux mode (-x) in the correct place,
so it only applies to -x (in particular, not to -s) and only if another
time format has not been explicitly selected (earlier in the arg list).

With luck, this will make lots of tests, which depended upon "stat -s"
actually generating correct sh assignment statements, go back to working again.
2017-09-20 17:45:25 +00:00
wiz 74d5645f3a whitespace fixes, use Xr. 2017-09-20 08:57:02 +00:00
christos c5fdb5719f - add the sticky bits to mode
- fix linux Birth for the havenots
code review via email from @@@
2017-09-20 01:23:37 +00:00
christos 952c61b290 - if st_dev/st_rdev == NODEV print -1 instead of unsigned
- update to the latest linux stat(1) format for -x (kind of)
- add the ability to display nanoseconds, like linux does
- change u_intX_t -> uintX_t
2017-09-19 21:45:28 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
snj fc99b6a4d6 Change some standard exit status text to ".Ex -std"
From Eitan Adler in PR bin/47790.
2014-04-13 01:45:34 +00:00
dsl 44483cabc1 Unset HAVE_DEVNAME for tools build.
config only checks for the symbol in libc, we need the correct prototype.
Which is excluded even on NetBSD (_NETBSD_SOURCE isn't defined in stdlib.h).
2013-01-03 13:28:41 +00:00
wiz c7ee419f37 Bump date for previous. Remove trailing whitespace. 2012-12-03 07:49:21 +00:00
erh 740a124173 Honor the -t option to set the time format when running stat -s.
Document the format used by -s on the man page.
2012-12-02 21:13:07 +00:00
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