mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
socat socat did not compile on Solaris when configured with --disable-termios
This commit is contained in:
parent
d37e8acc5f
commit
b7dc45661e
9 changed files with 39 additions and 12 deletions
4
CHANGES
4
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:
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
"1.6.0.1"
|
||||
"1.6.0.1+disable_termios"
|
||||
|
|
4
filan.c
4
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;
|
||||
}
|
||||
|
||||
|
|
6
sycls.c
6
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;
|
||||
|
|
|
@ -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 <grp.h> /* getgrnam() */
|
||||
#endif
|
||||
#if HAVE_PTY_H
|
||||
#if HAVE_PTY_H && _WITH_TERMIOS
|
||||
#include <pty.h>
|
||||
#endif
|
||||
#if HAVE_SYS_PARAM_H
|
||||
|
@ -120,7 +120,7 @@
|
|||
#include <linux/if_tun.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_TERMIOS_H && WITH_TERMIOS
|
||||
#if HAVE_TERMIOS_H && _WITH_TERMIOS
|
||||
#include <termios.h>
|
||||
#endif
|
||||
#if HAVE_SYS_UTSNAME_H
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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) */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue