Update of /cvsroot/fink/dists/10.4/stable/main/finkinfo/utils In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31388
Modified Files: expect.patch Log Message: update to expect 5.45 Index: expect.patch =================================================================== RCS file: /cvsroot/fink/dists/10.4/stable/main/finkinfo/utils/expect.patch,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- expect.patch 5 Sep 2009 16:39:40 -0000 1.1 +++ expect.patch 30 Sep 2013 20:37:58 -0000 1.2 @@ -1,234 +1,84 @@ -diff -up expect-5.43/exp_chan.c.spawn expect-5.43/exp_chan.c ---- expect-5.43/exp_chan.c.spawn 2005-02-08 03:01:20.000000000 +0100 -+++ expect-5.43/exp_chan.c 2008-09-25 12:22:14.000000000 +0200 -@@ -622,6 +622,7 @@ expCreateChannel(interp,fdin,fdout,pid) - esPtr->buffer = Tcl_NewStringObj("",0); - Tcl_IncrRefCount(esPtr->buffer); - esPtr->umsize = exp_default_match_max; -+ esPtr->umsize_changed = exp_default_match_max_changed; - /* this will reallocate object with an appropriate sized buffer */ - expAdjust(esPtr); - -diff -up expect-5.43/exp_command.h.spawn expect-5.43/exp_command.h ---- expect-5.43/exp_command.h.spawn 2004-07-30 17:35:28.000000000 +0200 -+++ expect-5.43/exp_command.h 2008-09-25 12:22:14.000000000 +0200 -@@ -30,6 +30,7 @@ would appreciate credit if this program - EXTERN char * exp_get_var _ANSI_ARGS_((Tcl_Interp *,char *)); +--- expect5.45/exp_inter.c.orig 2013-07-14 13:25:14.000000000 -0400 ++++ expect5.45/exp_inter.c 2013-07-14 13:30:18.000000000 -0400 +@@ -404,8 +404,8 @@ + int matchBytes) + { + int seenBytes; /* either printed or echoed */ +- int echoBytes; +- int offsetBytes; ++ int echoBytes = 0; ++ int offsetBytes = 0; - EXTERN int exp_default_match_max; -+EXTERN int exp_default_match_max_changed; - EXTERN int exp_default_parity; - EXTERN int exp_default_rm_nulls; - EXTERN int exp_default_close_on_eof; -@@ -103,6 +104,7 @@ typedef struct ExpState { - int msize; /* # of bytes that buffer can hold (max) */ - int umsize; /* # of bytes (min) that is guaranteed to match */ - /* this comes from match_max command */ -+ int umsize_changed; /* is umsize changed by user? */ - int printed; /* # of bytes written to stdout (if logging on) */ - /* but not actually returned via a match yet */ - int echoed; /* additional # of bytes (beyond "printed" above) */ -diff -up expect-5.43/expect.c.spawn expect-5.43/expect.c ---- expect-5.43/expect.c.spawn 2004-07-07 01:26:02.000000000 +0200 -+++ expect-5.43/expect.c 2008-09-25 12:22:14.000000000 +0200 -@@ -41,8 +41,17 @@ would appreciate credit if this program - #include "tcldbg.h" - #endif + /* write is unlikely to fail, since we just read from same descriptor */ + seenBytes = esPtr->printed + esPtr->echoed; +@@ -437,7 +437,7 @@ + int key) + { + Tcl_UniChar *eobOld; /* old end of buffer */ +- int cc; ++ int cc = 0; + int numchars; + Tcl_UniChar *str; -+/* The initial length is 2000. We increment it by 2000. The maximum -+ is 8MB (0x800000). */ -+#define EXP_MATCH_MAX 2000 -+#define EXP_MATCH_INC 2000 -+#define EXP_MATCH_STEP_LIMIT 0x700000 -+#define EXP_MATCH_LIMIT 0x800000 -+#define EXP_MATCH_LIMIT_QUOTE "0x800000" -+ - /* initial length of strings that we can guarantee patterns can match */ --int exp_default_match_max = 2000; -+int exp_default_match_max = EXP_MATCH_MAX; -+int exp_default_match_max_changed = 0; - #define INIT_EXPECT_TIMEOUT_LIT "10" /* seconds */ - #define INIT_EXPECT_TIMEOUT 10 /* seconds */ - int exp_default_parity = TRUE; -@@ -1619,6 +1628,76 @@ expNullStrip(obj,offsetBytes) - return newsize; - } +--- expect5.45/expect.c.orig 2013-07-14 13:28:09.000000000 -0400 ++++ expect5.45/expect.c 2010-10-26 18:09:36.000000000 -0400 +@@ -2899,7 +2899,7 @@ + int def = FALSE; + char* chan = NULL; + int i; +- ExpState *esPtr; ++ ExpState *esPtr = NULL; -+/* returns # of bytes until we see a newline at the end or EOF. */ -+/*ARGSUSED*/ -+static int -+expReadNewLine(interp,esPtr,save_flags) /* INTL */ -+Tcl_Interp *interp; -+ExpState *esPtr; -+int save_flags; -+{ -+ int size; -+ int exp_size; -+ int full_size; -+ int count; -+ char *str; -+ -+ count = 0; -+ for (;;) { -+ exp_size = expSizeGet(esPtr); -+ -+ /* When we reach the limit, we will only read one char at a -+ time. */ -+ if (esPtr->umsize >= EXP_MATCH_STEP_LIMIT) -+ size = TCL_UTF_MAX; -+ else -+ size = exp_size; -+ -+ if (exp_size + TCL_UTF_MAX >= esPtr->msize) { -+ if (esPtr->umsize >= EXP_MATCH_LIMIT) { -+ expDiagLogU("WARNING: interact buffer is full. probably your program\r\n"); -+ expDiagLogU("is not interactive or has a very long output line. The\r\n"); -+ expDiagLogU("current limit is " EXP_MATCH_LIMIT_QUOTE ".\r\n"); -+ expDiagLogU("Dumping first half of buffer in order to continue\r\n"); -+ expDiagLogU("Recommend you enlarge the buffer.\r\n"); -+ exp_buffer_shuffle(interp,esPtr,save_flags,EXPECT_OUT,"expect"); -+ return count; -+ } -+ else { -+ esPtr->umsize += EXP_MATCH_INC; -+ expAdjust(esPtr); -+ } -+ } -+ -+ full_size = esPtr->msize - (size / TCL_UTF_MAX); -+ size = Tcl_ReadChars(esPtr->channel, -+ esPtr->buffer, -+ full_size, -+ 1 /* append */); -+ if (size > 0) { -+ count += size; -+ /* We try again if there are more to read and we haven't -+ seen a newline at the end. */ -+ if (size == full_size) { -+ str = Tcl_GetStringFromObj(esPtr->buffer, &size); -+ if (str[size - 1] != '\n') -+ continue; -+ } -+ } -+ else { -+ /* It is even trickier. We got an error from read. We have -+ to recover from it. Let's make sure the size of -+ buffer is correct. It can be corrupted. */ -+ str = Tcl_GetString(esPtr->buffer); -+ Tcl_SetObjLength(esPtr->buffer, strlen(str)); -+ } -+ -+ break; -+ } -+ -+ return count; -+} -+ - /* returns # of bytes read or (non-positive) error of form EXP_XXX */ - /* returns 0 for end of file */ - /* If timeout is non-zero, set an alarm before doing the read, else assume */ -@@ -1633,6 +1712,8 @@ int save_flags; + for (i=1; i<objc; i++) { + char *name; +--- expect5.45/exp_log.c.orig 2013-07-14 13:41:34.000000000 -0400 ++++ expect5.45/exp_log.c 2013-07-14 13:41:56.000000000 -0400 +@@ -85,7 +85,7 @@ + Tcl_UniChar *buf; + int lenChars; { - int cc = EXP_TIMEOUT; - int size = expSizeGet(esPtr); -+ int full_size; -+ int count; +- int wc; ++ int wc = 0; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if (size + TCL_UTF_MAX >= esPtr->msize) - exp_buffer_shuffle(interp,esPtr,save_flags,EXPECT_OUT,"expect"); -@@ -1649,11 +1730,43 @@ int save_flags; - } - #endif + if (esPtr->valid) +--- expect5.45/expect.c.orig 2013-07-14 13:43:25.000000000 -0400 ++++ expect5.45/expect.c 2013-07-14 13:44:06.000000000 -0400 +@@ -2363,7 +2363,12 @@ -- -+ /* FIXME: If we ask less than what is available in the tcl buffer -+ when tcl has seen EOF, we will throw away the remaining data -+ since the next read will get EOF. Since expect is line-oriented, -+ we exand our buffer to get EOF or the next newline at the end of -+ the input buffer. I don't know if it is the right fix. H.J. */ -+ count = 0; -+ full_size = esPtr->msize - (size / TCL_UTF_MAX); - cc = Tcl_ReadChars(esPtr->channel, -- esPtr->buffer, -- esPtr->msize - (size / TCL_UTF_MAX), -- 1 /* append */); -+ esPtr->buffer, -+ full_size, -+ 1 /* append */); -+ if (cc > 0) { -+ count += cc; -+ /* It gets very tricky. There are more to read. We will expand -+ our buffer and get EOF or a newline at the end unless the -+ buffer length has been changed. */ -+ if (cc == full_size) { -+ char *str; -+ str = Tcl_GetStringFromObj(esPtr->buffer, &size); -+ if (str[size - 1] != '\n') { -+ if (esPtr->umsize_changed) { -+ char buf[20]; /* big enough for 64bit int in hex. */ -+ snprintf(buf,sizeof(buf),"0x%x", esPtr->umsize); -+ expDiagLogU("WARNING: interact buffer is not large enough to hold\r\n"); -+ expDiagLogU("all output. probably your program is not interactive or\r\n"); -+ expDiagLogU("has a very long output line. The current limit is "); -+ expDiagLogU(buf); -+ expDiagLogU(".\r\n"); -+ } -+ else { -+ cc = expReadNewLine(interp,esPtr,save_flags); -+ if (cc > 0) -+ count += cc; -+ } + /* "!e" means no case matched - transfer by default */ + if (!e || e->transfer) { +- int remainder = numchars-match; ++ int remainder; ++ if (match > numchars) { ++ match = numchars; ++ eo->matchlen = match; + } -+ } -+ } - i_read_errno = errno; - - #ifdef SIMPLE_EVENT -@@ -1674,7 +1787,7 @@ int save_flags; - } - } - #endif -- return cc; -+ return count > 0 ? count : cc; - } - - /* -@@ -2751,8 +2864,14 @@ char **argv; - return(TCL_ERROR); - } - -- if (Default) exp_default_match_max = size; -- else esPtr->umsize = size; -+ if (Default) { -+ exp_default_match_max = size; -+ exp_default_match_max_changed = 1; -+ } -+ else { -+ esPtr->umsize = size; -+ esPtr->umsize_changed = 1; -+ } - - return(TCL_OK); ++ remainder = numchars-match; + /* delete matched chars from input buffer */ + esPtr->printed -= match; + if (numchars != 0) { +--- expect5.45/exp_clib.c.orig 2013-07-15 08:54:50.000000000 -0400 ++++ expect5.45/exp_clib.c 2013-07-15 08:55:35.000000000 -0400 +@@ -1476,8 +1476,8 @@ + char *str; + { + if (exp_is_debugging) { +- fprintf(stderr,str); +- if (exp_logfile) fprintf(exp_logfile,str); ++ fprintf(stderr,"%s",str); ++ if (exp_logfile) fprintf(exp_logfile,"%s",str); + } } -diff -up expect-5.43/Dbg.c.tcl8.5 expect-5.43/Dbg.c ---- expect-5.43/Dbg.c.tcl8.5 2002-03-23 05:11:54.000000000 +0100 -+++ expect-5.43/Dbg.c 2008-09-25 12:25:40.000000000 +0200 -@@ -10,6 +10,7 @@ would appreciate credit if this program - - #include <stdio.h> -+#include "expect_cf.h" - #include "tcldbgcf.h" - #if 0 - /* tclInt.h drags in stdlib. By claiming no-stdlib, force it to drag in */ -diff -up expect-5.43/exp_inter.c.tcl8.5 expect-5.43/exp_inter.c ---- expect-5.43/exp_inter.c.tcl8.5 2004-08-18 04:03:00.000000000 +0200 -+++ expect-5.43/exp_inter.c 2008-09-25 12:25:40.000000000 +0200 -@@ -36,6 +36,7 @@ would appreciate credit if this program - #include <ctype.h> - - #include "tcl.h" -+#include "tclInt.h" - #include "string.h" +--- expect5.45/pty_termios.c.orig 2013-07-15 08:56:10.000000000 -0400 ++++ expect5.45/pty_termios.c 2013-07-15 08:56:40.000000000 -0400 +@@ -641,7 +641,7 @@ + if (0 > (slave = open(slave_name, O_RDWR))) { + static char buf[500]; + exp_pty_error = buf; +- sprintf(exp_pty_error,"open(%s,rw) = %d (%s)",slave_name,slave,expErrnoMsg(errno)); ++ sprintf(exp_pty_error,"open(%s,rw) = %d (%d)",slave_name,slave,expErrnoMsg(errno)); + return(-1); + } - #include "exp_tty_in.h" ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk _______________________________________________ Fink-commits mailing list Fink-commits@lists.sourceforge.net http://news.gmane.org/gmane.os.apple.fink.cvs