From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id XAA07834 for ; Wed, 5 Jul 1995 23:37:00 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA21686 (5.65c/Gatech-10.0-IDA for ); Wed, 5 Jul 1995 09:36:44 -0400 Received: by math (5.x/SMI-SVR4) id AA18866; Wed, 5 Jul 1995 09:33:46 -0400 Resent-Date: Wed, 5 Jul 1995 14:34:31 +0100 (BST) Old-Return-Path: From: Zefram Message-Id: <15723.199507051334@stone.dcs.warwick.ac.uk> Subject: Updated history expansion patch To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Wed, 5 Jul 1995 14:34:31 +0100 (BST) X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]5932.82 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-Id: <"8PX_P1.0.ec4.vIf-l"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/152 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I thought I had sent this to the list, but it hasn't appeared here. Sorry if you get it twice. -----BEGIN PGP SIGNED MESSAGE----- The patch below is an updated version of my history reference infinite-loop bug fix (message 30), which wasn't in beta10. This version of the patch is made after the history/input patch and my completion patch, but should only depend on the former. I think it will apply with fuzz even if that patch hasn't been applied. The update is not a change in functionality; I simply found that the old patch won't apply to the new source. -zefram *** Src/zle_tricky.c.old Wed Jul 5 02:37:32 1995 --- Src/zle_tricky.c Wed Jul 5 02:50:56 1995 *************** *** 957,963 **** im &= ~2; /* We reached the end. */ ! if (tok == ENDINPUT) break; if (tok == BAR || tok == AMPER || tok == BARAMP || tok == DBAR || tok == DAMPER) --- 957,963 ---- im &= ~2; /* We reached the end. */ ! if (tok == ENDINPUT || tok == LEXERR) break; if (tok == BAR || tok == AMPER || tok == BARAMP || tok == DBAR || tok == DAMPER) *************** *** 1009,1017 **** if (clwpos == i++ && addedx) chuck(&clwords[i - 1][((cs - wb - 1) >= sl) ? (sl - 1) : (cs - wb - 1)]); ! } ! while (tok != LEXERR && tok != ENDINPUT && ! (tok != SEPER || (zleparse && !tt0))); /* Calculate the number of words stored in the clwords array. */ clwnum = (tt || !i) ? i : i - 1; zsfree(clwords[clwnum]); --- 1009,1016 ---- if (clwpos == i++ && addedx) chuck(&clwords[i - 1][((cs - wb - 1) >= sl) ? (sl - 1) : (cs - wb - 1)]); ! } while (tok != LEXERR && tok != ENDINPUT && ! (tok != SEPER || (zleparse && !tt0))); /* Calculate the number of words stored in the clwords array. */ clwnum = (tt || !i) ? i : i - 1; zsfree(clwords[clwnum]); *************** *** 1020,1026 **** lincmd = cp; linredir = rd; ! if (!t0 || t0 == ENDINPUT) { /* There was no word (empty line). */ s = ztrdup(""); we = wb = cs; --- 1019,1025 ---- lincmd = cp; linredir = rd; ! if (!t0 || t0 == ENDINPUT || t0 == LEXERR) { /* There was no word (empty line). */ s = ztrdup(""); we = wb = cs; *************** *** 2930,2942 **** noaliases = 1; do { ctxtlex(); ! if (tok == ENDINPUT) break; if (!first && tokstr && *tokstr) addlinknode(foo, ztrdup(tokstr)); first = 0; ! } ! while (tok != ENDINPUT); noaliases = 0; strinend(); inpop(); --- 2929,2940 ---- noaliases = 1; do { ctxtlex(); ! if (tok == ENDINPUT || tok == LEXERR) break; if (!first && tokstr && *tokstr) addlinknode(foo, ztrdup(tokstr)); first = 0; ! } while (tok != ENDINPUT && tok != LEXERR); noaliases = 0; strinend(); inpop(); *************** *** 3795,3802 **** noerrs = 1; do { ctxtlex(); ! } ! while (tok != ENDINPUT && zleparse); noerrs = ne; noaliases = 0; popheap(); --- 3793,3799 ---- noerrs = 1; do { ctxtlex(); ! } while (tok != ENDINPUT && tok != LEXERR && zleparse); noerrs = ne; noaliases = 0; popheap(); *************** *** 3869,3875 **** do { curlincmd = incmdpos; ctxtlex(); ! if (tok == ENDINPUT) break; if (tok == STRING && curlincmd) { zsfree(s); --- 3866,3872 ---- do { curlincmd = incmdpos; ctxtlex(); ! if (tok == ENDINPUT || tok == LEXERR) break; if (tok == STRING && curlincmd) { zsfree(s); *************** *** 3878,3884 **** cmdwe = ll + 1 - inbufct; } } ! while (tok != ENDINPUT && zleparse); popheap(); strinend(); inpop(); --- 3875,3881 ---- cmdwe = ll + 1 - inbufct; } } ! while (tok != ENDINPUT && tok != LEXERR && zleparse); popheap(); strinend(); inpop(); *** Src/zle_tricky.c.old Wed Jul 5 02:37:32 1995 --- Src/zle_tricky.c Wed Jul 5 02:52:03 1995 *************** *** 957,963 **** im &= ~2; /* We reached the end. */ ! if (tok == ENDINPUT) break; if (tok == BAR || tok == AMPER || tok == BARAMP || tok == DBAR || tok == DAMPER) --- 957,963 ---- im &= ~2; /* We reached the end. */ ! if (tok == ENDINPUT || tok == LEXERR) break; if (tok == BAR || tok == AMPER || tok == BARAMP || tok == DBAR || tok == DAMPER) *************** *** 1009,1017 **** if (clwpos == i++ && addedx) chuck(&clwords[i - 1][((cs - wb - 1) >= sl) ? (sl - 1) : (cs - wb - 1)]); ! } ! while (tok != LEXERR && tok != ENDINPUT && ! (tok != SEPER || (zleparse && !tt0))); /* Calculate the number of words stored in the clwords array. */ clwnum = (tt || !i) ? i : i - 1; zsfree(clwords[clwnum]); --- 1009,1016 ---- if (clwpos == i++ && addedx) chuck(&clwords[i - 1][((cs - wb - 1) >= sl) ? (sl - 1) : (cs - wb - 1)]); ! } while (tok != LEXERR && tok != ENDINPUT && ! (tok != SEPER || (zleparse && !tt0))); /* Calculate the number of words stored in the clwords array. */ clwnum = (tt || !i) ? i : i - 1; zsfree(clwords[clwnum]); *************** *** 1020,1026 **** lincmd = cp; linredir = rd; ! if (!t0 || t0 == ENDINPUT) { /* There was no word (empty line). */ s = ztrdup(""); we = wb = cs; --- 1019,1025 ---- lincmd = cp; linredir = rd; ! if (!t0 || t0 == ENDINPUT || t0 == LEXERR) { /* There was no word (empty line). */ s = ztrdup(""); we = wb = cs; *************** *** 2930,2942 **** noaliases = 1; do { ctxtlex(); ! if (tok == ENDINPUT) break; if (!first && tokstr && *tokstr) addlinknode(foo, ztrdup(tokstr)); first = 0; ! } ! while (tok != ENDINPUT); noaliases = 0; strinend(); inpop(); --- 2929,2940 ---- noaliases = 1; do { ctxtlex(); ! if (tok == ENDINPUT || tok == LEXERR) break; if (!first && tokstr && *tokstr) addlinknode(foo, ztrdup(tokstr)); first = 0; ! } while (tok != ENDINPUT && tok != LEXERR); noaliases = 0; strinend(); inpop(); *************** *** 3795,3802 **** noerrs = 1; do { ctxtlex(); ! } ! while (tok != ENDINPUT && zleparse); noerrs = ne; noaliases = 0; popheap(); --- 3793,3799 ---- noerrs = 1; do { ctxtlex(); ! } while (tok != ENDINPUT && tok != LEXERR && zleparse); noerrs = ne; noaliases = 0; popheap(); *************** *** 3869,3875 **** do { curlincmd = incmdpos; ctxtlex(); ! if (tok == ENDINPUT) break; if (tok == STRING && curlincmd) { zsfree(s); --- 3866,3872 ---- do { curlincmd = incmdpos; ctxtlex(); ! if (tok == ENDINPUT || tok == LEXERR) break; if (tok == STRING && curlincmd) { zsfree(s); *************** *** 3877,3884 **** cmdwb = ll - wordbeg; cmdwe = ll + 1 - inbufct; } ! } ! while (tok != ENDINPUT && zleparse); popheap(); strinend(); inpop(); --- 3874,3880 ---- cmdwb = ll - wordbeg; cmdwe = ll + 1 - inbufct; } ! } while (tok != ENDINPUT && tok != LEXERR && zleparse); popheap(); strinend(); inpop(); -----BEGIN PGP SIGNATURE----- Version: 2.6.i iQBVAgUBL/nwYWWJ8JfKi+e9AQF6zQH/QMzkmp0DWZU+e+3dnbeBv6duj/nbtogo S3TKNlTiMulXsF32NZMKsr0ThvXYXa7i8xmOw1OZ1zz4tOGciM6Bxw== =Bop0 -----END PGP SIGNATURE-----