summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lua.c b/lua.c
index 7802ebcb..be161858 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.203 2011/12/12 16:34:03 roberto Exp roberto $ 2** $Id: lua.c,v 1.204 2012/04/20 17:05:17 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -45,13 +45,13 @@
45*/ 45*/
46#if defined(LUA_USE_ISATTY) 46#if defined(LUA_USE_ISATTY)
47#include <unistd.h> 47#include <unistd.h>
48#define lua_stdin_is_tty() isatty(0) 48#define lua_stdin_is_tty() isatty(0)
49#elif defined(LUA_WIN) 49#elif defined(LUA_WIN)
50#include <io.h> 50#include <io.h>
51#include <stdio.h> 51#include <stdio.h>
52#define lua_stdin_is_tty() _isatty(_fileno(stdin)) 52#define lua_stdin_is_tty() _isatty(_fileno(stdin))
53#else 53#else
54#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ 54#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
55#endif 55#endif
56 56
57 57
@@ -66,19 +66,19 @@
66#include <stdio.h> 66#include <stdio.h>
67#include <readline/readline.h> 67#include <readline/readline.h>
68#include <readline/history.h> 68#include <readline/history.h>
69#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) 69#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
70#define lua_saveline(L,idx) \ 70#define lua_saveline(L,idx) \
71 if (lua_rawlen(L,idx) > 0) /* non-empty line? */ \ 71 if (lua_rawlen(L,idx) > 0) /* non-empty line? */ \
72 add_history(lua_tostring(L, idx)); /* add it to history */ 72 add_history(lua_tostring(L, idx)); /* add it to history */
73#define lua_freeline(L,b) ((void)L, free(b)) 73#define lua_freeline(L,b) ((void)L, free(b))
74 74
75#elif !defined(lua_readline) 75#elif !defined(lua_readline)
76 76
77#define lua_readline(L,b,p) \ 77#define lua_readline(L,b,p) \
78 ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ 78 ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
79 fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ 79 fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
80#define lua_saveline(L,idx) { (void)L; (void)idx; } 80#define lua_saveline(L,idx) { (void)L; (void)idx; }
81#define lua_freeline(L,b) { (void)L; (void)b; } 81#define lua_freeline(L,b) { (void)L; (void)b; }
82 82
83#endif 83#endif
84 84