From 376a89f279a3e5161b5884f6e61a9bb66171f1ff Mon Sep 17 00:00:00 2001 From: YI Date: Mon, 25 Sep 2023 11:13:47 +0800 Subject: [PATCH] remove command line argument -l --- lua-loader/lua-loader.c | 14 ++++---------- tests/official/main.lua | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lua-loader/lua-loader.c b/lua-loader/lua-loader.c index a49dfd8..2d28ca0 100644 --- a/lua-loader/lua-loader.c +++ b/lua-loader/lua-loader.c @@ -323,7 +323,6 @@ static int pushargs(lua_State *L) { #define has_r 4 /* -r, to run scripts, with ability to load local files */ #define has_f 16 /* -f, to enable file system support */ #define has_t 32 /* -t, for file system tests */ -#define has_l 64 /* -l, to run scripts, without ability to load local files */ /* ** Traverses all arguments from 'argv', returning a mask with those ** needed before running any Lua code (or an error code if it finds @@ -344,9 +343,6 @@ static int collectargs(char **argv, int *first) { case 'r': args |= has_r; break; - case 'l': - args |= has_l; - break; case 'f': args |= has_f; break; @@ -375,10 +371,8 @@ int read_file(char *buf, int size) { return ret; } -// Load the file given from syscall, may optionally enable access to local files -// by setting local_access_enabled to non-zero. -static int run_from_file(lua_State *L, int local_access_enabled) { - enable_local_access(local_access_enabled); +// Load the file given from syscall. +static int run_from_file(lua_State *L) { char buf[1024 * 512]; int count = read_file(buf, sizeof(buf)); if (count < 0 || count == sizeof(buf)) { @@ -448,8 +442,8 @@ static int pmain(lua_State *L) { ret = run_from_file_system(L); goto exit; } - if (args & has_r || args & has_l) { - ret = run_from_file(L, (args & has_r) == has_r); + if (args & has_r) { + ret = run_from_file(L); goto exit; } ret = load_lua_code_from_cell_data(L); diff --git a/tests/official/main.lua b/tests/official/main.lua index 9def638..20e142b 100644 --- a/tests/official/main.lua +++ b/tests/official/main.lua @@ -443,7 +443,7 @@ NoRun("unrecognized option '-vv'", "lua -vv") NoRun("unrecognized option '-iv'", "lua -iv") NoRun("'-e' needs argument", "lua -e") NoRun("syntax error", "lua -e a") -NoRun("'-l' needs argument", "lua -l") +-- NoRun("'-l' needs argument", "lua -l") if T then -- test library?