From b841cd2f8c1b378c1e8d73f5915662b8e79aac80 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 1 Jun 2007 13:41:24 -0400 Subject: Allow applets with optarg string NULL to use toy.optargs[]. --- toys/toysh.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toys') diff --git a/toys/toysh.c b/toys/toysh.c index ef061bde..a42d361a 100644 --- a/toys/toysh.c +++ b/toys/toysh.c @@ -184,14 +184,14 @@ static void handle(char *command) int cd_main(void) { - char *dest = toys.argv[1] ? toys.argv[1]: getenv("HOME"); + char *dest = *toys.optargs ? *toys.optargs : getenv("HOME"); if (chdir(dest)) error_exit("chdir %s",dest); return 0; } int exit_main(void) { - exit(toys.argv[1] ? atoi(toys.argv[1]) : 0); + exit(*toys.optargs ? atoi(*toys.optargs) : 0); } int toysh_main(void) @@ -203,7 +203,7 @@ int toysh_main(void) if (CFG_TOYSH_TTY) { if (isatty(0)) toys.optflags |= 1; } - f = toys.argv[1] ? xfopen(toys.argv[1], "r") : NULL; + f = *toys.optargs ? xfopen(*toys.optargs, "r") : NULL; if (command) handle(command); else { unsigned cmdlen=0; -- cgit v1.2.3