-R without an adjoined argument now checks whether the next argument

begins with a "-" to determine if it's the -R value versus another option.
This commit is contained in:
Alex Shinn 2014-07-21 22:09:05 +09:00
parent 7e9ffa3c12
commit b54aca219e
2 changed files with 4 additions and 8 deletions

View file

@ -87,13 +87,8 @@ or its shortcut
.SH OPTIONS
Space is optional between options and their arguments, with the
exception of
.I
-R
for which the argument is optional, and therefore if present must
occur without a space. Options without arguments may not be chained
together.
Space is optional between options and their arguments. Options
without arguments may not be chained together.
To reduce the need for shell escapes, options with module arguments
(

3
main.c
View file

@ -542,7 +542,8 @@ void run_main (int argc, char **argv) {
break;
#endif
case 'R':
main_module = argv[i][2] == '\0' ? "chibi.repl" : argv[i]+2;
main_module = argv[i][2] != '\0' ? argv[i]+2 :
(i+1 < argc && argv[i+1][0] != '-') ? argv[++i] : "chibi.repl";
if (main_symbol == NULL) main_symbol = "main";
break;
case 'r':