diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 10:26:09 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 10:26:09 -0200 |
| commit | de6fc75d630b393d8b577ba03353abe527523d0f (patch) | |
| tree | 385cb83b63b2ec409cde308c776e7c4c2073ff84 /loslib.c | |
| parent | 2af0d3b4598060b1086884cfb879d39fa4e0c89a (diff) | |
| download | lua-de6fc75d630b393d8b577ba03353abe527523d0f.tar.gz lua-de6fc75d630b393d8b577ba03353abe527523d0f.tar.bz2 lua-de6fc75d630b393d8b577ba03353abe527523d0f.zip | |
several configuration options that do not change often moved out of
luaconf.h and into more internal files
Diffstat (limited to 'loslib.c')
| -rw-r--r-- | loslib.c | 24 |
1 files changed, 23 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loslib.c,v 1.26 2009/11/23 18:20:38 roberto Exp roberto $ | 2 | ** $Id: loslib.c,v 1.27 2009/11/24 12:05:44 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 | */ |
| @@ -20,6 +20,28 @@ | |||
| 20 | #include "lualib.h" | 20 | #include "lualib.h" |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | /* | ||
| 24 | ** By default, Lua uses tmpnam except when POSIX is available, where it | ||
| 25 | ** uses mkstemp. | ||
| 26 | */ | ||
| 27 | #if defined(LUA_USE_MKSTEMP) | ||
| 28 | #include <unistd.h> | ||
| 29 | #define LUA_TMPNAMBUFSIZE 32 | ||
| 30 | #define lua_tmpnam(b,e) { \ | ||
| 31 | strcpy(b, "/tmp/lua_XXXXXX"); \ | ||
| 32 | e = mkstemp(b); \ | ||
| 33 | if (e != -1) close(e); \ | ||
| 34 | e = (e == -1); } | ||
| 35 | |||
| 36 | #elif !defined(lua_tmpnam) | ||
| 37 | |||
| 38 | #define LUA_TMPNAMBUFSIZE L_tmpnam | ||
| 39 | #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } | ||
| 40 | |||
| 41 | #endif | ||
| 42 | |||
| 43 | |||
| 44 | |||
| 23 | static int os_pushresult (lua_State *L, int i, const char *filename) { | 45 | static int os_pushresult (lua_State *L, int i, const char *filename) { |
| 24 | int en = errno; /* calls to Lua API may change this value */ | 46 | int en = errno; /* calls to Lua API may change this value */ |
| 25 | if (i) { | 47 | if (i) { |
