aboutsummaryrefslogtreecommitdiff
path: root/toys/other/hello.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-12-19 21:38:12 -0600
committerRob Landley <rob@landley.net>2013-12-19 21:38:12 -0600
commit6db8529a785e2cab142e840b6e3fbdcc2c02dd1f (patch)
treee22a0b2025f7848f05bcd4f5ed22b57956ef84ea /toys/other/hello.c
parentbb5cfb270f924390c2163573cc5ed8fba9f638b8 (diff)
downloadtoybox-6db8529a785e2cab142e840b6e3fbdcc2c02dd1f.tar.gz
Don't permute toys.optargs, cleanup code (xexec()) can free it.
Diffstat (limited to 'toys/other/hello.c')
-rw-r--r--toys/other/hello.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/toys/other/hello.c b/toys/other/hello.c
index e87cd6c9..eb80972e 100644
--- a/toys/other/hello.c
+++ b/toys/other/hello.c
@@ -41,6 +41,8 @@ GLOBALS(
void hello_main(void)
{
+ char **optargs;
+
printf("Hello world\n");
if (toys.optflags) printf("flags=%x\n", toys.optflags);
@@ -52,7 +54,8 @@ void hello_main(void)
TT.d_list = TT.d_list->next;
}
if (TT.e_count) printf("e was seen %ld times\n", TT.e_count);
- while (*toys.optargs) printf("optarg=%s\n", *(toys.optargs++));
+ for (optargs = toys.optargs; *optargs; optargs++)
+ printf("optarg=%s\n", *optargs);
if (toys.optflags & FLAG_walrus) printf("Saw --walrus\n");
if (TT.blubber_string) printf("--blubber=%s\n", TT.blubber_string);
}