diff options
| -rw-r--r-- | lua.c | 7 |
1 files changed, 4 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.120 2003/03/19 21:15:18 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.121 2003/03/24 12:40:01 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 | */ |
| @@ -31,8 +31,9 @@ | |||
| 31 | */ | 31 | */ |
| 32 | #ifdef _POSIX_C_SOURCE | 32 | #ifdef _POSIX_C_SOURCE |
| 33 | #include <unistd.h> | 33 | #include <unistd.h> |
| 34 | #define stdin_is_tty() isatty(0) | ||
| 34 | #else | 35 | #else |
| 35 | static int isatty (int x) { return x==0; } /* assume stdin is a tty */ | 36 | #define stdin_is_tty() 1 /* assume stdin is a tty */ |
| 36 | #endif | 37 | #endif |
| 37 | 38 | ||
| 38 | 39 | ||
| @@ -297,7 +298,7 @@ static void manual_input (void) { | |||
| 297 | 298 | ||
| 298 | static int handle_argv (char *argv[], int *interactive) { | 299 | static int handle_argv (char *argv[], int *interactive) { |
| 299 | if (argv[1] == NULL) { /* no more arguments? */ | 300 | if (argv[1] == NULL) { /* no more arguments? */ |
| 300 | if (isatty(0)) { | 301 | if (stdin_is_tty()) { |
| 301 | print_version(); | 302 | print_version(); |
| 302 | manual_input(); | 303 | manual_input(); |
| 303 | } | 304 | } |
