Index: HISTORY ================================================================== --- HISTORY +++ HISTORY @@ -1,10 +1,53 @@ This is the HISTORY file for Expect. Modifications made by Cygnus support are in ChangeLog. - Don Date Version Description ------- ------- ------------------------------------------------------ + Scriptics reported memory leak. Was bug in parse_expect_args. + + "Michael P. Reilly" noted clib was hanging + in spawn code. status_pipe wasn't being closed. + + Egil Kvaleberg provided fix due to new gcc + which defines strchr as a macro. + + Dave Morrison noted some printfs + in exp_log.c that misinterpreted embedded %'s with resulting + core dumps. + + Dick Goodwin noted that "system echo + foo" returned with no apparent effect. Due to closeonexec + in expect's channel driver. Added skip if std channel. + Fixed similar bug in stty command. Minor bug left in stty + which isn't passing output back from underlying exec. + + Stacy W. Smith provided patch that uses + sigsetjmp instead of setjmp that he says fixes a problem he + encountered with C lib where it stopped timing out in expect() + as if the signals were corrupted. The man page doesn't + explain the difference between these calls in a way that makes + sense as to why they should make a difference, but I'll the + names are certainly suggestive so I'll try it. He says "it + appears that the linux setjmp behaves a little differently + compared to setjmp on some other OSs. Specifically, setjmp + on linux does not save the signal context. It seems most + BSDish OSs do save the signal context with setjmp. On those + machines, it appears setjmp(env) is equivalent to + sigsetjmp(env,1) whereas on linux, setjmp(env) is equivalent + to sigsetjmp(env,0). My patch made a (probably bad) + assumption that if siglongjmp() exists that we should use + the sigXXX versions. I specifically tested for siglongjmp + rather than sigsetjmp because on linux, sigsetjmp is just a + #define for __sigsetjmp. It appears that linux will give + the BSD behaviour if __FAVOR_BSD is defined, but I didn't + know what other implications that might have. + + Michael Schumacher provided fix so that test for whether + configure was out-of-date worked when not using the default + build dir. + 11/1/99 5.31.3 Shlomi Mahlab noted all.tcl in CVS but not distribution. More notes from Keith Brown on HP cc complaints in exp_pty.c. Index: configure ================================================================== --- configure +++ configure @@ -590,20 +590,20 @@ fi found=no echo $ac_n "checking configure up to date""... $ac_c" 1>&6 echo "configure:595: checking configure up to date" >&5 -for i in `cd ${srcdir} ; ls -tr configure configure.in Makefile.in` ; do +for i in `ls -tr ${srcdir}/configure ${srcdir}/configure.in ${srcdir}/Makefile.in` ; do newest=$i done -if test "configure" = "$newest" ; then +if test "$srcdir/configure" = "$newest" ; then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi -if test $found = "no" -a "$newest" != "configure" ; then - echo "configure: warning: configure appears to be old (configure.in and/or Makefile.in are newer) and the autoconf program to fix this situation was not found. If you've no idea what this means, enter the command \"touch configure\" and restart configure." 1>&2 +if test $found = "no" -a "$newest" != "$srcdir/configure" ; then + echo "configure: warning: $srcdir/configure appears to be old ($srcdir/configure.in and/or $srcdir/Makefile.in are newer) and the autoconf program to fix this situation was not found. If you've no idea what this means, enter the command \"touch $srcdir/configure\" and restart $srcdir/configure." 1>&2 exit fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do @@ -4735,28 +4735,79 @@ else echo "$ac_t""no" 1>&6 fi +echo $ac_n "checking for siglongjmp""... $ac_c" 1>&6 +echo "configure:4742: checking for siglongjmp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_siglongjmp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char siglongjmp(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_siglongjmp) || defined (__stub___siglongjmp) +choke me +#else +siglongjmp(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_siglongjmp=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_siglongjmp=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'siglongjmp`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_SIGLONGJMP 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + # dnl check for memcpy by hand # because Unixware 2.0 handles it specially and refuses to compile # autoconf's automatic test that is a call with no arguments echo $ac_n "checking for memcpy""... $ac_c" 1>&6 -echo "configure:4746: checking for memcpy" >&5 +echo "configure:4797: checking for memcpy" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_MEMCPY 1 EOF @@ -4774,17 +4825,17 @@ # Some systems only define WNOHANG if _POSIX_SOURCE is defined # The following merely tests that sys/wait.h can be included # and if so that WNOHANG is not defined. The only place I've # seen this is ISC. echo $ac_n "checking if WNOHANG requires _POSIX_SOURCE""... $ac_c" 1>&6 -echo "configure:4780: checking if WNOHANG requires _POSIX_SOURCE" >&5 +echo "configure:4831: checking if WNOHANG requires _POSIX_SOURCE" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() { #ifndef WNOHANG @@ -4792,11 +4843,11 @@ #else return 1; #endif } EOF -if { (eval echo configure:4798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define WNOHANG_REQUIRES_POSIX_SOURCE 1 EOF @@ -4812,18 +4863,18 @@ rm -fr conftest* fi echo $ac_n "checking if any value exists for WNOHANG""... $ac_c" 1>&6 -echo "configure:4818: checking if any value exists for WNOHANG" >&5 +echo "configure:4869: checking if any value exists for WNOHANG" >&5 rm -rf wnohang if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext < #include main() { @@ -4835,11 +4886,11 @@ #else return 1; #endif } EOF -if { (eval echo configure:4841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <&6 -echo "configure:4874: checking union wait" >&5 +echo "configure:4925: checking union wait" >&5 cat > conftest.$ac_ext < #include int main() { @@ -4882,11 +4933,11 @@ WIFEXITED(x); /* Generates compiler error if WIFEXITED * uses an int. */ ; return 0; } EOF -if { (eval echo configure:4888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_ok=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -4912,11 +4963,11 @@ # This picks up HP braindamage which defines fd_set and then # proceeds to ignore it and use int. # Pattern matching on int could be loosened. # Can't use ac_header_egrep since that doesn't see prototypes with K&R cpp. echo $ac_n "checking mask type of select""... $ac_c" 1>&6 -echo "configure:4918: checking mask type of select" >&5 +echo "configure:4969: checking mask type of select" >&5 if egrep "select\(size_t, int" /usr/include/sys/time.h >/dev/null 2>&1; then echo "$ac_t""int" 1>&6 cat >> confdefs.h <<\EOF #define SELECT_MASK_TYPE int EOF @@ -4926,17 +4977,17 @@ fi # FIXME: check if alarm exists echo $ac_n "checking if signals need to be re-armed""... $ac_c" 1>&6 -echo "configure:4932: checking if signals need to be re-armed" >&5 +echo "configure:4983: checking if signals need to be re-armed" >&5 if test "$cross_compiling" = yes; then echo "configure: warning: Expect can't be cross compiled" 1>&2 else cat > conftest.$ac_ext < #define RETSIGTYPE $retsigtype @@ -4971,11 +5022,11 @@ unlink("core"); exit(signal_rearms); } } EOF -if { (eval echo configure:4977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define REARM_SIG 1 EOF @@ -5002,11 +5053,11 @@ # There are multiple versions of getpty, alas. # I don't remember who has the first one, but Convex just added one # so check for it. Unfortunately, there is no header so the only # reasonable way to make sure is to look it we are on a Convex. echo $ac_n "checking if on Convex""... $ac_c" 1>&6 -echo "configure:5008: checking if on Convex" >&5 +echo "configure:5059: checking if on Convex" >&5 convex=0 case "${host}" in c[12]-*-*) convex=1;; esac @@ -5021,11 +5072,11 @@ fi EXP_LDFLAGS="$LDFLAGS" echo $ac_n "checking if on NeXT""... $ac_c" 1>&6 -echo "configure:5027: checking if on NeXT" >&5 +echo "configure:5078: checking if on NeXT" >&5 if test -r /NextApps ; then echo "$ac_t""yes" 1>&6 # "-m" flag suppresses complaints about multiple strtod EXP_LDFLAGS="$EXP_LDFLAGS -m" else @@ -5032,21 +5083,21 @@ echo "$ac_t""no" 1>&6 fi echo $ac_n "checking if on HP""... $ac_c" 1>&6 -echo "configure:5038: checking if on HP" >&5 +echo "configure:5089: checking if on HP" >&5 if test "x`(uname) 2>/dev/null`" = xHP-UX; then echo "$ac_t""yes" 1>&6 hp=1 else echo "$ac_t""no" 1>&6 hp=0 fi echo $ac_n "checking sane default stty arguments""... $ac_c" 1>&6 -echo "configure:5048: checking sane default stty arguments" >&5 +echo "configure:5099: checking sane default stty arguments" >&5 DEFAULT_STTY_ARGS="sane" if test $mach -eq 1 ; then DEFAULT_STTY_ARGS="cooked" fi @@ -5060,11 +5111,11 @@ # Look for various features to determine what kind of pty # we have. For some weird reason, ac_compile_check would not # work, but ac_test_program does. # echo $ac_n "checking for HP style pty allocation""... $ac_c" 1>&6 -echo "configure:5066: checking for HP style pty allocation" >&5 +echo "configure:5117: checking for HP style pty allocation" >&5 # following test fails on DECstations and other things that don't grok -c # but that's ok, since they don't have PTYMs anyway if test -r /dev/ptym/ptyp0 2>/dev/null ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -5074,13 +5125,13 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for HP style pty trapping""... $ac_c" 1>&6 -echo "configure:5080: checking for HP style pty trapping" >&5 +echo "configure:5131: checking for HP style pty trapping" >&5 cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "struct.*request_info" >/dev/null 2>&1; then @@ -5098,11 +5149,11 @@ fi rm -f conftest* echo $ac_n "checking for AIX new-style pty allocation""... $ac_c" 1>&6 -echo "configure:5104: checking for AIX new-style pty allocation" >&5 +echo "configure:5155: checking for AIX new-style pty allocation" >&5 if test -r /dev/ptc -a -r /dev/pts ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_PTC_PTS 1 EOF @@ -5110,11 +5161,11 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for SGI old-style pty allocation""... $ac_c" 1>&6 -echo "configure:5116: checking for SGI old-style pty allocation" >&5 +echo "configure:5167: checking for SGI old-style pty allocation" >&5 if test -r /dev/ptc -a ! -r /dev/pts ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_PTC 1 EOF @@ -5127,11 +5178,11 @@ # The library routines to open the SVR4 ptys are broken on certain systems and # the SCO command to increase the number of ptys only configure c-list ones # anyway. So we chose these, which have a special numbering scheme. # echo $ac_n "checking for SCO style pty allocation""... $ac_c" 1>&6 -echo "configure:5133: checking for SCO style pty allocation" >&5 +echo "configure:5184: checking for SCO style pty allocation" >&5 sco_ptys="" case "${host}" in *-sco3.2v[45]*) sco_clist_ptys=1 svr4_ptys_broken=1;; esac @@ -5144,25 +5195,124 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for SVR4 style pty allocation""... $ac_c" 1>&6 -echo "configure:5150: checking for SVR4 style pty allocation" >&5 +echo "configure:5201: checking for SVR4 style pty allocation" >&5 if test -r /dev/ptmx -a "x$svr4_ptys_broken" = x ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_PTMX 1 EOF # aargg. Some systems need libpt.a to use /dev/ptmx echo $ac_n "checking for ptsname""... $ac_c" 1>&6 -echo "configure:5159: checking for ptsname" >&5 +echo "configure:5210: checking for ptsname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_ptsname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ptsname(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_ptsname) || defined (__stub___ptsname) +choke me +#else +ptsname(); +#endif + +; return 0; } +EOF +if { (eval echo configure:5238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_ptsname=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_ptsname=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'ptsname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +LIBS="${LIBS} -lpt" +fi + + # I've never seen Tcl or Tk include -lpt so don't bother with explicit test + echo $ac_n "checking for ptsname""... $ac_c" 1>&6 +echo "configure:5260: checking for ptsname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_ptsname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char ptsname(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_ptsname) || defined (__stub___ptsname) +choke me +#else +ptsname(); +#endif + +; return 0; } +EOF +if { (eval echo configure:5288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_ptsname=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_ptsname=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'ptsname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +EXP_AND_TCL_LIBS="${EXP_AND_TCL_LIBS} -lpt" +fi + + echo $ac_n "checking for ptsname""... $ac_c" 1>&6 +echo "configure:5309: checking for ptsname" >&5 if eval "test \"`echo '$''{'ac_cv_func_ptsname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ @@ -5181,110 +5331,11 @@ ptsname(); #endif ; return 0; } EOF -if { (eval echo configure:5187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_ptsname=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_ptsname=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'ptsname`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -LIBS="${LIBS} -lpt" -fi - - # I've never seen Tcl or Tk include -lpt so don't bother with explicit test - echo $ac_n "checking for ptsname""... $ac_c" 1>&6 -echo "configure:5209: checking for ptsname" >&5 -if eval "test \"`echo '$''{'ac_cv_func_ptsname'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char ptsname(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_ptsname) || defined (__stub___ptsname) -choke me -#else -ptsname(); -#endif - -; return 0; } -EOF -if { (eval echo configure:5237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_ptsname=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_ptsname=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'ptsname`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -else - echo "$ac_t""no" 1>&6 -EXP_AND_TCL_LIBS="${EXP_AND_TCL_LIBS} -lpt" -fi - - echo $ac_n "checking for ptsname""... $ac_c" 1>&6 -echo "configure:5258: checking for ptsname" >&5 -if eval "test \"`echo '$''{'ac_cv_func_ptsname'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char ptsname(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_ptsname) || defined (__stub___ptsname) -choke me -#else -ptsname(); -#endif - -; return 0; } -EOF -if { (eval echo configure:5286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_ptsname=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5307,11 +5358,11 @@ fi # In OSF/1 case, SVR4 are somewhat different. # Gregory Depp 17Aug93 echo $ac_n "checking for OSF/1 style pty allocation""... $ac_c" 1>&6 -echo "configure:5313: checking for OSF/1 style pty allocation" >&5 +echo "configure:5364: checking for OSF/1 style pty allocation" >&5 if test -r /dev/ptmx_bsd ; then cat >> confdefs.h <<\EOF #define HAVE_PTMX_BSD 1 EOF @@ -5321,16 +5372,16 @@ fi tcgetattr=0 tcsetattr=0 echo $ac_n "checking for tcgetattr""... $ac_c" 1>&6 -echo "configure:5327: checking for tcgetattr" >&5 +echo "configure:5378: checking for tcgetattr" >&5 if eval "test \"`echo '$''{'ac_cv_func_tcgetattr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ @@ -5349,11 +5400,11 @@ tcgetattr(); #endif ; return 0; } EOF -if { (eval echo configure:5355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_tcgetattr=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5369,16 +5420,16 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for tcsetattr""... $ac_c" 1>&6 -echo "configure:5375: checking for tcsetattr" >&5 +echo "configure:5426: checking for tcsetattr" >&5 if eval "test \"`echo '$''{'ac_cv_func_tcsetattr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ @@ -5397,11 +5448,11 @@ tcsetattr(); #endif ; return 0; } EOF -if { (eval echo configure:5403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_tcsetattr=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5429,27 +5480,27 @@ fi # first check for the pure bsd echo $ac_n "checking for struct sgttyb""... $ac_c" 1>&6 -echo "configure:5435: checking for struct sgttyb" >&5 +echo "configure:5486: checking for struct sgttyb" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() { struct sgttyb tmp; exit(0); } EOF -if { (eval echo configure:5451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_SGTTYB 1 EOF @@ -5474,26 +5525,26 @@ # next check for the older style ttys # note that if we detect termio.h (only), we still set PTY_TYPE=termios # since that just controls which of pty_XXXX.c file is use and # pty_termios.c is set up to handle pty_termio. echo $ac_n "checking for struct termio""... $ac_c" 1>&6 -echo "configure:5480: checking for struct termio" >&5 +echo "configure:5531: checking for struct termio" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() { struct termio tmp; exit(0); } EOF -if { (eval echo configure:5495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cat >> confdefs.h <<\EOF #define HAVE_TERMIO 1 EOF @@ -5511,17 +5562,17 @@ fi # now check for the new style ttys (not yet posix) echo $ac_n "checking for struct termios""... $ac_c" 1>&6 -echo "configure:5517: checking for struct termios" >&5 +echo "configure:5568: checking for struct termios" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext < @@ -5531,11 +5582,11 @@ { struct termios tmp; exit(0); } EOF -if { (eval echo configure:5537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cat >> confdefs.h <<\EOF #define HAVE_TERMIOS 1 EOF @@ -5553,17 +5604,17 @@ fi fi echo $ac_n "checking if TCGETS or TCGETA in termios.h""... $ac_c" 1>&6 -echo "configure:5559: checking if TCGETS or TCGETA in termios.h" >&5 +echo "configure:5610: checking if TCGETS or TCGETA in termios.h" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext < @@ -5575,11 +5626,11 @@ #else return 1; #endif } EOF -if { (eval echo configure:5581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cat >> confdefs.h <<\EOF #define HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H 1 EOF @@ -5595,17 +5646,17 @@ rm -fr conftest* fi echo $ac_n "checking if TIOCGWINSZ in termios.h""... $ac_c" 1>&6 -echo "configure:5601: checking if TIOCGWINSZ in termios.h" >&5 +echo "configure:5652: checking if TIOCGWINSZ in termios.h" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext < @@ -5617,11 +5668,11 @@ #else return 1; #endif } EOF -if { (eval echo configure:5623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cat >> confdefs.h <<\EOF #define HAVE_TIOCGWINSZ_IN_TERMIOS_H 1 EOF @@ -5638,18 +5689,18 @@ fi # finally check for Cray style ttys echo $ac_n "checking for Cray-style ptys""... $ac_c" 1>&6 -echo "configure:5644: checking for Cray-style ptys" >&5 +echo "configure:5695: checking for Cray-style ptys" >&5 SETUID=":" if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then PTY_TYPE=unicos SETUID="chmod u+s" echo "$ac_t""yes" 1>&6 @@ -5682,16 +5733,16 @@ # select=0 poll=0 unset ac_cv_func_select echo $ac_n "checking for select""... $ac_c" 1>&6 -echo "configure:5688: checking for select" >&5 +echo "configure:5739: checking for select" >&5 if eval "test \"`echo '$''{'ac_cv_func_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ @@ -5710,11 +5761,11 @@ select(); #endif ; return 0; } EOF -if { (eval echo configure:5716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_select=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5730,16 +5781,16 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for poll""... $ac_c" 1>&6 -echo "configure:5736: checking for poll" >&5 +echo "configure:5787: checking for poll" >&5 if eval "test \"`echo '$''{'ac_cv_func_poll'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ @@ -5758,11 +5809,11 @@ poll(); #endif ; return 0; } EOF -if { (eval echo configure:5764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_poll=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5778,11 +5829,11 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking event handling""... $ac_c" 1>&6 -echo "configure:5784: checking event handling" >&5 +echo "configure:5835: checking event handling" >&5 if test $select -eq 1 ; then EVENT_TYPE=select EVENT_ABLE=event echo "$ac_t""via select" 1>&6 elif test $poll -eq 1 ; then @@ -5800,16 +5851,16 @@ fi for ac_func in _getpty do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5806: checking for $ac_func" >&5 +echo "configure:5857: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ @@ -5828,11 +5879,11 @@ $ac_func(); #endif ; return 0; } EOF -if { (eval echo configure:5834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5855,16 +5906,16 @@ done for ac_func in getpty do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5861: checking for $ac_func" >&5 +echo "configure:5912: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ @@ -5883,11 +5934,11 @@ $ac_func(); #endif ; return 0; } EOF -if { (eval echo configure:5889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5910,19 +5961,19 @@ done # following test sets SETPGRP_VOID if setpgrp takes 0 args, else takes 2 echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:5916: checking whether setpgrp takes no argument" >&5 +echo "configure:5967: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < #endif @@ -5938,11 +5989,11 @@ else exit(1); } EOF -if { (eval echo configure:5944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 @@ -5966,17 +6017,17 @@ # # check for timezones # echo $ac_n "checking for SV-style timezone""... $ac_c" 1>&6 -echo "configure:5972: checking for SV-style timezone" >&5 +echo "configure:6023: checking for SV-style timezone" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Expect can't be cross compiled" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cat >> confdefs.h <<\EOF #define HAVE_SV_TIMEZONE 1 EOF @@ -6031,11 +6082,11 @@ # things up. # the alternative search directory is involked by --with-tkinclude # #no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:6037: checking for Tk private headers" >&5 +echo "configure:6088: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" with_tkinclude=${withval} fi @@ -6102,21 +6153,21 @@ fi # see if one is installed if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:6108: checking for tk.h" >&5 +echo "configure:6159: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6118: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else @@ -6211,11 +6262,11 @@ fi # also remove dots on systems that don't support filenames > 14 # (are there systems which support shared libs and restrict filename lengths!?) echo $ac_n "checking for long file names""... $ac_c" 1>&6 -echo "configure:6217: checking for long file names" >&5 +echo "configure:6268: checking for long file names" >&5 if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_sys_long_file_names=yes # Test for long file names in all the places we know might matter: @@ -6268,11 +6319,11 @@ # which is set way far above here. Don't set it to the value of # TCL_DBGX, or you'll run into problems if you build Tcl with symbols # and expect without (and vice versa?) echo $ac_n "checking for type of library to build""... $ac_c" 1>&6 -echo "configure:6274: checking for type of library to build" >&5 +echo "configure:6325: checking for type of library to build" >&5 if test "$enable_shared" = "yes" && test "x${TCL_SHLIB_SUFFIX}" != "x" ; then EXP_SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS eval "EXP_SHARED_LIB_FILE=libexpect${TCL_SHARED_LIB_SUFFIX}" EXP_LIB_FILE=$EXP_SHARED_LIB_FILE EXP_LIB_FILES="$EXP_SHARED_LIB_FILE $EXP_UNSHARED_LIB_FILE" @@ -6865,7 +6916,6 @@ fi cd $ac_popdir done fi - Index: configure.in ================================================================== --- configure.in +++ configure.in @@ -32,20 +32,20 @@ # development. # Test if configure is older than configure.in and explain if no autoconf AC_CHECK_PROG(found,autoconf,yes,no,) found=no AC_MSG_CHECKING([configure up to date]) -for i in `cd ${srcdir} ; ls -tr configure configure.in Makefile.in` ; do +for i in `ls -tr ${srcdir}/configure ${srcdir}/configure.in ${srcdir}/Makefile.in` ; do newest=$i done -if test "configure" = "$newest" ; then +if test "$srcdir/configure" = "$newest" ; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi -if test $found = "no" -a "$newest" != "configure" ; then - AC_MSG_WARN([configure appears to be old (configure.in and/or Makefile.in are newer) and the autoconf program to fix this situation was not found. If you've no idea what this means, enter the command \"touch configure\" and restart configure.]) +if test $found = "no" -a "$newest" != "$srcdir/configure" ; then + AC_MSG_WARN([$srcdir/configure appears to be old ($srcdir/configure.in and/or $srcdir/Makefile.in are newer) and the autoconf program to fix this situation was not found. If you've no idea what this means, enter the command \"touch $srcdir/configure\" and restart $srcdir/configure.]) exit fi dnl AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) AC_CANONICAL_SYSTEM @@ -592,10 +592,11 @@ AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE)) AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF)) AC_CHECK_FUNC(strftime, AC_DEFINE(HAVE_STRFTIME)) AC_CHECK_FUNC(strchr, AC_DEFINE(HAVE_STRCHR)) AC_CHECK_FUNC(timezone, AC_DEFINE(HAVE_TIMEZONE)) +AC_CHECK_FUNC(siglongjmp, AC_DEFINE(HAVE_SIGLONGJMP)) # dnl check for memcpy by hand # because Unixware 2.0 handles it specially and refuses to compile # autoconf's automatic test that is a call with no arguments AC_MSG_CHECKING([for memcpy]) Index: example/tkterm ================================================================== --- example/tkterm +++ example/tkterm @@ -163,11 +163,11 @@ kf9=\EOX, } close $file set oldpath $env(PATH) - set env(PATH) "/usr/5bin:/usr/lib/terminfo" + set env(PATH) "$env(PATH):/usr/5bin:/usr/lib/terminfo" if 1==[catch {exec tic $ttsrc} msg] { puts "WARNING: tic failed - if you don't have terminfo support on" puts "your system, change \"set terminfo 1\" to \"set terminfo 0\"." puts "Here is the original error from running tic:" puts $msg Index: exp_chan.c ================================================================== --- exp_chan.c +++ exp_chan.c @@ -494,12 +494,16 @@ /* not sure about this - what about adopted channels */ esPtr->validMask = mask | TCL_EXCEPTION; esPtr->fdin = fdin; esPtr->fdout = fdout; - expCloseOnExec(fdin); - if (fdin != fdout) expCloseOnExec(fdout); + /* set close-on-exec for everything but std channels */ + /* (system and stty commands need access to std channels) */ + if (fdin != 0 && fdin != 2) { + expCloseOnExec(fdin); + if (fdin != fdout) expCloseOnExec(fdout); + } esPtr->fdBusy = FALSE; esPtr->channel = Tcl_CreateChannel(channelTypePtr, esPtr->name, (ClientData) esPtr, mask); Tcl_RegisterChannel(interp,esPtr->channel); Index: exp_clib.c ================================================================== --- exp_clib.c +++ exp_clib.c @@ -76,11 +76,11 @@ * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: exp_clib.c,v 5.28.1.1.2.10 1999/07/07 20:15:03 libes Exp $ + * RCS: @(#) $Id: exp_clib.c,v 5.28.1.1.2.12 1999/12/04 06:18:23 libes Exp $ */ #ifndef _STDLIB #define _STDLIB @@ -164,11 +164,11 @@ * *** 1. All use of static variables has been changed to access *** * *** fields of a structure. *** * *** 2. This in addition to changes to TclRegError makes the *** * *** code multi-thread safe. *** * - * RCS: @(#) $Id: exp_clib.c,v 5.28.1.1.2.10 1999/07/07 20:15:03 libes Exp $ + * RCS: @(#) $Id: exp_clib.c,v 5.28.1.1.2.12 1999/12/04 06:18:23 libes Exp $ */ #if 0 #include "tclInt.h" #include "tclPort.h" @@ -2169,11 +2169,16 @@ int exp_ttyinit = TRUE; /* set tty parms to sane state */ int exp_console = FALSE; /* redirect console */ void (*exp_child_exec_prelude)() = 0; void (*exp_close_in_child)() = 0; +#ifdef HAVE_SIGLONGJMP +sigjmp_buf exp_readenv; /* for interruptable read() */ +#else jmp_buf exp_readenv; /* for interruptable read() */ +#endif /* HAVE_SIGLONGJMP */ + int exp_reading = FALSE; /* whether we can longjmp or not */ int exp_is_debugging = FALSE; FILE *exp_debugfile = 0; @@ -2447,10 +2452,12 @@ * child process - do not return from here! all errors must exit() */ close(sync_fds[0]); close(sync2_fds[1]); + close(status_pipe[0]); + fcntl(status_pipe[1],F_SETFD,1); /* close on exec */ #ifdef CRAY (void) close(exp_pty[0]); #endif @@ -2750,11 +2757,15 @@ { #ifdef REARM_SIG signal(SIGALRM,sigalarm_handler); #endif +#ifdef HAVE_SIGLONGJMP + siglongjmp(exp_readenv,1); +#else longjmp(exp_readenv,1); +#endif /* HAVE_SIGLONGJMP */ } /* interruptable read */ static int i_read(fd,fp,buffer,length,timeout) @@ -2774,11 +2785,15 @@ if (timeout > 0) alarm(timeout); /* restart read if setjmp returns 0 (first time) or 2 (EXP_RESTART). */ /* abort if setjmp returns 1 (EXP_ABORT). */ +#ifdef HAVE_SIGLONGJMP + if (EXP_ABORT != sigsetjmp(exp_readenv,1)) { +#else if (EXP_ABORT != setjmp(exp_readenv)) { +#endif /* HAVE_SIGLONGJMP */ exp_reading = TRUE; if (fd == -1) { int c; c = getc(fp); if (c == EOF) { Index: exp_inter.c ================================================================== --- exp_inter.c +++ exp_inter.c @@ -495,22 +495,33 @@ #define WEXITSTATUS(stat) (((*((int *) &(stat))) >> 8) & 0xff) #endif #include +#ifdef HAVE_SIGLONGJMP +static sigjmp_buf env; /* for interruptable read() */ +#else static jmp_buf env; /* for interruptable read() */ +#endif /* HAVE_SIGLONGJMP */ + static int reading; /* while we are reading */ /* really, while "env" is valid */ static int deferred_interrupt = FALSE; /* if signal is received, but not */ /* in expIRead record this here, so it will */ /* be handled next time through expIRead */ static void sigchld_handler() { - if (reading) longjmp(env,1); - deferred_interrupt = TRUE; + if (reading) { +#ifdef HAVE_SIGLONGJMP + siglongjmp(env,1); +#else + longjmp(env,1); +#endif /* HAVE_SIGLONGJMP */ + } + deferred_interrupt = TRUE; } #define EXP_CHILD_EOF -100 /* @@ -530,11 +541,15 @@ { int cc = EXP_CHILD_EOF; if (deferred_interrupt) return(cc); +#ifdef HAVE_SIGLONGJMP + if (0 == sigsetjmp(env,1)) { +#else if (0 == setjmp(env)) { +#endif /* HAVE_SIGLONGJMP */ reading = TRUE; cc = Tcl_ReadChars(channel,obj,size,flags); } reading = FALSE; return(cc); Index: exp_log.c ================================================================== --- exp_log.c +++ exp_log.c @@ -166,11 +166,11 @@ if ((!tsdPtr->logUser) && (!force_stdout) && (!tsdPtr->logAll)) return; (void) vsprintf(bigbuf,fmt,args); expDiagWriteBytes(bigbuf,-1); if (tsdPtr->logAll || (LOGUSER && tsdPtr->logChannel)) Tcl_WriteChars(tsdPtr->logChannel,bigbuf,-1); - if (LOGUSER) fprintf(stdout,bigbuf); + if (LOGUSER) fprintf(stdout,"%s",bigbuf); va_end(args); } /* just like log but does no formatting */ /* send to log if open */ @@ -205,11 +205,11 @@ fmt = TCL_VARARGS_START(char *,arg1,args); (void) vsprintf(bigbuf,fmt,args); expDiagWriteChars(bigbuf,-1); - fprintf(stderr,bigbuf); + fprintf(stderr,"%s",bigbuf); if (tsdPtr->logChannel) Tcl_WriteChars(tsdPtr->logChannel,bigbuf,-1); va_end(args); } @@ -248,11 +248,11 @@ (void) vsprintf(bigbuf,fmt,args); expDiagWriteBytes(bigbuf,-1); if (tsdPtr->diagToStderr) { - fprintf(stderr,bigbuf); + fprintf(stderr,"%s",bigbuf); if (tsdPtr->logChannel) Tcl_WriteChars(tsdPtr->logChannel,bigbuf,-1); } va_end(args); } @@ -269,11 +269,11 @@ if ((tsdPtr->diagToStderr == 0) && (tsdPtr->diagChannel == 0)) return; expDiagWriteBytes(str,-1); if (tsdPtr->diagToStderr) { - fprintf(stderr,str); + fprintf(stderr,"%s",str); if (tsdPtr->logChannel) Tcl_WriteChars(tsdPtr->logChannel,str,-1); } } void Index: exp_pty.c ================================================================== --- exp_pty.c +++ exp_pty.c @@ -64,11 +64,16 @@ static char locksrc[50] = "/tmp/expect.pid"; /* pid is replaced by real pid */ /* locksrc is used as the link source, i.e., something to link from */ static int i_read_errno;/* place to save errno, if i_read() == -1, so it doesn't get overwritten before we get to read it */ +#ifdef HAVE_SIGLONGJMP +static sigjmp_buf env; /* for interruptable read() */ +#else static jmp_buf env; /* for interruptable read() */ +#endif /* HAVE_SIGLONGJMP */ + static int env_valid = FALSE; /* whether we can longjmp or not */ /* sigalarm_handler and i_read are here just for supporting the sanity */ /* checking of pty slave devices. I have only seen this happen on BSD */ /* systems, but it may need to be done to the other pty implementations */ @@ -87,11 +92,15 @@ signal(SIGALRM,sigalarm_handler); #endif /* check env_valid first to protect us from the alarm occurring */ /* in the window between i_read and alarm(0) */ +#ifdef HAVE_SIGLONGJMP + if (env_valid) siglongjmp(env,1); +#else if (env_valid) longjmp(env,1); +#endif /* HAVE_SIGLONGJMP */ } /* interruptable read */ static int i_read(fd,buffer,length,timeout) @@ -108,11 +117,15 @@ /* restart read if setjmp returns 0 (first time) or 2. */ /* abort if setjmp returns 1. */ alarm(timeout); +#ifdef HAVE_SIGLONGJMP + if (1 != sigsetjmp(env,1)) { +#else if (1 != setjmp(env)) { +#endif /* HAVE_SIGLONGJMP */ env_valid = TRUE; cc = read(fd,buffer,length); } env_valid = FALSE; i_read_errno = errno; /* errno can be overwritten by the */ Index: exp_strf.c ================================================================== --- exp_strf.c +++ exp_strf.c @@ -96,12 +96,16 @@ extern char *getenv(); static int weeknumber(); adddecl(static int iso8601wknum();) #else +#ifndef strchr extern char *strchr(const char *str, int ch); +#endif + extern char *getenv(const char *v); + static int weeknumber(const struct tm *timeptr, int firstweekday); adddecl(static int iso8601wknum(const struct tm *timeptr);) #endif /* attempt to use strftime to compute timezone, else fallback to */ Index: exp_trap.c ================================================================== --- exp_trap.c +++ exp_trap.c @@ -198,12 +198,16 @@ if (sig == SIGCHLD) { sigchld_count++; } #if 0 /* if we are doing an i_read, restart it */ - if (env_valid && (sig != 0)) longjmp(env,2); -#endif +#ifdef HAVE_SIGLONGJMP + if (env_valid && (sig != 0)) siglongjmp(env,2); +#else + if (env_valid && (sig != 0)) longjmp(env,2); +#endif /* HAVE_SIGLONGJMP */ +#endif /* 0 */ } /*ARGSUSED*/ void exp_rearm_sigchld(interp) Index: exp_tty.c ================================================================== --- exp_tty.c +++ exp_tty.c @@ -632,10 +632,11 @@ memcpy(bufp," ",1); bufp += 1; } *(bufp-1) = '\0'; + old = signal(SIGCHLD, SIG_DFL); systemStatus = system(buf); signal(SIGCHLD, old); /* restore signal handler */ expDiagLogU("system("); expDiagLogU(buf); Index: expect.c ================================================================== --- expect.c +++ expect.c @@ -12,13 +12,10 @@ #include #include #include #include /* for isspace */ #include /* for time(3) */ -#if 0 -#include -#endif #include "expect_cf.h" #ifdef HAVE_SYS_WAIT_H #include @@ -134,16 +131,10 @@ cmd->i_list = 0; } static int i_read_errno;/* place to save errno, if i_read() == -1, so it doesn't get overwritten before we get to read it */ -#if 0 -static jmp_buf env; /* for interruptable read() */ - /* longjmp(env,1) times out the read */ - /* longjmp(env,2) restarts the read */ -static int env_valid = FALSE; /* whether we can longjmp or not */ -#endif #ifdef SIMPLE_EVENT static int alarm_fired; /* if alarm occurs */ #endif @@ -626,16 +617,16 @@ /* save original pattern spec */ /* keywords such as "-timeout" are saved as patterns here */ /* useful for debugging but not otherwise used */ ec.pat = objv[i]; - Tcl_IncrRefCount(ec.pat); + if (eg->duration == EXP_PERMANENT) Tcl_IncrRefCount(ec.pat); i++; if (i < objc) { ec.body = objv[i]; - Tcl_IncrRefCount(ec.body); + if (eg->duration == EXP_PERMANENT) Tcl_IncrRefCount(ec.body); } else { ec.body = NULL; } *(eg->ecd.cases[eg->ecd.count] = ecase_new()) = ec; Index: expect.h ================================================================== --- expect.h +++ expect.h @@ -26,11 +26,11 @@ * Copyright (c) 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: expect.h,v 5.28.1.1.2.2 1999/07/03 03:44:15 libes Exp $ + * RCS: @(#) $Id: expect.h,v 5.28.1.1.2.3 1999/07/07 20:15:03 libes Exp $ */ #ifndef _TCL #define _TCL @@ -336,11 +336,11 @@ * Definitions etc. for regexp(3) routines. * * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], * not the System V one. * - * RCS: @(#) $Id: expect.h,v 5.28.1.1.2.2 1999/07/03 03:44:15 libes Exp $ + * RCS: @(#) $Id: expect.h,v 5.28.1.1.2.3 1999/07/07 20:15:03 libes Exp $ */ #ifndef _REGEXP #define _REGEXP 1 @@ -424,11 +424,16 @@ EXTERN char *exp_stty_init; /* initial stty args */ EXTERN int exp_ttycopy; /* copy tty parms from /dev/tty */ EXTERN int exp_ttyinit; /* set tty parms to sane state */ EXTERN int exp_console; /* redirect console */ -EXTERN jmp_buf exp_readenv; /* for interruptable read() */ +#ifdef HAVE_SIGLONGJMP +sigjmp_buf exp_readenv; /* for interruptable read() */ +#else +jmp_buf exp_readenv; /* for interruptable read() */ +#endif /* HAVE_SIGLONGJMP */ + EXTERN int exp_reading; /* whether we can longjmp or not */ #define EXP_ABORT 1 /* abort read */ #define EXP_RESTART 2 /* restart read */ EXTERN int exp_is_debugging; Index: expect_cf.h.in ================================================================== --- expect_cf.h.in +++ expect_cf.h.in @@ -41,10 +41,11 @@ #undef HAVE_SYSCONF #undef SIMPLE_EVENT #undef HAVE_STRFTIME #undef HAVE_MEMMOVE #undef HAVE_TIMEZONE /* timezone() a la Pyramid */ +#undef HAVE_SIGLONGJMP #undef HAVE_STRCHR #ifndef HAVE_STRCHR #define strchr(s,c) index(s,c) #endif /* HAVE_STRCHR */