mirror of
https://github.com/lua/lua.git
synced 2025-02-04 06:13:04 +08:00
re-organization of initial configuration options
This commit is contained in:
parent
67bf789462
commit
0d4a1f71db
69
loslib.c
69
loslib.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: loslib.c,v 1.55 2015/01/12 19:32:32 roberto Exp roberto $
|
** $Id: loslib.c,v 1.56 2015/02/09 17:41:54 roberto Exp roberto $
|
||||||
** Standard Operating System library
|
** Standard Operating System library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -22,10 +22,12 @@
|
|||||||
#include "lualib.h"
|
#include "lualib.h"
|
||||||
|
|
||||||
|
|
||||||
#if !defined(LUA_STRFTIMEOPTIONS) /* { */
|
|
||||||
/*
|
/*
|
||||||
|
** {==================================================================
|
||||||
** list of valid conversion specifiers for the 'strftime' function
|
** list of valid conversion specifiers for the 'strftime' function
|
||||||
|
** ===================================================================
|
||||||
*/
|
*/
|
||||||
|
#if !defined(LUA_STRFTIMEOPTIONS) /* { */
|
||||||
|
|
||||||
#if defined(LUA_USE_C89)
|
#if defined(LUA_USE_C89)
|
||||||
#define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" }
|
#define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" }
|
||||||
@ -37,8 +39,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* } */
|
#endif /* } */
|
||||||
|
/* }================================================================== */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** {==================================================================
|
||||||
|
** Configuration for time-related stuff
|
||||||
|
** ===================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
#if !defined(l_time_t) /* { */
|
#if !defined(l_time_t) /* { */
|
||||||
/*
|
/*
|
||||||
@ -51,15 +59,41 @@
|
|||||||
#endif /* } */
|
#endif /* } */
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(l_gmtime) /* { */
|
||||||
#if !defined(lua_tmpnam) /* { */
|
|
||||||
/*
|
/*
|
||||||
** By default, Lua uses tmpnam except when POSIX is available, where it
|
** By default, Lua uses gmtime/localtime, except when POSIX is available,
|
||||||
** uses mkstemp.
|
** where it uses gmtime_r/localtime_r
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LUA_USE_POSIX) /* { */
|
#if defined(LUA_USE_POSIX) /* { */
|
||||||
|
|
||||||
|
#define l_gmtime(t,r) gmtime_r(t,r)
|
||||||
|
#define l_localtime(t,r) localtime_r(t,r)
|
||||||
|
|
||||||
|
#else /* }{ */
|
||||||
|
|
||||||
|
/* ISO C definitions */
|
||||||
|
#define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t))
|
||||||
|
#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t))
|
||||||
|
|
||||||
|
#endif /* } */
|
||||||
|
|
||||||
|
#endif /* } */
|
||||||
|
|
||||||
|
/* }================================================================== */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** {==================================================================
|
||||||
|
** Configuration for 'tmpnam':
|
||||||
|
** By default, Lua uses tmpnam except when POSIX is available, where
|
||||||
|
** it uses mkstemp.
|
||||||
|
** ===================================================================
|
||||||
|
*/
|
||||||
|
#if !defined(lua_tmpnam) /* { */
|
||||||
|
|
||||||
|
#if defined(LUA_USE_POSIX) /* { */
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define LUA_TMPNAMBUFSIZE 32
|
#define LUA_TMPNAMBUFSIZE 32
|
||||||
@ -83,31 +117,10 @@
|
|||||||
#endif /* } */
|
#endif /* } */
|
||||||
|
|
||||||
#endif /* } */
|
#endif /* } */
|
||||||
|
/* }================================================================== */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(l_gmtime) /* { */
|
|
||||||
/*
|
|
||||||
** By default, Lua uses gmtime/localtime, except when POSIX is available,
|
|
||||||
** where it uses gmtime_r/localtime_r
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(LUA_USE_POSIX) /* { */
|
|
||||||
|
|
||||||
#define l_gmtime(t,r) gmtime_r(t,r)
|
|
||||||
#define l_localtime(t,r) localtime_r(t,r)
|
|
||||||
|
|
||||||
#else /* }{ */
|
|
||||||
|
|
||||||
/* ISO C definitions */
|
|
||||||
#define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t))
|
|
||||||
#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t))
|
|
||||||
|
|
||||||
#endif /* } */
|
|
||||||
|
|
||||||
#endif /* } */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int os_execute (lua_State *L) {
|
static int os_execute (lua_State *L) {
|
||||||
const char *cmd = luaL_optstring(L, 1, NULL);
|
const char *cmd = luaL_optstring(L, 1, NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user