Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!dalcs!garfield!michael From: michael@garfield.UUCP Newsgroups: comp.bugs.4bsd Subject: Bug in vi (v3.7) - modeline problem Message-ID: <4124@garfield.UUCP> Date: Wed, 4-Nov-87 23:47:13 EST Article-I.D.: garfield.4124 Posted: Wed Nov 4 23:47:13 1987 Date-Received: Sat, 7-Nov-87 15:36:25 EST Organization: CS Dept., Memorial U. of Newfoundland, St. John's Lines: 49 Keywords: bug, fix, vi, kgb Subject: Bug in vi (v3.7) - modeline problem Index: ex_io.c Description: Vi will appear to hang given a +n or +/pattern on the command line when used with the modeline feature. Repeat-by: Create a file with a "vi: se wm=5:" in the first or last 5 lines. Set modeline (i.e. "set modeline") in EXINIT or ~/.exrc or ./.exrc. Try to start up vi with "vi +2 file". Note that it prints out the name, line and character count and nothing else.... Fix: Set peekc to 0 before doing the +n command in rop3() - apply following context diff to ex_io.c. *** ex_io.c.old Thu Nov 5 01:04:23 1987 --- ex_io.c Thu Nov 5 01:07:49 1987 *************** *** 463,471 **** --- 463,488 ---- if (addr > dol) addr = dol; if (firstpat) { + /* + * Save and restore peekc/globp + * this is probably not needed, but + * is done out of paranoia. The + * only thing which needs to be done is + * to set peekc to 0. This fixes a bug + * that occurs when modeline is used in + * combination with "+n" on the command line + */ + char *oglobp; + int savepeekc; + + oglobp = globp; + savepeekc = peekc; + peekc = 0; globp = (*firstpat) ? firstpat : "$"; commands(1,1); firstpat = 0; + globp = oglobp; + peekc = savepeekc; } else if (addr >= one) { if (inopen) dot = addr;