| #
1.7 |
|
03-May-2025 |
kre |
Make readlink(1) compliant with the POSIX-2004 (Issue 8).
POSIX 2004 requires that if a given file name to readlink(1) doesn't refer to a symlink, an error be printed.
That conflicts with historic usage on NetBSD where readlink is silent in that case (except for the exit status) -- rather than altering our default behaviour, look for POSIXLY_CORRECT in the environment, and issue an error only in that case (just means switching between -q and -v as the default noise option).
While here, generate usage if no file args are given - POSIX requires at least 1 (it actually specifies exactly 1) and while we can extend that without issues to allow more than one, allowing 0 args (just because we do that for stat(1) and readlink(1) is the same code) makes no sense at all for readlink - stdin cannot possibly be a symbolic link.
Also, in the case of stat(1) if we do have no args, and the fstat(STDIN) fails for some reason, don't claim that it is lstat (or stat, depending upon -L) which failed: stat: (stdin): lstat: Bad file descriptor makes no sense at all. This can occur with something like stat <&- which is kind of obscure, but it is easy to DTRT.
No pullups planned.
|
| #
1.1 |
|
22-Jun-2022 |
kre |
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.
|