Implement shell builtins: cd, exec, umask (issue #15)

Add builtin dispatch in lcmd.c that checks __builtins table before
fork(), so cd/exec/umask operate on the shell process itself.
This commit is contained in:
Cormac Shannon
2026-03-04 19:20:42 +00:00
parent e8756d5d78
commit 4cc352cbec
7 changed files with 431 additions and 3 deletions

View File

@@ -21,6 +21,7 @@
#include "lauxlib.h"
#include "llimits.h"
#include "lcmd.h"
#include "lbuiltin.h"
/*
@@ -100,5 +101,6 @@ LUALIB_API void luaL_openselectedlibs (lua_State *L, int load, int preload) {
lua_assert((mask >> 1) == LUA_UTF8LIBK);
lua_pop(L, 1); /* remove PRELOAD table */
opencommand(L); /* register __command global */
luaopen_builtins(L); /* register __builtins table */
}