diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-04-03 10:34:42 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-04-03 10:34:42 -0300 |
| commit | f84c5a5fc68f83b3adad37919e0096ea3c7f4129 (patch) | |
| tree | 1bb3dde26c8790ab01d763efeea9af6c79c3f301 | |
| parent | 05d35d8f3cdd54399afdbfc6a6d009196d81e51d (diff) | |
| download | lua-f84c5a5fc68f83b3adad37919e0096ea3c7f4129.tar.gz lua-f84c5a5fc68f83b3adad37919e0096ea3c7f4129.tar.bz2 lua-f84c5a5fc68f83b3adad37919e0096ea3c7f4129.zip | |
avoid conflicts in (re)definition of `isatty'
| -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 | } |
