The list is getting too long. Leave the maintainers at the top
and add a section of authors/contributors below the license statement.
Helps maintain the license at the top of the file.
Consider the following code:
pw = getpwuid(uid);
if (!pw) {
if (errno)
...
else
...
}
If the entry was not found then as per POSIX errno is not set
because that is not considered to be a failing condition. errno
is only set if an internal error occurred.
If errno happened to be non-zero before the getpwuid() call
because of a previous error then we'll report a bogus error.
In this case, we have to set errno to zero before the call to
getpwuid().
However in ls(1) we only really care if the password entry was found
and we do not report any errors so setting errno to 0 is not necessary.
There's no point free-ing memory when the kernel can do it for us.
Just reuse the already allocated memory to hold lines.
Thanks Truls Becken for pointing this out.
The -d option is a GNU extension and is equivalent to its "-P
--preserve=links" options.
Since we don't implement the --preserve=links functionality anyway (it
means preserve hard links between files), just call it -P, which is
specified by POSIX.
Additionally, there is no need to check for cp_Pflag again before
copying the symlink itself because the only way the mode in the stat
will indicate a symlink is if we used lstat (which we only do if -P is
specified).
Explicitly use "." instead of the result of basename(3) when argv[0] is
an empty string in order to avoid a segfault.
Skip suffix treatment if the result of basename(3) is "/", per POSIX.
Fix the suffix check, which was previously checking for a match at any
location in the string.