53 return os_pushresult(L, rename(fromname, toname) == 0, fromname);
62 return luaL_error(L,
"unable to generate a unique filename");
136 else if (strcmp(
s,
"*t") == 0) {
142 setfield(L,
"month", stm->tm_mon+1);
143 setfield(L,
"year", stm->tm_year+1900);
144 setfield(L,
"wday", stm->tm_wday+1);
145 setfield(L,
"yday", stm->tm_yday+1);
151 cc[0] =
'%'; cc[2] =
'\0';
154 if (*
s !=
'%' || *(
s + 1) ==
'\0')
160 reslen = strftime(buff,
sizeof(buff), cc, stm);
180 ts.tm_hour =
getfield(L,
"hour", 12);
181 ts.tm_mday =
getfield(L,
"day", -1);
182 ts.tm_mon =
getfield(L,
"month", -1) - 1;
183 ts.tm_year =
getfield(L,
"year", -1) - 1900;
187 if (t == (time_t)(-1))
205 static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY,
206 LC_NUMERIC, LC_TIME};
207 static const char *
const catnames[] = {
"all",
"collate",
"ctype",
"monetary",
208 "numeric",
"time",
NULL};
LUA_API void lua_pushstring(lua_State *L, const char *s)
LUA_API void lua_pushnil(lua_State *L)
LUA_API void lua_pushnumber(lua_State *L, lua_Number n)
LUA_API const char * lua_pushfstring(lua_State *L, const char *fmt,...)
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
LUA_API int lua_toboolean(lua_State *L, int idx)
LUA_API void lua_pushboolean(lua_State *L, int b)
LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
LUA_API int lua_isnumber(lua_State *L, int idx)
LUA_API void lua_settop(lua_State *L, int idx)
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
LUA_API void lua_getfield(lua_State *L, int idx, const char *k)
LUALIB_API void luaL_buffinit(lua_State *L, luaL_Buffer *B)
LUALIB_API void luaL_addlstring(luaL_Buffer *B, const char *s, size_t l)
LUALIB_API void luaL_checktype(lua_State *L, int narg, int t)
LUALIB_API void luaL_pushresult(luaL_Buffer *B)
LUALIB_API lua_Number luaL_optnumber(lua_State *L, int narg, lua_Number def)
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
LUALIB_API void luaL_register(lua_State *L, const char *libname, const luaL_Reg *l)
LUALIB_API int luaL_checkoption(lua_State *L, int narg, const char *def, const char *const lst[])
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int narg)
#define luaL_addchar(B, c)
#define luaL_optstring(L, n, d)
#define luaL_optint(L, n, d)
#define luaL_opt(L, f, n, d)
#define luaL_checkstring(L, n)
static int os_setlocale(lua_State *L)
static int os_execute(lua_State *L)
static int os_getenv(lua_State *L)
static int os_pushresult(lua_State *L, int i, const char *filename)
static int getfield(lua_State *L, const char *key, int d)
static int getboolfield(lua_State *L, const char *key)
static int os_date(lua_State *L)
static void setboolfield(lua_State *L, const char *key, int value)
static const luaL_Reg syslib[]
static void setfield(lua_State *L, const char *key, int value)
static int os_tmpname(lua_State *L)
static int os_exit(lua_State *L)
static int os_rename(lua_State *L)
static int os_difftime(lua_State *L)
static int os_clock(lua_State *L)
LUALIB_API int luaopen_os(lua_State *L)
static int os_time(lua_State *L)
static int os_remove(lua_State *L)
#define lua_isnoneornil(L, n)
#define LUA_TMPNAMBUFSIZE
#define lua_tointeger(L, i)
CURL_EXTERN CURLMcode curl_socket_t s