aboutsummaryrefslogtreecommitdiff
path: root/toys/which.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-11-29 18:14:37 -0600
committerRob Landley <rob@landley.net>2007-11-29 18:14:37 -0600
commitefda21ca931766eed6cfc49d1b2122c53827d9fc (patch)
tree16453d708a1b0fc6b325ada99bbe72cbaab7148b /toys/which.c
parent7634b55f27ad483ec634ba9defac93872e3a329f (diff)
downloadtoybox-efda21ca931766eed6cfc49d1b2122c53827d9fc.tar.gz
Change command main() functions to return void, and exit(toys.exitval) from
the toybox infrastructure instead. Eliminates a return call from each command.
Diffstat (limited to 'toys/which.c')
-rw-r--r--toys/which.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/toys/which.c b/toys/which.c
index 546bdcca..c01f3bb3 100644
--- a/toys/which.c
+++ b/toys/which.c
@@ -52,16 +52,12 @@ static int which_in_path(char *filename)
return 0;
}
-int which_main(void)
+void which_main(void)
{
- int rc = 0;
-
- if (!*toys.optargs) rc++;
+ if (!*toys.optargs) toys.exitval++;
else {
int i;
- for (i=0; toys.optargs[i]; i++) rc |= which_in_path(toys.optargs[i]);
+ for (i=0; toys.optargs[i]; i++)
+ toys.exitval |= which_in_path(toys.optargs[i]);
}
- // if (CFG_TOYBOX_FREE) free(argv);
-
- return rc;
}