aboutsummaryrefslogtreecommitdiff
path: root/toys/which.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-11-19 02:49:22 -0500
committerRob Landley <rob@landley.net>2006-11-19 02:49:22 -0500
commit8324b89598b2aee0957a0378f0f63ff5755498be (patch)
tree6958c34834147ab29607a8e67aca2b05a751f2ee /toys/which.c
parentb29ceb8bd0f99134fe215eebc531dbcd7717e8ae (diff)
downloadtoybox-8324b89598b2aee0957a0378f0f63ff5755498be.tar.gz
New option parsing infrastructure (doesn't use getopt). Hook it up to
existing applets. Still a bit buggy, but bits of it work.
Diffstat (limited to 'toys/which.c')
-rw-r--r--toys/which.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/toys/which.c b/toys/which.c
index 6d00bc82..16e19d00 100644
--- a/toys/which.c
+++ b/toys/which.c
@@ -7,7 +7,6 @@
#include "toys.h"
-#define OPTIONS "a"
#define OPT_a 1
// Find an exectuable file either at a path with a slash in it (absolute or
@@ -55,16 +54,12 @@ static int which_in_path(char *filename)
int which_main(void)
{
- char **argv;
int rc = 0;
- // get_optflags(OPTIONS);
- argv = toys.argv+1;
-
- if (!*argv) rc++;
+ if (!*toys.optargs) rc++;
else {
int i;
- for (i=0; argv[i]; i++) rc |= which_in_path(argv[i]);
+ for (i=0; toys.optargs[i]; i++) rc |= which_in_path(toys.optargs[i]);
}
// if (CFG_TOYS_FREE) free(argv);