mirror of
https://github.com/lua/lua
synced 2025-01-08 10:32:01 +03:00
avoid conflicts in (re)definition of `isatty'
This commit is contained in:
parent
05d35d8f3c
commit
f84c5a5fc6
7
lua.c
7
lua.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lua.c,v 1.120 2003/03/19 21:15:18 roberto Exp roberto $
|
** $Id: lua.c,v 1.121 2003/03/24 12:40:01 roberto Exp roberto $
|
||||||
** Lua stand-alone interpreter
|
** Lua stand-alone interpreter
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -31,8 +31,9 @@
|
|||||||
*/
|
*/
|
||||||
#ifdef _POSIX_C_SOURCE
|
#ifdef _POSIX_C_SOURCE
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#define stdin_is_tty() isatty(0)
|
||||||
#else
|
#else
|
||||||
static int isatty (int x) { return x==0; } /* assume stdin is a tty */
|
#define stdin_is_tty() 1 /* assume stdin is a tty */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -297,7 +298,7 @@ static void manual_input (void) {
|
|||||||
|
|
||||||
static int handle_argv (char *argv[], int *interactive) {
|
static int handle_argv (char *argv[], int *interactive) {
|
||||||
if (argv[1] == NULL) { /* no more arguments? */
|
if (argv[1] == NULL) { /* no more arguments? */
|
||||||
if (isatty(0)) {
|
if (stdin_is_tty()) {
|
||||||
print_version();
|
print_version();
|
||||||
manual_input();
|
manual_input();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user