aboutsummaryrefslogtreecommitdiff
path: root/lib/args.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-10-11 15:36:36 -0500
committerRob Landley <rob@landley.net>2007-10-11 15:36:36 -0500
commitd06c58df5c723594c4f214dd5d1842a178d2a5e1 (patch)
tree82d61cb9ff7de99de7702e6f8d7cf5d4ecca7bed /lib/args.c
parent103b7e031c4de0f9753e02d2217aa81819242278 (diff)
downloadtoybox-d06c58df5c723594c4f214dd5d1842a178d2a5e1.tar.gz
Promote help to global config option, teach error_exit() to output usage message when called
from get_optflags().
Diffstat (limited to 'lib/args.c')
-rw-r--r--lib/args.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/args.c b/lib/args.c
index 95643c3e..542b8cf0 100644
--- a/lib/args.c
+++ b/lib/args.c
@@ -133,6 +133,7 @@ void get_optflags(void)
long *nextarg = (long *)&toy;
char *options = toys.which->options;
+ if (CFG_HELP) toys.exithelp++;
// Allocate memory for optargs
maxargs = 0;
while (toys.argv[maxargs++]);
@@ -300,6 +301,7 @@ notflag:
error_exit("Need %d argument%s", minargs, minargs ? "s" : "");
if (optarg>maxargs)
error_exit("Max %d argument%s", maxargs, maxargs ? "s" : "");
+ if (CFG_HELP) toys.exithelp = 0;
}
// Loop through files listed on the command line