diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-04-10 14:41:04 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-04-10 14:41:04 -0300 |
| commit | 0d4a1f71db1400a21654fc46b7e93a27db7641ae (patch) | |
| tree | 728cda4c342be81d9d66158e1985cfb31a42a69b | |
| parent | 67bf789462136e45692b4e31e41ef3abead1b2a2 (diff) | |
| download | lua-0d4a1f71db1400a21654fc46b7e93a27db7641ae.tar.gz lua-0d4a1f71db1400a21654fc46b7e93a27db7641ae.tar.bz2 lua-0d4a1f71db1400a21654fc46b7e93a27db7641ae.zip | |
re-organization of initial configuration options
Diffstat (limited to '')
| -rw-r--r-- | loslib.c | 67 |
1 files changed, 40 insertions, 27 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loslib.c,v 1.55 2015/01/12 19:32:32 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.56 2015/02/09 17:41:54 roberto Exp roberto $ |
| 3 | ** Standard Operating System library | 3 | ** Standard Operating System library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -22,10 +22,12 @@ | |||
| 22 | #include "lualib.h" | 22 | #include "lualib.h" |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | #if !defined(LUA_STRFTIMEOPTIONS) /* { */ | ||
| 26 | /* | 25 | /* |
| 26 | ** {================================================================== | ||
| 27 | ** list of valid conversion specifiers for the 'strftime' function | 27 | ** list of valid conversion specifiers for the 'strftime' function |
| 28 | ** =================================================================== | ||
| 28 | */ | 29 | */ |
| 30 | #if !defined(LUA_STRFTIMEOPTIONS) /* { */ | ||
| 29 | 31 | ||
| 30 | #if defined(LUA_USE_C89) | 32 | #if defined(LUA_USE_C89) |
| 31 | #define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" } | 33 | #define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" } |
| @@ -37,8 +39,14 @@ | |||
| 37 | #endif | 39 | #endif |
| 38 | 40 | ||
| 39 | #endif /* } */ | 41 | #endif /* } */ |
| 42 | /* }================================================================== */ | ||
| 40 | 43 | ||
| 41 | 44 | ||
| 45 | /* | ||
| 46 | ** {================================================================== | ||
| 47 | ** Configuration for time-related stuff | ||
| 48 | ** =================================================================== | ||
| 49 | */ | ||
| 42 | 50 | ||
| 43 | #if !defined(l_time_t) /* { */ | 51 | #if !defined(l_time_t) /* { */ |
| 44 | /* | 52 | /* |
| @@ -51,12 +59,38 @@ | |||
| 51 | #endif /* } */ | 59 | #endif /* } */ |
| 52 | 60 | ||
| 53 | 61 | ||
| 62 | #if !defined(l_gmtime) /* { */ | ||
| 63 | /* | ||
| 64 | ** By default, Lua uses gmtime/localtime, except when POSIX is available, | ||
| 65 | ** where it uses gmtime_r/localtime_r | ||
| 66 | */ | ||
| 67 | |||
| 68 | #if defined(LUA_USE_POSIX) /* { */ | ||
| 69 | |||
| 70 | #define l_gmtime(t,r) gmtime_r(t,r) | ||
| 71 | #define l_localtime(t,r) localtime_r(t,r) | ||
| 72 | |||
| 73 | #else /* }{ */ | ||
| 74 | |||
| 75 | /* ISO C definitions */ | ||
| 76 | #define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t)) | ||
| 77 | #define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) | ||
| 78 | |||
| 79 | #endif /* } */ | ||
| 80 | |||
| 81 | #endif /* } */ | ||
| 82 | |||
| 83 | /* }================================================================== */ | ||
| 84 | |||
| 54 | 85 | ||
| 55 | #if !defined(lua_tmpnam) /* { */ | ||
| 56 | /* | 86 | /* |
| 57 | ** By default, Lua uses tmpnam except when POSIX is available, where it | 87 | ** {================================================================== |
| 58 | ** uses mkstemp. | 88 | ** Configuration for 'tmpnam': |
| 89 | ** By default, Lua uses tmpnam except when POSIX is available, where | ||
| 90 | ** it uses mkstemp. | ||
| 91 | ** =================================================================== | ||
| 59 | */ | 92 | */ |
| 93 | #if !defined(lua_tmpnam) /* { */ | ||
| 60 | 94 | ||
| 61 | #if defined(LUA_USE_POSIX) /* { */ | 95 | #if defined(LUA_USE_POSIX) /* { */ |
| 62 | 96 | ||
| @@ -83,31 +117,10 @@ | |||
| 83 | #endif /* } */ | 117 | #endif /* } */ |
| 84 | 118 | ||
| 85 | #endif /* } */ | 119 | #endif /* } */ |
| 120 | /* }================================================================== */ | ||
| 86 | 121 | ||
| 87 | 122 | ||
| 88 | 123 | ||
| 89 | #if !defined(l_gmtime) /* { */ | ||
| 90 | /* | ||
| 91 | ** By default, Lua uses gmtime/localtime, except when POSIX is available, | ||
| 92 | ** where it uses gmtime_r/localtime_r | ||
| 93 | */ | ||
| 94 | |||
| 95 | #if defined(LUA_USE_POSIX) /* { */ | ||
| 96 | |||
| 97 | #define l_gmtime(t,r) gmtime_r(t,r) | ||
| 98 | #define l_localtime(t,r) localtime_r(t,r) | ||
| 99 | |||
| 100 | #else /* }{ */ | ||
| 101 | |||
| 102 | /* ISO C definitions */ | ||
| 103 | #define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t)) | ||
| 104 | #define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) | ||
| 105 | |||
| 106 | #endif /* } */ | ||
| 107 | |||
| 108 | #endif /* } */ | ||
| 109 | |||
| 110 | |||
| 111 | 124 | ||
| 112 | static int os_execute (lua_State *L) { | 125 | static int os_execute (lua_State *L) { |
| 113 | const char *cmd = luaL_optstring(L, 1, NULL); | 126 | const char *cmd = luaL_optstring(L, 1, NULL); |
