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 376a89f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 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,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)) {
Expand Down Expand Up @@ -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);
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 376a89f

Please sign in to comment.