From e206c42e41a0beaa87aa20adde701c7bd67fa281 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-cell-fs.c | 4 ---- lua-loader/lua-loader.c | 17 ++++++----------- tests/official/main.lua | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/lua-loader/lua-cell-fs.c b/lua-loader/lua-cell-fs.c index dcf5245..2d78864 100644 --- a/lua-loader/lua-cell-fs.c +++ b/lua-loader/lua-cell-fs.c @@ -1,6 +1,2 @@ #include "../include/ckb_cell_fs.c" #include "lua-cell-fs-test.c" - -static int run_from_file_system(lua_State *L) { - return run_file_system_tests(L); -} diff --git a/lua-loader/lua-loader.c b/lua-loader/lua-loader.c index a49dfd8..e7dc195 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,9 @@ 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) { + enable_local_access(1); char buf[1024 * 512]; int count = read_file(buf, sizeof(buf)); if (count < 0 || count == sizeof(buf)) { @@ -445,11 +440,11 @@ static int pmain(lua_State *L) { } if (args & has_t) { enable_fs_access(1); - ret = run_from_file_system(L); + ret = run_file_system_tests(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?