Mercurial > hg > toybox
comparison toys/which.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 |
comparison
equal
deleted
inserted
replaced
185:29e2051296fd | 186:25447caf1b4b |
---|---|
50 } | 50 } |
51 | 51 |
52 return 0; | 52 return 0; |
53 } | 53 } |
54 | 54 |
55 int which_main(void) | 55 void which_main(void) |
56 { | 56 { |
57 int rc = 0; | 57 if (!*toys.optargs) toys.exitval++; |
58 | |
59 if (!*toys.optargs) rc++; | |
60 else { | 58 else { |
61 int i; | 59 int i; |
62 for (i=0; toys.optargs[i]; i++) rc |= which_in_path(toys.optargs[i]); | 60 for (i=0; toys.optargs[i]; i++) |
61 toys.exitval |= which_in_path(toys.optargs[i]); | |
63 } | 62 } |
64 // if (CFG_TOYBOX_FREE) free(argv); | |
65 | |
66 return rc; | |
67 } | 63 } |