Skip to content

Commit

Permalink
remove command line argument -l
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Sep 25, 2023
1 parent f1045f8 commit e206c42
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
4 changes: 0 additions & 4 deletions lua-loader/lua-cell-fs.c
Original file line number Diff line number Diff line change
@@ -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);
}
17 changes: 6 additions & 11 deletions lua-loader/lua-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/official/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit e206c42

Please sign in to comment.