Commit Graph

177 Commits

Author SHA1 Message Date
FRIGN b12041365d Audit expand(1)
Not much to do here. Forgot a colon in the manpage and some style-
changes in the code.
2015-03-13 00:38:29 +01:00
FRIGN c4e0080bbf Mark du(1) as audited in README 2015-03-11 23:31:26 +01:00
FRIGN 00ca97b279 Mark cut(1) and cron(1) as audited in README
I finished auditing cut(1) a few minutes ago, and cron(1) is an
upstream project which needs to be taken care of upstream (sin's call).
2015-03-11 17:33:08 +01:00
FRIGN f1a1b7f994 Mark comm(1) as audited in README 2015-03-11 13:47:33 +01:00
FRIGN 695153ac18 Audit cmp(1)
1) Remove the return-value-enum, which is not necessary for a simple
   program like this.
2) Don't disallow both l and s to be specified. This is undefined
   behaviour defined by POSIX, so we don't start demanding things
   from the user.
3) Replace exit() with return (we are in main).
4) Refactor main loop to never return in the loop, but actually
   set the same-value and break, which increases readability.
5) Remove the final fclose()'s. The OS will take care of them, no
   need to become cleansy here.
6) Use idiomatic return-value using same. This concludes the
   increase of readability in the main-loop.
2015-03-11 11:16:40 +01:00
FRIGN d6818a3c5f Audit cksum(1)
1) Reorder local variables.
2) Cleanup error messages, use %zu for size_t.
3) combine putchar(' ') and fputs to substitute printf(" %s", s).
4) Fix usage().
5) argv-argc-usage-fix.
6) Add empty line before return.
2015-03-11 00:13:48 +01:00
Quentin Rameau 82bebf8ce7 nl: add -l option 2015-03-10 12:55:06 +00:00
FRIGN 3a04302c66 Audit chown(1)
Similar to the chgrp(1)-audit:
1) Refactor manpage so it's actually fun to read
2) BUGFIX: Call (l)chown properly when the H-flag is specified
   (only when depth > 0)
3) BUGFIX: Call (l)chown properly when the h-flag is specified
   (only when depth = 0).
4) BUGFIX: Only recurse() in chgrp() when the initial chownf()
   succeeds.
5) Style fixes, argv-basing.
6) Rename status to ret for consistency.
7) Add blank line before return.
2015-03-09 00:42:23 +01:00
FRIGN fba669da88 Audit chgrp(1)
1) Refactor manpage so it's actually fun to read.
2) BUGFIX: Call (l)chown properly when the H-flag is specified
   (only when depth > 0).
3) BUGFIX: Call (l)chown properly when the h-flag is specified
   (only when depth = 0).
4) BUGFIX: Only recurse() in chgrp() when the initial chownf()
   succeeds.
5) Style fixes, argv-basing.
6) Rename status to ret for consistency.
7) Add blank line before return.
2015-03-08 23:31:59 +01:00
FRIGN 76ad86b2a3 Audit cal(1)
1) Update manpage with the num-syntax.
2) Use size_t for years and derivatives.
3) Use putchar instead of printf wherever possible.
4) Update usage().
5) Style changes.
2015-03-08 21:28:32 +01:00
FRIGN f140403fca Audit cols(1)
1) Refactor manpage.
2) De-globalize local values.
3) update usage().
4) sort local variable declarations.
5) fix wrong argument in strtonum (3 -> 1).
6) argc-argv style, boolean style.
7) check bytes > 0 before accessing b.lines[i][bytes - 1]
   relying on len only makes sense but let's not push it.
7) don't break on maxlen > (chars - 1) / 2. This didn't even
   make sense.
8) _correctly_ calculate cols and rows in a readable way.
9) Rewrite loop over rows and cols in a readable way and
   using putchar in a loop instead of printf-magic or fputs
   where not necessary.
2015-03-08 19:49:59 +01:00
FRIGN 0c2f19c210 Audit logger(1)
1) Update manpage to current style
2) Line spacing
3) Local variable grouping
4) check for getline >= 0 instead of != -1
5) error message cleanup
2015-03-07 00:10:22 +01:00
FRIGN ab26b5583e Audit ln(1)
1) Clarify behaviour when the f-flag is given and a target is in its
   own way.
2) Fix usage()-style.
3) Group local variable declarations.
4) reorder args
5) argc style, other boolean style changes
6) improve error messages
7) set argv[argc - 1] to NULL to allow argv-centric loop later
8) BUGFIX: POSIX specifies that when with the f-flag there's a
   situation where a file stands in its own way for linking it
   should be ignored.
9) Add weprintf() where possible, so we don't pussy out when there's
   a small issue. This is sbase ffs!
2015-03-05 21:14:43 +01:00
FRIGN aea256c288 Audit chmod(1)
1) Update manpage, refactor the HLP-section and other wordings.
2) BUGFIX: If chmod() fails, don't recurse.
3) Rewrite the arg-loop, fixing several issues:
   BUGFIX: Handle multi-flags (e.g. -RH)
   BUGFIX: Properly handle the termination flag --, error on e.g. --x
   BUGFIX: Error out on an empty flag -.
4) Refactor logic after the arg-loop, which is now simpler thanks
   to argv-incremention.
2015-03-05 19:08:28 +01:00
FRIGN d9fa4b3ae7 Audit mkdir(1)
1) No need for strchr() in mkdirp or a while-loop. Rewrite it in
   a sane and readable way.
2) fix usage according to the manpage.
3) order includes, don't align local variables.
4) argc-style-fix.
5) BUGFIX: Don't try to chmod() *argv when mkdir() / mkdirp() failed.
6) Add newline before return in two places.
2015-03-05 18:03:08 +01:00
FRIGN 38066de8c2 Audit head(1)
1) Use (s)size_t in head().
2) BUGFIX: only check buf[len - 1] when len > 0, else there would
   be an overflow when getline returns 0 (which can happen) and a
   very potential segmentation fault.
3) fix error-messages.
4) update usage().
5) argv-argc-style.
6) clear up the main loop with if (newline).
7) add newline before return.
2015-03-05 01:01:52 +01:00
FRIGN 68aa324713 Mark uname(1) as audited in README
No changes needed.
2015-03-05 00:33:28 +01:00
FRIGN 6cdae700c9 Mark time(1) as finished and audited in README 2015-03-05 00:29:03 +01:00
FRIGN 109f6b5a60 Audit mv(1)
1) Make argument-naming consistent with other tools (cp(1), ...)
2) style fixes
3) usage() fix
4) BUGFIX: Probably from the old non-arg.h days, the directory-
   check was only done when argc > 3, but with arg.h, this ignores
   the case when 3 arguments were given.
   This is actually a pretty serious issue and I'm glad it's fixed.
5) Moreover, be more verbose when stat() fails and make it clearer
   what the hell is going on at this checkpoint.
2015-03-04 23:22:43 +01:00
FRIGN aaac1c8800 Audit tee(1)
1) "duplicate" implies that you can only specify two outputs,
   "multiply" is a better word describing the functionality.
2) fix other wording in the manpage
3) fix usage()
4) reorder local variables
5) fix sizeof() style
6) we need argv later, don't increment argv and rather iterate
   over argc.
7) Improve error messages, print the filename which the write
   failed to instead of printing the buffer itself (how much
   sense does that make, printing 1024 Bytes of garbage?).
   Also, give the name of the function which failed.
2015-03-04 23:05:11 +01:00
FRIGN a6ee96af7c Audit nohup(1)
1) no need to include sys/stat.h
2) remove the enum which just added a layer too thick on this simple
   program
3) argc-style, other style
4) weprintf instead of enprintf, then save the error-message of
   execvp before and return the proper status.
5) write consistent "not reached" comment.
2015-03-04 22:39:12 +01:00
FRIGN 7cb966c170 Audit pwd(1)
Nothing special
1) Update manpage to current style.
2) Reorder functions
3) Logical trickery in getpwd()
2015-03-03 17:24:14 +01:00
Roberto E. Vargas Caballero 443de0a859 Add col command
col is used to display troff documents in ttys, removing the reverse
line feeds generated by .2C in ms. This implementation keeps the limit
of 256 lines of 800 characteres of the original implementation.
2015-03-03 13:35:42 +00:00
FRIGN 274e86e1aa Audit cp(1)
1) Refactor the manpage, which has been a bloody mess, documenting
   fantasy-flags (-d for example) and add a STANDARDS section
2) fix usage()
3) sort ARG-block
4) Check return-value of stat() separately, so a lack of permissions
   doesn't tell the user "the directory doesn't exist", which could
   be a bit confusing.
5) Add empty line before return.
2015-03-02 19:15:19 +01:00
FRIGN eb137b9e42 Audit chroot(1)
1) Fix usage()
2) Rename *p to *cmd
3) _exit trick with 126 + (savederrno == ENOENT)
4) return-style-fix
2015-03-02 17:46:45 +01:00
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