diff options
-rw-r--r-- | auto.def | 4 | ||||
-rw-r--r-- | jim-aio.c | 19 | ||||
-rwxr-xr-x | make-bootstrap-jim | 1 |
3 files changed, 22 insertions, 2 deletions
@@ -80,7 +80,7 @@ if {[cc-check-function-in-lib socket socket]} { } cc-check-functions ualarm lstat fork vfork system select execvpe -cc-check-functions backtrace geteuid mkstemp realpath strptime +cc-check-functions backtrace geteuid mkstemp realpath strptime isatty cc-check-functions regcomp waitpid sigaction sys_signame sys_siglist cc-check-functions syslog opendir readlink sleep usleep pipe getaddrinfo utimes if {[cc-check-functions sysinfo]} { @@ -167,7 +167,7 @@ if {[opt-bool ipv6 full]} { define JIM_IPV6 } if {[opt-bool lineedit full]} { - if {([cc-check-includes termios.h] && [cc-check-functions isatty]) || [have-feature winconsole]} { + if {([cc-check-includes termios.h] && [have-feature isatty]) || [have-feature winconsole]} { msg-result "Enabling line editing" define USE_LINENOISE lappend extra_objs linenoise.o @@ -511,6 +511,18 @@ static int aio_cmd_puts(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_ERR; } +static int aio_cmd_isatty(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ +#ifdef HAVE_ISATTY + AioFile *af = Jim_CmdPrivData(interp); + Jim_SetResultInt(interp, isatty(fileno(af->fp))); +#else + Jim_SetResultInt(interp, 0); +#endif + + return JIM_OK; +} + #if !defined(JIM_ANSIC) && !defined(JIM_BOOTSTRAP) static int aio_cmd_recvfrom(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { @@ -862,6 +874,13 @@ static const jim_subcmd_type aio_command_table[] = { 2, /* Description: Write the string, with newline unless -nonewline */ }, + { "isatty", + NULL, + aio_cmd_isatty, + 0, + 0, + /* Description: Is the file descriptor a tty? */ + }, #if !defined(JIM_ANSIC) && !defined(JIM_BOOTSTRAP) { "recvfrom", "len ?addrvar?", diff --git a/make-bootstrap-jim b/make-bootstrap-jim index 5af4acf..707d888 100755 --- a/make-bootstrap-jim +++ b/make-bootstrap-jim @@ -80,6 +80,7 @@ cat <<EOF #define TCL_PLATFORM_PATH_SEPARATOR ":" #define HAVE_VFORK #define HAVE_WAITPID +#define HAVE_ISATTY #define HAVE_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H |