diff options
author | Rob Landley <rob@landley.net> | 2012-11-16 00:46:39 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-11-16 00:46:39 -0600 |
commit | 4521f416ba8422563db6a762061a4a960db1bbf7 (patch) | |
tree | 11f4f4b808dc15908ac56b067f3ecf8b5474c05a | |
parent | caf39c26827f355c4e107f55c5c51f67c484bfd7 (diff) | |
download | toybox-4521f416ba8422563db6a762061a4a960db1bbf7.tar.gz |
Set optc when optstring NULL.
-rw-r--r-- | main.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -84,7 +84,10 @@ void toy_init(struct toy_list *which, char *argv[]) toys.which = which; toys.argv = argv; if (NEED_OPTIONS && which->options) get_optflags(); - else toys.optargs = argv+1; + else { + toys.optargs = argv+1; + for (toys.optc=0; toys.optargs[toys.optc]; toys.optc++); + } toys.old_umask = umask(0); if (!(which->flags & TOYFLAG_UMASK)) umask(toys.old_umask); } |