Commit Graph

152 Commits

Author SHA1 Message Date
FRIGN
520d87e58e Audit mkfifo(1)
1) Fix usage()
2) Group local variables
3) Idiomatic argv-loop
4) BUGFIX: When the m-flag is specified, POSIX clearly says:
   "Set the file permission bits of the newly-created FIFO to the specified mode
   value."
   This means, that if mkfifo() fails for some reason, it should not try to
   chmod() the given path (which has been fixed with the "else if")
   A simple testcase is:

   $ touch testfile; mkfifo -m 000 testfile;

   GNU mkfifo(1): ls -l testfile
   -rw-r--r-- 1 testfile

   sbase mkfifo(1): ls -l testfile
   ---------- 1 testfile
5) Add blank line before return
2015-03-02 17:25:29 +01:00
FRIGN
c01641c897 Audit nice(1)
1) val is sufficient as "int" (read the standard)
2) BUGFIX: If getpriority fails, it returns -1 and sets errno.
   Previously, it would correctly catch the errno but not take
   care of the fact that by then val has been decremented by 1.
   Only change val if the getpriority-call has been successful.
3) Add LIMIT()-macro from st to increase readability.
4) setpriority returns < 0 on failure
5) Remove bikeshedding-comment. Read the standard if you wonder.
6) return-value trick from env(1)
2015-03-02 16:53:13 +01:00
FRIGN
6c3ba4c4c7 Audit rmdir(1)
1) style fix (don't arrange local variables)
2) BUGFIX: Previously, if ret was turned 1 for some folder, it
   would disable the p-flag for every following folders, which
   is not desired.
   Instead, the "else if" makes sure that the p-flag-section is
   only entered when the initial rmdir succeeds.
3) BUGFIX: Previously, the program would cancel with eprintf if
   it failed to remove one folder in the parent-pathname.
   This is not desired, as we have other folders pending.
   Instead, print a warning for the current failing parent-folder,
   set ret to 1 and break off the loop at this point.
   This allows to finish the other pending folders without issues.
2015-03-02 15:39:39 +01:00
FRIGN
e50ee15a9c Audit date(1)
1) Update usage as already done in the manpage
2) group and sort local variable declarations
3) Be pedantic about the number of options. Don't just ignore it
   if argc > 1.
2015-03-02 15:12:19 +01:00
FRIGN
27656a0cbc Audit env(1)
1) Shorten synopsis and reflect this in the manual
2) Use argv0 in usage()
3) Decrement argc in argv-loop for consistency
4) Make it clearer which error-code results from which errno in enprintf
5) Use idiomatic for-loop also for environ. Don't increment these pointers
   in the loop itself!
2015-03-02 14:53:24 +01:00
FRIGN
d806f75cb6 Audit cat(1)
1) Fix usage ... spacing
2) use *argv instead of argv[0] in the idiomatic for-loop
3) Stop the naïve usage of "/dev/fd/0" and use plain stdin
   instead (This also makes error-messages more consistent).
4) Add newline before return
5) Remove comma in manpage
2015-03-02 00:39:26 +01:00
FRIGN
7afc84396a Audit setsid(1)
Nothing special, just a small style-fix.
2015-03-02 00:20:35 +01:00
FRIGN
80d89c400f Audit sponge(1)
Just a little usage()-fix. Mark it as audited in README.
2015-03-01 23:42:16 +01:00
FRIGN
0c9b52ef9b Update *sum(1)-manpages and mark them as finished and audited
Now that -c behaves correctly, the tools are pretty much done.
Only the manpages were not clear enough what happens when you
specify the c-flag.
This is fixed now.
2015-03-01 22:59:20 +01:00
FRIGN
0226c05105 Audit printenv(1)
1) argc style
2) safeguard argv-loop as already seen in echo(1) with argc-decrement.
2015-02-28 21:47:17 +01:00
FRIGN
6f715d8c6d Audit rm(1)
1) One small argc-style-matter
2) manpage cleanup
3) NOTE: The utility-functions will be evaluated separately.
2015-02-28 21:31:23 +01:00
FRIGN
80a394139a Audit hostname(1)
1) Be strict about argc
2) Fix a small error in the manpage
2015-02-28 21:22:55 +01:00
FRIGN
f20075b0bc Mark yes(1) as audited in README 2015-02-28 21:12:27 +01:00
FRIGN
bf3210b6de Audit echo(1)
Just a small change in the manpage.
2015-02-28 20:16:10 +01:00
FRIGN
e00fe1f9bf Audit sleep(1)
1) Be strict about argc
2) Use "unsigned" instead of "unsigned int"
2015-02-28 20:10:25 +01:00
FRIGN
39b9aab25a Audit unlink(1)
One small thing, use argv0 in usage.
Also, add a blank line in link.c which I forgot earlier.
2015-02-28 20:05:22 +01:00
FRIGN
b9b28d4039 Audit tty(1)
1) Be strict about number of arguments passed
2) Use a simpler logic while returning
2015-02-28 19:59:34 +01:00
FRIGN
e45297a320 Audit dirname(1)
Be stricter about the number of arguments passed to it.
2015-02-28 19:51:07 +01:00
FRIGN
cb610b2c7b Audit link(1) 2015-02-28 19:42:56 +01:00
Hiltjo Posthuma
3068ea2318 README: document sbase-box-install rule 2015-02-28 15:40:16 +01:00
sin
7ee3569327 Update README for time(1) 2015-02-28 14:42:11 +00:00
FRIGN
65ae4afa7c Mark false(1) and true(1) as audited
Nothing to be done there.
2015-02-28 15:12:19 +01:00
FRIGN
e7c33c4af3 Audit basename(1)
1) be stricter which number of arguments is accepted (1 or 2)
2) basename already returns a pointer to "." is argv[0] is ""
3) No need to check for *p != '/', because basename() only returns
   a string beginning with '/' which has length 1, so if strlen(p)
   == 1, the only way for suffix to be "evaluated" is for off to
   be > 0, being equal to suffix being "", but "" != "/".
4) don't calculate strlen twice for each string. Store it in a
   ssize_t and check if it's > 0.
2015-02-28 14:48:44 +01:00
FRIGN
44bd931834 Add audit-section to README
Okay, so why another section?
The finished-section applies to general feature-completeness and
manual status. It somehow is not an indicator for general code-
clarity, so the audited-column reflects a thorough audit of the
underlying code and optimization.
Take a look at the upcoming basename(1)-patch for an example on
how this goes.
2015-02-28 14:42:26 +01:00
Evan Gates
5c8d5c1dca add time. do not mark complete/POSIX compliant as exit status is wrong. 2015-02-27 21:39:50 +00:00
Evan Gates
bf4c5d1fcd expr comments, cleanup, UTF-8 support 2015-02-26 17:26:47 +00:00
Quentin Rameau
7264acf7ed ls: add -n option 2015-02-22 12:30:47 +00:00
Tai Chi Minh Ralph Eastwood
0eaff8b7fe Update README for ls -R 2015-02-21 11:46:04 +00:00
sin
9c30fbf018 Add ls -A implementation
Thanks joshua@cubesolving.com!
2015-02-21 09:31:01 +00:00
Evan Gates
3751dd546f no need for libutf in test, a null byte is a null byte 2015-02-20 19:29:28 +00:00
sin
cd51795423 Implement nl -n format 2015-02-20 14:12:48 +00:00
sin
9de3546082 Implement nl -w width 2015-02-20 12:15:43 +00:00
sin
13e4231f4c Implement nl -v startnum 2015-02-20 12:05:54 +00:00
Evan Gates
76e6aacd60 Add initial find(1) implementation
No manpage yet.
2015-02-20 10:17:16 +00:00
Quentin Rameau
51b707e91e ls: add support for -p 2015-02-19 18:52:13 +00:00
FRIGN
b00a00703f Add proper d- and t-flag support to touch(1)
except the [,frac], [.frac] respectively, but that's ok.
2015-02-19 18:54:56 +01:00
sin
737e805505 touch -t is also unwanted 2015-02-19 15:28:05 +00:00
sin
32791d3ca7 Mark touch -d as unwanted in the README 2015-02-19 15:27:03 +00:00
Quentin Rameau
bf5f6a08a4 README: added options for date, ls, touch 2015-02-19 14:45:13 +00:00
sin
2137dfa334 Mark du(1) as finished in README 2015-02-18 20:43:46 +00:00
sin
14b95b5f53 Mark du -x as done in the README 2015-02-18 20:41:37 +00:00
sin
2a3f82a5cd Implement -u support for ls(1) 2015-02-18 16:29:46 +00:00
FRIGN
6b719faade Add q-flag to ls(1)
of course, UTF-8-aware. ;)
2015-02-17 18:59:01 +01:00
FRIGN
e5b5497773 Add UTF-8-support to strings(1), add t-flag and refactor code
Previously, the string-length was limited to BUFSIZ, which is an
obvious deficiency.
Now the buffer only needs to be as long as the user specifies the
minimal string length.
I added UTF-8-support, because that's how POSIX wants it and there
are cases where you need this. It doesn't add ELF-barf compared to
the previous implementation.
The t-flag is also pretty important for POSIX-compliance, so I added
it.
The only trouble previously was the a-flag, but given that POSIX
leaves undefined what the a-flag actually does, we set it as default
and don't care about parsing ELF-headers, which has already
turned out to be a security issue in GNU coreutils[0].

[0]: http://lcamtuf.blogspot.ro/2014/10/psa-dont-run-strings-on-untrusted-files.html
2015-02-17 17:04:36 +01:00
sin
d8a89002d3 strings: Add -n len support 2015-02-17 13:46:48 +00:00
sin
8ce6d7091a strings: Default to -a 2015-02-17 13:40:36 +00:00
Tai Chi Minh Ralph Eastwood
7a5c4e3a29 Update README for chown, chgrp -H -L -P 2015-02-16 15:54:00 +00:00
FRIGN
bafd41e1cf Add printf(1)
This is a particularly interesting program.
I managed to implement everything according to POSIX except how
octal escapes are specified in the standard, which is yet another
format compared to the one demanded for tr(1).
This not only confuses people, it also adds unnecessary cruft
for no real gain.
So in order to be able to use unescape() easily and for consistency,
I used our initial format \o[oo] instead of \0[ooo].

Marked as optional is UTF-8 support for %c in the POSIX specification.
Given how well-developed libutf has become, doing this here was more
or less trivial, putting us yet again ahead of the competition.
2015-02-15 14:46:58 +01:00
sin
9f1f8d5dd8 Update uuencode manpage and mark as complete in README 2015-02-13 11:38:52 +00:00
sin
e8cd6947ec Update uudecode manpage and mark as complete 2015-02-13 11:30:55 +00:00