sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit a8ef54bae11a3d63d2f4f1fbc488af6416644a5d
parent 3a3cd240920e9fef6a3c5c07521f71368c2e69ed
Author: sin <sin@2f30.org>
Date:   Sat,  5 Oct 2013 15:04:50 +0100

Simplify yes(1)

Just pick the first argument if multiple are provided.

Diffstat:
yes.c | 15++-------------
1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/yes.c b/yes.c @@ -8,24 +8,13 @@ static void usage(void); int main(int argc, char *argv[]) { - char *s = "y"; - ARGBEGIN { default: usage(); } ARGEND; - switch(argc) { - case 1: - s = argv[0]; - /* fallthrough */ - case 0: - for(;;) - puts(s); - break; - default: - usage(); - } + for (;;) + puts(argc >= 1 ? argv[0] : "y"); return EXIT_FAILURE; /* should not reach */ }