mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-03 03:06:39 +02:00
Treat scheme-r7rs
command name as in SRFI 22.
When the interpreter is named `scheme-r7rs`, SRFI 22's semantics is assumed, invoking `main` procedure regardless of `-r` option. Fix #416. Signed-off-by: Masanori Ogino <masanori.ogino@gmail.com>
This commit is contained in:
parent
1a468244f1
commit
76bd596aba
1 changed files with 11 additions and 0 deletions
11
main.c
11
main.c
|
@ -304,6 +304,17 @@ sexp run_main (int argc, char **argv) {
|
||||||
args = SEXP_NULL;
|
args = SEXP_NULL;
|
||||||
env = NULL;
|
env = NULL;
|
||||||
|
|
||||||
|
/* SRFI 22: invoke `main` procedure by default if the interpreter is invoked */
|
||||||
|
/* as `scheme-r7rs`. */
|
||||||
|
if (strncmp(basename(argv[0]), "scheme-r7rs", strlen("scheme-r7rs")) == 0) {
|
||||||
|
main_symbol = "main";
|
||||||
|
/* skip option parsing since we can't pass `--` before the name of script */
|
||||||
|
/* to avoid misinterpret the name as options when the interpreter is */
|
||||||
|
/* executed via `#!/usr/env/bin scheme-r7rs` shebang. */
|
||||||
|
i = 1;
|
||||||
|
goto done_options;
|
||||||
|
}
|
||||||
|
|
||||||
/* parse options */
|
/* parse options */
|
||||||
for (i=1; i < argc && argv[i][0] == '-'; i++) {
|
for (i=1; i < argc && argv[i][0] == '-'; i++) {
|
||||||
switch ((c=argv[i][1])) {
|
switch ((c=argv[i][1])) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue