aboutsummaryrefslogtreecommitdiff
path: root/loslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'loslib.c')
-rw-r--r--loslib.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/loslib.c b/loslib.c
index 22f9ea43..7282c1cb 100644
--- a/loslib.c
+++ b/loslib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: loslib.c,v 1.40 2012/10/19 15:54:02 roberto Exp roberto $ 2** $Id: loslib.c,v 1.41 2013/05/14 15:57:11 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*/
@@ -42,7 +42,10 @@
42** By default, Lua uses tmpnam except when POSIX is available, where it 42** By default, Lua uses tmpnam except when POSIX is available, where it
43** uses mkstemp. 43** uses mkstemp.
44*/ 44*/
45#if defined(LUA_USE_MKSTEMP) 45#if !defined(lua_tmpnam) /* { */
46
47#if defined(LUA_USE_POSIX) /* { */
48
46#include <unistd.h> 49#include <unistd.h>
47#define LUA_TMPNAMBUFSIZE 32 50#define LUA_TMPNAMBUFSIZE 32
48#define lua_tmpnam(b,e) { \ 51#define lua_tmpnam(b,e) { \
@@ -51,29 +54,37 @@
51 if (e != -1) close(e); \ 54 if (e != -1) close(e); \
52 e = (e == -1); } 55 e = (e == -1); }
53 56
54#elif !defined(lua_tmpnam) 57#else /* }{ */
55 58
59/* ANSI definitions */
56#define LUA_TMPNAMBUFSIZE L_tmpnam 60#define LUA_TMPNAMBUFSIZE L_tmpnam
57#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } 61#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
58 62
59#endif 63#endif /* } */
64
65#endif /* } */
60 66
61 67
62/* 68/*
63** By default, Lua uses gmtime/localtime, except when POSIX is available, 69** By default, Lua uses gmtime/localtime, except when POSIX is available,
64** where it uses gmtime_r/localtime_r 70** where it uses gmtime_r/localtime_r
65*/ 71*/
66#if defined(LUA_USE_GMTIME_R) 72#if !defined(l_gmtime) /* { */
73
74#if defined(LUA_USE_POSIX) /* { */
67 75
68#define l_gmtime(t,r) gmtime_r(t,r) 76#define l_gmtime(t,r) gmtime_r(t,r)
69#define l_localtime(t,r) localtime_r(t,r) 77#define l_localtime(t,r) localtime_r(t,r)
70 78
71#elif !defined(l_gmtime) 79#else /* }{ */
72 80
81/* ANSI definitions */
73#define l_gmtime(t,r) ((void)r, gmtime(t)) 82#define l_gmtime(t,r) ((void)r, gmtime(t))
74#define l_localtime(t,r) ((void)r, localtime(t)) 83#define l_localtime(t,r) ((void)r, localtime(t))
75 84
76#endif 85#endif /* } */
86
87#endif /* } */
77 88
78 89
79 90