From 63b615123024f9f62f171457b1d37c19832b8db3 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 18 Nov 2017 18:17:45 +0900 Subject: [PATCH] fix patch for scheme-r7rs --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 71e21053..a8f2b6e4 100644 --- a/main.c +++ b/main.c @@ -307,9 +307,10 @@ sexp run_main (int argc, char **argv) { args = SEXP_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) { + /* SRFI 22: invoke `main` procedure by default if the interpreter is */ + /* invoked as `scheme-r7rs`. */ + arg = strrchr(argv[0], '/'); + if (strncmp((arg == NULL ? argv[0] : arg + 1), "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 */