diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 63057aa..00ddf82 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -51,6 +51,8 @@ - formatting cleanups - added ioctl device - new "-p" option to run non-Unu format source files + - now report "" for `script:name` if no file is being + run Future Notes diff --git a/vm/nga-c/retro.c b/vm/nga-c/retro.c index 52a402c..22a41f8 100644 --- a/vm/nga-c/retro.c +++ b/vm/nga-c/retro.c @@ -563,7 +563,10 @@ V scripting_include_plain(NgaState *vm) { } V scripting_name(NgaState *vm) { - stack_push(vm, string_inject(vm, vm->sys_argv[1], stack_pop(vm))); + if ((vm->sys_argc - 2) <= 0) + stack_push(vm, string_inject(vm, "", stack_pop(vm))); + else + stack_push(vm, string_inject(vm, vm->sys_argv[1], stack_pop(vm))); } /* addeded in scripting i/o device, revision 1 */ @@ -1123,6 +1126,9 @@ int main(int argc, char **argv) { vm->sys_argc = argc; /* Point the global argc and */ vm->sys_argv = argv; /* argv to the actual ones */ + strlcpy(vm->scripting_sources[0], "", 8192); + + /* Check arguments. If no flags were passed, load & run the file specified and exit. */ if (argc >= 2 && argv[1][0] != '-') {