diff --git a/CHANGES b/CHANGES index 3606959..ef84189 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +corrections: + socat did not compile on Solaris when configured without termios + feature (thanks to Pavan Gadi for reporting this bug) + ####################### V 1.6.0.1: new features: diff --git a/VERSION b/VERSION index 8821d46..63dff7f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -"1.6.0.1" +"1.6.0.1+disable_termios" diff --git a/filan.c b/filan.c index e0477d1..df37ec4 100644 --- a/filan.c +++ b/filan.c @@ -1,5 +1,5 @@ /* source: filan.c */ -/* Copyright Gerhard Rieger 2001-2007 */ +/* Copyright Gerhard Rieger 2001-2008 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* the subroutine filan makes a "FILe descriptor ANalysis". It checks the @@ -412,6 +412,7 @@ int devinfo(int fd) { int cdevan(int fd, FILE *outfile) { int ret; +#if _WITH_TERMIOS if ((ret = Isatty(fd)) < 0) { Warn2("isatty(%d): %s", fd, strerror(errno)); return -1; @@ -458,6 +459,7 @@ int cdevan(int fd, FILE *outfile) { } } } +#endif /* _WITH_TERMIOS */ return 0; } diff --git a/sycls.c b/sycls.c index 8581436..8befb2a 100644 --- a/sycls.c +++ b/sycls.c @@ -1,5 +1,5 @@ /* source: sycls.c */ -/* Copyright Gerhard Rieger 2001-2007 */ +/* Copyright Gerhard Rieger 2001-2008 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* explicit system call and C library trace function, for those who miss strace @@ -1233,6 +1233,7 @@ void *Realloc(void *ptr, size_t size) { return result; } +#if _WITH_TERMIOS int Tcgetattr(int fd, struct termios *termios_p) { int i, result, _errno; char chars[5*NCCS], *cp = chars; @@ -1252,7 +1253,9 @@ int Tcgetattr(int fd, struct termios *termios_p) { errno = _errno; return result; } +#endif /* _WITH_TERMIOS */ +#if _WITH_TERMIOS int Tcsetattr(int fd, int optional_actions, struct termios *termios_p) { int i, result, _errno; char chars[5*NCCS], *cp = chars; @@ -1270,6 +1273,7 @@ int Tcsetattr(int fd, int optional_actions, struct termios *termios_p) { errno = _errno; return result; } +#endif /* _WITH_TERMIOS */ char *Ttyname(int fd) { char *result; diff --git a/sysincludes.h b/sysincludes.h index f233358..ddda228 100644 --- a/sysincludes.h +++ b/sysincludes.h @@ -1,5 +1,5 @@ /* source: sysincludes.h */ -/* Copyright Gerhard Rieger 2001-2007 */ +/* Copyright Gerhard Rieger 2001-2008 */ /* Published under the GNU General Public License V.2, see file COPYING */ #ifndef __sysincludes_h_included @@ -34,7 +34,7 @@ #if HAVE_GRP_H #include /* getgrnam() */ #endif -#if HAVE_PTY_H +#if HAVE_PTY_H && _WITH_TERMIOS #include #endif #if HAVE_SYS_PARAM_H @@ -120,7 +120,7 @@ #include #endif -#if HAVE_TERMIOS_H && WITH_TERMIOS +#if HAVE_TERMIOS_H && _WITH_TERMIOS #include #endif #if HAVE_SYS_UTSNAME_H diff --git a/xio-readline.c b/xio-readline.c index 54ae29d..4db3ec2 100644 --- a/xio-readline.c +++ b/xio-readline.c @@ -1,5 +1,5 @@ /* source: xio-readline.c */ -/* Copyright Gerhard Rieger 2002-2007 */ +/* Copyright Gerhard Rieger 2002-2008 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for opening the readline address */ @@ -120,8 +120,10 @@ static int xioopen_readline(int argc, const char *argv[], struct opt *opts, if (xfd->stream.para.readline.history_file) { Read_history(xfd->stream.para.readline.history_file); } +#if _WITH_TERMIOS xiotermios_clrflag(xfd->stream.fd, 3, ICANON); xiotermios_clrflag(xfd->stream.fd, 3, ECHO); +#endif /* _WITH_TERMIOS */ return _xio_openlate(&xfd->stream, opts); } @@ -137,6 +139,7 @@ ssize_t xioread_readline(struct single *pipe, void *buff, size_t bufsiz) { pipe->para.readline.hasnoecho && !regexec(&pipe->para.readline.noecho, pipe->para.readline.dynprompt, 0, NULL, 0)) { +#if _WITH_TERMIOS /* under these conditions, we do not echo input, thus we circumvent readline */ struct termios saveterm, setterm; @@ -145,6 +148,7 @@ ssize_t xioread_readline(struct single *pipe, void *buff, size_t bufsiz) { setterm = saveterm; setterm.c_lflag |= ICANON; Tcsetattr(pipe->fd, TCSANOW, &setterm); /*!*/ +#endif /* _WITH_TERMIOS */ do { bytes = Read(pipe->fd, buff, bufsiz); } while (bytes < 0 && errno == EINTR); @@ -155,16 +159,20 @@ ssize_t xioread_readline(struct single *pipe, void *buff, size_t bufsiz) { errno = _errno; return -1; } +#if _WITH_TERMIOS setterm.c_lflag &= ~ICANON; Tcgetattr(pipe->fd, &setterm); /*! error */ Tcsetattr(pipe->fd, TCSANOW, &saveterm); /*!*/ +#endif /* _WITH_TERMIOS */ pipe->para.readline.dynend = pipe->para.readline.dynprompt; /*Write(pipe->fd, "\n", 1);*/ /*!*/ return bytes; } #endif /* HAVE_REGEX_H */ +#if _WITH_TERMIOS xiotermios_setflag(pipe->fd, 3, ECHO); +#endif /* _WITH_TERMIOS */ if (pipe->para.readline.prompt || pipe->para.readline.dynprompt) { /* we must carriage return, because readline will first print the prompt */ @@ -191,7 +199,9 @@ ssize_t xioread_readline(struct single *pipe, void *buff, size_t bufsiz) { if (line == NULL) { return 0; /* EOF */ } +#if _WITH_TERMIOS xiotermios_clrflag(pipe->fd, 3, ECHO); +#endif /* _WITH_TERMIOS */ Add_history(line); bytes = strlen(line); strncpy(buff, line, bufsiz); diff --git a/xio-termios.c b/xio-termios.c index 04e46f3..a5c2fd8 100644 --- a/xio-termios.c +++ b/xio-termios.c @@ -1,5 +1,5 @@ /* source: xio-termios.c */ -/* Copyright Gerhard Rieger 2001-2006 */ +/* Copyright Gerhard Rieger 2001-2008 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for terminal I/O options */ @@ -10,6 +10,7 @@ #include "xio-termios.h" /****** TERMIOS addresses ******/ +#if _WITH_TERMIOS #if WITH_TERMIOS const struct optdesc opt_tiocsctty={ "tiocsctty", "ctty",OPT_TIOCSCTTY, GROUP_TERMIOS, PH_LATE2, TYPE_BOOL, OFUNC_SPEC }; @@ -324,3 +325,5 @@ int xiotermios_clrflag(int fd, int word, tcflag_t mask) { return 0; } +#endif /* _WITH_TERMIOS */ + diff --git a/xio-termios.h b/xio-termios.h index 00e7118..7944c67 100644 --- a/xio-termios.h +++ b/xio-termios.h @@ -1,5 +1,5 @@ /* source: xio-termios.h */ -/* Copyright Gerhard Rieger 2001-2006 */ +/* Copyright Gerhard Rieger 2001-2008 */ /* Published under the GNU General Public License V.2, see file COPYING */ #ifndef __xio_termios_h_included @@ -138,10 +138,10 @@ extern const struct optdesc opt_sane; extern const struct optdesc opt_ispeed; extern const struct optdesc opt_ospeed; -#if WITH_TERMIOS /* otherwise tcflag_t might be reported undefined */ +#if _WITH_TERMIOS /* otherwise tcflag_t might be reported undefined */ extern int xiotermios_setflag(int fd, int word, tcflag_t mask); extern int xiotermios_clrflag(int fd, int word, tcflag_t mask); extern int xiotermiosflag_applyopt(int fd, struct opt *opt); -#endif /* WITH_TERMIOS */ +#endif /* _WITH_TERMIOS */ #endif /* !defined(__xio_termios_h_included) */ diff --git a/xioconfig.h b/xioconfig.h index f474b61..f62e45e 100644 --- a/xioconfig.h +++ b/xioconfig.h @@ -1,5 +1,5 @@ /* source: xioconfig.h */ -/* Copyright Gerhard Rieger 2001-2007 */ +/* Copyright Gerhard Rieger 2001-2008 */ /* Published under the GNU General Public License V.2, see file COPYING */ #ifndef __xioconfig_h_included @@ -20,6 +20,10 @@ # define WITH_NAMED 1 #endif +#if WITH_TERMIOS || WITH_PTY || WITH_READLINE +# define _WITH_TERMIOS 1 +#endif + #if WITH_SOCKS4A # define WITH_SOCKS4 1 #endif