Commit Graph

20 Commits

Author SHA1 Message Date
FRIGN 9016d288f1 Do not use arg.h for tools which take no flags
We've already seen the issue with echo(1): Before we changed it to
ignore "--", the command

$ echo --

did not work as expected. Given POSIX mandated this and makes most
sense, in the interest of consistency the other tools need to be
streamlined for that as well.
Looking at yes(1) for instance, there's no reason to skip "--" in
the argument list.
We do not have long options like GNU does and there's no reason to
tinker with that here.

The majority of tools changed are ones taking lists of arguments
or only a single one. There's no reason why dirname should "fail"
on "--". In the end, this is a valid name.

The practice of hand-holding the user was established with the GNU
coreutils. "--help" and "--version" long-options are a disgrace to
what could've been done properly with manpages.
2015-04-25 11:43:14 +01:00
FRIGN 6f207dac5f Don't return but _exit after failed exec*() and fork()
Quoting POSIX[0]:
"Care should be taken, also, to call _exit() rather than exit() if exec cannot be used, since
exit() flushes and closes standard I/O channels, thereby damaging the parent process' standard
I/O data structures. (Even with fork(), it is wrong to call exit(), since buffered data would
then be flushed twice.)"

[0]: http://pubs.opengroup.org/onlinepubs/009695399/functions/vfork.html
2015-03-09 01:12:59 +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 bcf264f9cd Finish up chroot(1) and md5sum(1) 2015-01-31 23:54:51 +01:00
FRIGN 1436518f9d Use < 0 instead of == -1 2014-11-19 20:09:29 +00:00
sin de4a36957e Silence stupid warnings when building sbase-box 2014-11-17 10:52:24 +00:00
FRIGN eee98ed3a4 Fix coding style
It was about damn time. Consistency is very important in such a
big codebase.
2014-11-13 18:08:43 +00:00
sin 9f6dd58538 Remove unneeded statement 2014-11-13 14:56:43 +00:00
sin 0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
Hiltjo Posthuma 953ebf3573 code style
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:30 +01:00
dwts 575b38391c keep usage definition above main 2014-04-22 13:46:33 +01:00
sin 02d91696b4 Fix char **argv to char *argv[] 2014-04-18 11:54:44 +01:00
sin 43b472601d Return proper error values in case execvp() fails 2014-02-13 13:09:00 +00:00
sin 79a913f4e6 We can't use eprintf etc. without using the arg.h macros. 2014-02-13 13:08:54 +00:00
sin 5b5f062184 Add license file details at top of files 2013-10-07 17:03:34 +01:00
sin b5a511dacf Exit with EXIT_SUCCESS/EXIT_FAILURE instead of 0 and 1
Fixed for consistency purposes.
2013-10-07 16:44:22 +01:00
sin 4b30e39348 Fix warning in chroot(1)
chroot.c:12:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  if(aux = getenv("SHELL"))
  ^
2013-10-06 20:35:30 +01:00
Roberto E. Vargas Caballero 5e9c4d781b Avoid double call to getenv in chroot 2013-10-05 16:24:47 +02:00
David Galos 9f8deb4b23 Tar compiles on BSD, thanks Roberto E. Vargas Caballero. Also remove tons of trailing whitespace. 2013-07-20 01:27:42 -04:00
Christoph Lohmann 9df408f8c6 Adding who, chroot, env and split.
Thanks "Galos, David" <galosd83@students.rowan.edu>!
2013-06-14 18:55:25 +02:00