Commit Graph

1598 Commits

Author SHA1 Message Date
sin
1f3345b9e6 Staticise some symbols in tr(1) 2015-01-10 14:26:32 +00:00
FRIGN
a582cb8a2f Rewrite tr(1) in a sane way
tr(1) always used to be a saddening part of sbase, which was
inherently broken and crufted.
But to be fair, the POSIX-standard doesn't make it very simple.
Given the current version was unfixable and broken by design, I
sat down and rewrote tr(1) very close to the concept of set theory
and the POSIX-standard with a few exceptions:

 - UTF-8: not allowed in POSIX, but in my opinion a must. This
          finally allows you to work with UTF-8 streams without
          problems or unexpected behaviour.
 - Equivalence classes: Left out, even GNU coreutils ignore them
                        and depending on LC_COLLATE, which sucks.
 - Character classes: No experiments or environment-variable-trickery.
                      Just plain definitions derived from the POSIX-
                      standard, working as expected.

I tested this thoroughly, but expect problems to show up in some
way given the wide range of input this program has to handle.
The only thing left on the TODO is to add support for literal
expressions ('\n', '\t', '\001', ...) and probably rethinking
the way [_*n] is unnecessarily restricted to string2.
2015-01-10 14:26:30 +00:00
Greg Reagle
83616df6fc cal: Removed unused "day" variable 2015-01-07 03:21:12 +00:00
Greg Reagle
c6f1e8aa20 Various cal(1) improvements
1) No limit on number of months (removed MONTHMAX)
2) Strings printed to stdout rather than copied to an internal buffer
3) Rewritten date calculation algorithms
2015-01-02 13:14:41 +00:00
sin
6faeb36e14 Update LICENSE 2014-12-31 22:02:07 +00:00
sin
5467beec34 Add Adria to LICENSE 2014-12-23 18:09:23 +00:00
sin
58d64d5298 Add Brandon to LICENSE 2014-12-23 18:04:07 +00:00
sin
4af15bae9f Update LICENSE to have a separate section for authors/contributors
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.
2014-12-23 17:59:53 +00:00
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