csto: remove non-posix ifdefs

This commit is contained in:
Jeremy Baxter 2024-02-19 10:12:20 +13:00
parent 71b288efde
commit 280f516a21

30
csto.c
View file

@ -2,12 +2,11 @@
* csto: The Callisto stand-alone interpreter * csto: The Callisto stand-alone interpreter
*/ */
#include <lprefix.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <unistd.h>
#include <lua.h> #include <lua.h>
#include <lualib.h> #include <lualib.h>
@ -15,7 +14,6 @@
#include "callisto.h" #include "callisto.h"
#if !defined(LUA_PROGNAME) #if !defined(LUA_PROGNAME)
#define LUA_PROGNAME "csto" #define LUA_PROGNAME "csto"
#endif #endif
@ -26,14 +24,11 @@
#define LUA_INITVARVERSION LUA_INIT_VAR LUA_VERSUFFIX #define LUA_INITVARVERSION LUA_INIT_VAR LUA_VERSUFFIX
static lua_State *globalL = NULL; static lua_State *globalL = NULL;
static const char *progname = LUA_PROGNAME; static const char *progname = LUA_PROGNAME;
#if defined(LUA_USE_POSIX) /* { */
/* /*
** Use 'sigaction' when available. ** Use 'sigaction' when available.
*/ */
@ -45,12 +40,6 @@ static void setsignal (int sig, void (*handler)(int)) {
sigaction(sig, &sa, NULL); sigaction(sig, &sa, NULL);
} }
#else /* }{ */
#define setsignal signal
#endif /* } */
/* /*
** Hook set by signal function to stop the interpreter. ** Hook set by signal function to stop the interpreter.
@ -384,25 +373,8 @@ static int handle_luainit (lua_State *L) {
*/ */
#if !defined(lua_stdin_is_tty) /* { */ #if !defined(lua_stdin_is_tty) /* { */
#if defined(LUA_USE_POSIX) /* { */
#include <unistd.h>
#define lua_stdin_is_tty() isatty(0) #define lua_stdin_is_tty() isatty(0)
#elif defined(LUA_USE_WINDOWS) /* }{ */
#include <io.h>
#include <windows.h>
#define lua_stdin_is_tty() _isatty(_fileno(stdin))
#else /* }{ */
/* ISO C definition */
#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
#endif /* } */
#endif /* } */ #endif /* } */