Commit Graph

12 Commits

Author SHA1 Message Date
FRIGN
286df29e7d Make already audited tools argv-centric instead of argc-centric
This has already been suggested by Evan Gates <evan.gates@gmail.com>
and he's totally right about it.
So, what's the problem?
I wrote a testing program asshole.c with

int
main(void)
{
        execl("/path/to/sbase/echo", "echo", "test");
        return 0;
}

and checked the results with glibc and musl. Note that the
sentinel NULL is missing from the end of the argument list.
glibc calculates an argc of 5, musl 4 (instead of 2) and thus
mess up things anyway.
The powerful arg.h also focuses on argv instead of argc as well,
but ignoring argc completely is also the wrong way to go.
Instead, a more idiomatic approach is to check *argv only and
decrement argc on the go.
While at it, I rewrote yes(1) in an argv-centric way as well.

All audited tools have been "fixed" and each following audited
tool will receive the same treatment.
2015-03-02 14:19:26 +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
sin
0dcf33a1df Style fix 2014-11-16 13:17:06 +00:00
sin
b200a6e75f Set exit status accordingly in printenv(1) 2014-11-16 13:14:13 +00:00
sin
3fa0a358b1 Fix completely broken printenv(1) 2014-11-16 13:11:35 +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
0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
sin
02d91696b4 Fix char **argv to char *argv[] 2014-04-18 11:54:44 +01:00
sin
f349dd5987 Use arg.h as much as possible and add usage() where missing
Rename eusage() to usage() as well.
2013-10-07 17:13:01 +01: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
Christoph Lohmann
b0898c605d Adding the new C files too. 2013-06-09 15:20:55 +02:00