Commit Graph

1040 Commits

Author SHA1 Message Date
sin
bb59d2eb34 ls: No need to set errno to zero
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.
2014-12-22 11:28:20 +00:00
Hiltjo Posthuma
32651cb2da ls: getpwuid, getgrgid, use return code of NULL is an error, not errno 2014-12-22 11:28:20 +00:00
Hiltjo Posthuma
3d8d796a95 unexpand: fix eprintf 2014-12-22 10:34:29 +00:00
Hiltjo Posthuma
549669e657 du: fix eprintf parameter 2014-12-22 10:34:29 +00:00
sin
83e94e922e chgrp: Only check errno if getgrnam() fails 2014-12-21 12:14:26 +00:00
sin
09dad0083b Update TODO 2014-12-21 00:01:58 +00:00
Truls Becken
2433bb78cb cut: clean up file loop 2014-12-18 15:17:48 +00:00
sin
f08d798f77 tee: nuke useless free() 2014-12-16 21:12:00 +00:00
sin
153b8428b1 Nuke another freelist() 2014-12-16 21:02:03 +00:00
sin
fb85f99c0a grep: Reuse allocated buffers 2014-12-16 20:21:56 +00:00
sin
7e8fcc1f03 logger: Don't bother freeing buf
There are many more instances of this pattern.
2014-12-16 20:14:40 +00:00
sin
0d7822f866 Don't free the line buffer for each file
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.
2014-12-16 19:49:39 +00:00
sin
a3e4689743 grep: Don't bother free-ing the pattern list 2014-12-16 19:44:16 +00:00
sin
af66a5924e Add minimal cron.1 2014-12-16 11:04:18 +00:00
sin
e296329773 Rename crond to cron 2014-12-16 11:04:07 +00:00
Markus Wichmann
fea48eb229 Fix problem with multi month display spanning a year. 2014-12-16 10:56:13 +00:00
sin
d30ac8d64b Use eprintf() in usage() 2014-12-09 16:32:55 +00:00
sin
669f4b45cd Add crond(1) to README 2014-12-09 16:22:10 +00:00
sin
ab8a11eb93 Cleanup crond(1) a little 2014-12-09 16:19:49 +00:00
sin
8d2c5dd9a3 Import crond from http://git.2f30.org/scron/tree/ 2014-12-09 16:05:38 +00:00
sin
296af80dba Factor out table walk into a separate function 2014-12-09 15:51:21 +00:00
sin
979444a4c9 Forgot .El in cols.1 2014-12-08 15:15:12 +00:00
sin
909ffd5bf7 Update cols manpage 2014-12-08 15:14:08 +00:00
sin
45086e76f9 Remove old comment 2014-12-08 15:01:09 +00:00
sin
c953c022d3 Remove section on minix in README
All tools currently compile except ln(1) which uses the *at()
that do not seem to be implemented.
2014-12-08 14:55:25 +00:00
sin
1059782af8 Fix comparison >= 0 is always true in basename(1) 2014-12-08 12:14:39 +00:00
Michael Forney
e14e0becce cp: Rename -d option to -P
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).
2014-12-08 10:02:56 +00:00
Michael Forney
573ef00c91 ls: Always leave room for the NULL byte in the link target
Otherwise, if the length of the link target is the same as BUFSIZ, we
will try to write past the end of buf.
2014-12-08 10:02:28 +00:00
Michael Forney
46ea55a258 ls: Handle symlinks to directories properly
Also, implement the -H and -L options.
2014-12-08 10:02:09 +00:00
Brandon Mulcahy
c4014b730e Use utflen in cols(1) 2014-12-05 21:41:36 +00:00
Brandon Mulcahy
5214191155 Handle non-power-of-two tab sizes in expand(1) 2014-12-04 22:26:08 +00:00
sin
1150a5cbc9 Update nl(1) manpage 2014-12-04 13:50:15 +00:00
sin
88a6d6f97e State the reason for failure in readlink(1) 2014-12-04 12:14:59 +00:00
sin
761599ae61 nl(1) should handle up to 1 file 2014-12-04 12:05:09 +00:00
sin
86c88d8b3a Respect exit status in nl(1) + some stylistic changes 2014-12-04 12:00:47 +00:00
sin
95c9b4b255 Staticise functions in logger(1) 2014-12-04 11:46:11 +00:00
sin
5d1e46fefa Implement POSIX 2008 compliant logger(1) 2014-12-04 11:36:40 +00:00
Brandon Mulcahy
757cf0651a Fix basename suffix treatment
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.
2014-12-04 08:00:03 +00:00
sin
f141da6190 Bring back OpenBSD make compatibility in Makefile
Thanks @quing
2014-12-01 17:37:44 +00:00
Evan Gates
1bd598c9ed sort BIN, that was bugging me 2014-12-01 17:18:56 +00:00
sin
d13e5c2be3 Remove redundant deletions from clean target 2014-11-30 11:57:38 +00:00
Michael Forney
94ef670b27 ln: Add support for target directories
Also, now that we are using {sym,}linkat, implement the trivial -L and
-P options.
2014-11-23 20:58:15 +00:00
Michael Forney
cb427d553a sort: Implement -c and -C flags 2014-11-23 19:42:14 +00:00
sin
e23d20e1d4 Fix .SH to .Sh in kill.1 2014-11-23 13:22:55 +00:00
sin
6aab51a858 Update kill.1 2014-11-23 13:22:09 +00:00
sin
e514886f0d Update pwd.1 2014-11-23 12:56:19 +00:00
sin
5c9dc1b799 Add note about standards for strings.1 2014-11-23 12:46:24 +00:00
sin
aabcb69991 Respect exit status in strings(1) and update manpage 2014-11-23 12:44:38 +00:00
sin
d0604cc474 Don't stop at first failure in mkfifo(1) 2014-11-22 11:18:21 +00:00
sin
bf8e37625a Fix potential exit status wraparound in chgrp(1) 2014-11-22 11:14:56 +00:00