# HG changeset patch # User Rob Landley # Date 1353048399 21600 # Node ID ca9a1d8e25310139c12971f2ef879b63c958678f # Parent 99ca30ad3d2bf419e73c79a0d08e39400eb4a935 Set optc when optstring NULL. diff -r 99ca30ad3d2b -r ca9a1d8e2531 main.c --- a/main.c Fri Nov 16 00:35:46 2012 -0600 +++ b/main.c Fri Nov 16 00:46:39 2012 -0600 @@ -84,7 +84,10 @@ 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); }