From d2fab02571043809aa9c4ec7d72bff98afe80f13 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Tue, 22 Nov 2011 13:47:58 +0100 Subject: [PATCH] corrections for OpenEmbedded, especially termios SHIFT values andISPEED/OSPEED --- CHANGES | 3 +++ configure.in | 5 ++++- xio-termios.c | 6 +++++- xioinitialize.c | 6 +++++- xioopts.c | 4 ++-- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 790f2b3..4a16d2e 100644 --- a/CHANGES +++ b/CHANGES @@ -78,6 +78,9 @@ porting: fixed compiler warnings on Mac OS X 64bit. Thanks to Guy Harris for providing the patch. + corrections for OpenEmbedded, especially termios SHIFT values and + ISPEED/OSPEED. Thanks to John Faith for providing the patch + ####################### V 1.7.1.3: security: diff --git a/configure.in b/configure.in index 8e95a5e..9ad9967 100644 --- a/configure.in +++ b/configure.in @@ -1325,10 +1325,13 @@ AC_CACHE_CHECK(shift offset of $1, $2, ], [$2=`cat $conftestoffset`], [$2=-1], - [AC_MSG_RESULT(please determine $1_SHIFT manually)] + [$2=-1] ) LIBS="$LIBS1"]) AC_DEFINE_UNQUOTED($1_SHIFT, ${$2}) +if test "$2" = -1; then +AC_MSG_WARN(please determine $1_SHIFT manually) +fi ]) AC_SHIFT_OFFSET(CRDLY, sc_cv_sys_crdly_shift) diff --git a/xio-termios.c b/xio-termios.c index 4cddaf9..8d8d331 100644 --- a/xio-termios.c +++ b/xio-termios.c @@ -1,5 +1,5 @@ /* source: xio-termios.c */ -/* Copyright Gerhard Rieger 2001-2008 */ +/* Copyright Gerhard Rieger 2001-2011 */ /* Published under the GNU General Public License V.2, see file COPYING */ /* this file contains the source for terminal I/O options */ @@ -270,8 +270,12 @@ const struct optdesc opt_raw = { "raw", NULL, OPT_RAW, GROUP_TER const struct optdesc opt_sane = { "sane", NULL, OPT_SANE, GROUP_TERMIOS, PH_FD, TYPE_CONST, OFUNC_TERMIOS_SPEC }; #ifdef HAVE_TERMIOS_ISPEED +#if defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) +#if defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1) const struct optdesc opt_ispeed = { "ispeed", NULL, OPT_ISPEED, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_SPEED, ISPEED_OFFSET }; const struct optdesc opt_ospeed = { "ospeed", NULL, OPT_OSPEED, GROUP_TERMIOS, PH_FD, TYPE_UINT, OFUNC_TERMIOS_SPEED, OSPEED_OFFSET }; +#endif +#endif #endif /* HAVE_TERMIOS_ISPEED */ diff --git a/xioinitialize.c b/xioinitialize.c index 43bd875..1591294 100644 --- a/xioinitialize.c +++ b/xioinitialize.c @@ -62,11 +62,15 @@ int xioinitialize(void) { assert(tdata.termarg.c_oflag == tdata.flags[1]); assert(tdata.termarg.c_cflag == tdata.flags[2]); assert(tdata.termarg.c_lflag == tdata.flags[3]); -#if HAVE_TERMIOS_ISPEED +#if HAVE_TERMIOS_ISPEED && (ISPEED_OFFSET != -1) && (OSPEED_OFFSET != -1) +#if defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) +#if defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1) tdata.termarg.c_ispeed = 0x56789abc; tdata.termarg.c_ospeed = 0x6789abcd; assert(tdata.termarg.c_ispeed == tdata.speeds[ISPEED_OFFSET]); assert(tdata.termarg.c_ospeed == tdata.speeds[OSPEED_OFFSET]); +#endif +#endif #endif } #endif diff --git a/xioopts.c b/xioopts.c index 2494117..3ebfe14 100644 --- a/xioopts.c +++ b/xioopts.c @@ -779,7 +779,7 @@ const struct optname optionnames[] = { IF_IP6 ("ipv6only", &opt_ipv6_v6only) #endif IF_TERMIOS("isig", &opt_isig) -#ifdef HAVE_TERMIOS_ISPEED +#if defined(HAVE_TERMIOS_ISPEED) && defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) IF_TERMIOS("ispeed", &opt_ispeed) #endif IF_TERMIOS("istrip", &opt_istrip) @@ -1093,7 +1093,7 @@ const struct optname optionnames[] = { IF_OPENSSL("openssl-pseudo", &opt_openssl_pseudo) IF_OPENSSL("openssl-verify", &opt_openssl_verify) IF_TERMIOS("opost", &opt_opost) -#ifdef HAVE_TERMIOS_ISPEED +#if defined(HAVE_TERMIOS_ISPEED) && defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1) IF_TERMIOS("ospeed", &opt_ospeed) #endif IF_ANY ("owner", &opt_user)