| 13358 | #define AUXMARK "\1" |
| 13359 | |
| 13360 | static void setpath (lua_State *L, const char *fieldname, const char *envname, |
| 13361 | const char *def) { |
| 13362 | const char *path = getenv(envname); |
| 13363 | if (path == NULL) /* no environment variable? */ |
| 13364 | lua_pushstring(L, def); /* use default */ |
| 13365 | else { |
| 13366 | /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ |
| 13367 | path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP, |
| 13368 | LUA_PATHSEP AUXMARK LUA_PATHSEP); |
| 13369 | luaL_gsub(L, path, AUXMARK, def); |
| 13370 | lua_remove(L, -2); |
| 13371 | } |
| 13372 | setprogdir(L); |
| 13373 | lua_setfield(L, -2, fieldname); |
| 13374 | } |
| 13375 | |
| 13376 | |
| 13377 | static const luaL_Reg pk_funcs[] = { |
no test coverage detected