annotate toys/yes.c @ 186:25447caf1b4b

Change command main() functions to return void, and exit(toys.exitval) from the toybox infrastructure instead. Eliminates a return call from each command.
author Rob Landley <rob@landley.net>
date Thu, 29 Nov 2007 18:14:37 -0600
parents bb6048c923ec
children 30a6db5a95c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
74
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 /* vi: set sw=4 ts=4: */
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 /*
151
bb6048c923ec Add or correct file descriptions
Charlie Shepherd <masterdriverz@gentoo.org>
parents: 74
diff changeset
3 * yes.c - Repeatedly output a string.
74
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 */
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
5
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 #include "toys.h"
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
7
186
25447caf1b4b Change command main() functions to return void, and exit(toys.exitval) from
Rob Landley <rob@landley.net>
parents: 151
diff changeset
8 void yes_main(void)
74
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 {
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 for (;;) {
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 int i;
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
12 for (i=0; toys.optargs[i]; i++) {
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 if (i) xputc(' ');
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 xprintf("%s", toys.optargs[i]);
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 }
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 if (!i) xputc('y');
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 xputc('\n');
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
18 }
dfe99495acbc Add "yes" command.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 }