From f0f2d980fa49bb059efb86c4e776f6db6e059854 Mon Sep 17 00:00:00 2001 From: Mark Horton Date: Fri, 24 Oct 1980 00:21:45 -0800 Subject: [PATCH] fixed various bugs prior to 3.6 release SCCS-vsn: usr.bin/ex/ex_cmds.c 6.2 SCCS-vsn: usr.bin/ex/ex_re.c 6.2 SCCS-vsn: usr.bin/ex/ex_temp.c 6.2 SCCS-vsn: usr.bin/ex/ex_vadj.c 6.2 SCCS-vsn: usr.bin/ex/ex_vget.c 6.2 SCCS-vsn: usr.bin/ex/ex_vmain.c 6.2 SCCS-vsn: usr.bin/ex/ex_voper.c 6.2 SCCS-vsn: usr.bin/ex/ex_vops.c 6.2 SCCS-vsn: usr.bin/ex/ex_vops2.c 6.2 SCCS-vsn: usr.bin/ex/ex_vops3.c 6.2 SCCS-vsn: usr.bin/ex/Makefile 6.3 SCCS-vsn: usr.bin/ex/ex_io.c 6.2 --- usr/src/usr.bin/ex/Makefile | 2 +- usr/src/usr.bin/ex/ex_cmds.c | 4 ++-- usr/src/usr.bin/ex/ex_io.c | 21 ++++++++++++++++----- usr/src/usr.bin/ex/ex_re.c | 11 ++++++++++- usr/src/usr.bin/ex/ex_temp.c | 5 ++++- usr/src/usr.bin/ex/ex_vadj.c | 14 +------------- usr/src/usr.bin/ex/ex_vget.c | 13 ++++++++++--- usr/src/usr.bin/ex/ex_vmain.c | 14 +++++++++++++- usr/src/usr.bin/ex/ex_voper.c | 6 +++++- usr/src/usr.bin/ex/ex_vops.c | 3 ++- usr/src/usr.bin/ex/ex_vops2.c | 9 +++++++-- usr/src/usr.bin/ex/ex_vops3.c | 6 ++++-- 12 files changed, 75 insertions(+), 33 deletions(-) diff --git a/usr/src/usr.bin/ex/Makefile b/usr/src/usr.bin/ex/Makefile index 5e73dfd938..75277b1efa 100644 --- a/usr/src/usr.bin/ex/Makefile +++ b/usr/src/usr.bin/ex/Makefile @@ -25,7 +25,7 @@ LIBDIR= /usr/lib FOLD= ${BINDIR}/fold CTAGS= ${BINDIR}/ctags XSTR= ${BINDIR}/xstr -DEBUGFLAGS= -DMDEBUG -DTRACE -g +DEBUGFLAGS= -DTRACE -g NONDEBUGFLAGS= -O DEB= ${NONDEBUGFLAGS} # or ${DEBUGFLAGS} to to debug # NOTE: TIMEBOMB is NOT intended for production use, or even to diff --git a/usr/src/usr.bin/ex/ex_cmds.c b/usr/src/usr.bin/ex/ex_cmds.c index dc0ba6a193..413654967b 100644 --- a/usr/src/usr.bin/ex/ex_cmds.c +++ b/usr/src/usr.bin/ex/ex_cmds.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_cmds.c 6.1 %G%"; +static char *sccsid = "@(#)ex_cmds.c 6.2 %G%"; #include "ex.h" #include "ex_argv.h" #include "ex_temp.h" @@ -654,7 +654,7 @@ suspend: /* version */ tail("version"); setNAEOL(); - printf("@(#) Version 3.6, %G%. (EXPERIMENTAL version 3.6, Oct 1980)"+5); + printf("@(#) Version 3.6, %G%."+5); noonl(); continue; diff --git a/usr/src/usr.bin/ex/ex_io.c b/usr/src/usr.bin/ex/ex_io.c index a4f969e67b..f87721a7a0 100644 --- a/usr/src/usr.bin/ex/ex_io.c +++ b/usr/src/usr.bin/ex/ex_io.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_io.c 6.1 %G%"; +static char *sccsid = "@(#)ex_io.c 6.2 %G%"; #include "ex.h" #include "ex_argv.h" #include "ex_temp.h" @@ -352,12 +352,23 @@ rop(c) break; switch (magic) { - case 0405: - case 0407: - case 0410: - case 0411: + case 0405: /* Interdata? overlay */ + case 0407: /* unshared */ + case 0410: /* shared text */ + case 0411: /* separate I/D */ + case 0413: /* VM/Unix demand paged */ + case 0430: /* PDP-11 Overlay shared */ + case 0431: /* PDP-11 Overlay sep I/D */ error(" Executable"); + /* + * We do not forbid the editing of portable archives + * because it is reasonable to edit them, especially + * if they are archives of text files. This is + * especially useful if you archive source files together + * and copy them to another system with ~%take, since + * the files sometimes show up munged and must be fixed. + */ case 0177545: case 0177555: error(" Archive"); diff --git a/usr/src/usr.bin/ex/ex_re.c b/usr/src/usr.bin/ex/ex_re.c index 1d4677c680..c9c433a45b 100644 --- a/usr/src/usr.bin/ex/ex_re.c +++ b/usr/src/usr.bin/ex/ex_re.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_re.c 6.1 %G%"; +static char *sccsid = "@(#)ex_re.c 6.2 %G%"; #include "ex.h" #include "ex_re.h" @@ -81,6 +81,14 @@ out: if (a1 >= addr1 && a1 <= addr2 && execute(0, a1) == k) *a1 |= 01; } +#ifdef notdef +/* + * This code is commented out for now. The problem is that we don't + * fix up the undo area the way we should. Basically, I think what has + * to be done is to copy the undo area down (since we shrunk everything) + * and move the various pointers into it down too. I will do this later + * when I have time. (Mark, 10-20-80) + */ /* * Special case: g/.../d (avoid n^2 algorithm) */ @@ -88,6 +96,7 @@ out: gdelete(); return; } +#endif if (inopen) inopen = -1; /* diff --git a/usr/src/usr.bin/ex/ex_temp.c b/usr/src/usr.bin/ex/ex_temp.c index 147b66db88..ffba5c1820 100644 --- a/usr/src/usr.bin/ex/ex_temp.c +++ b/usr/src/usr.bin/ex/ex_temp.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_temp.c 6.1 %G%"; +static char *sccsid = "@(#)ex_temp.c 6.2 %G%"; #include "ex.h" #include "ex_temp.h" #include "ex_vis.h" @@ -559,6 +559,7 @@ YANKreg(c) struct rbuf arbuf; register line *addr; register struct strreg *sp; + char savelb[LBSIZE]; if (isdigit(c)) kshift(); @@ -575,6 +576,7 @@ YANKreg(c) rblock = 0; rnleft = 0; } + CP(savelb,linebuf); for (addr = addr1; addr <= addr2; addr++) { getline(*addr); if (sp->rg_flags) { @@ -587,6 +589,7 @@ YANKreg(c) } rbflush(); killed(); + CP(linebuf,savelb); } kshift() diff --git a/usr/src/usr.bin/ex/ex_vadj.c b/usr/src/usr.bin/ex/ex_vadj.c index 599a26efee..6e95554fb4 100644 --- a/usr/src/usr.bin/ex/ex_vadj.c +++ b/usr/src/usr.bin/ex/ex_vadj.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_vadj.c 6.1 %G%"; +static char *sccsid = "@(#)ex_vadj.c 6.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -89,10 +89,6 @@ vreopen(p, lineno, l) register int d; register struct vlinfo *vp = &vlinfo[l]; -#ifdef ADEBUG - if (trace) - tfixnl(), fprintf(trace, "vreopen(%d, %d, %d)\n", p, lineno, l); -#endif d = vp->vdepth; if (d == 0 || (vp->vflags & VDIRT)) vp->vdepth = d = vdepth(); @@ -116,15 +112,7 @@ vreopen(p, lineno, l) * necessary to determine which way to go. */ vigoto(p, 0); -#ifdef TRACE - if (trace) - fprintf(trace, "before pline in vreopen\n"); -#endif pline(lineno); -#ifdef TRACE - if (trace) - fprintf(trace, "after pline in vreopen\n"); -#endif /* * When we are typing part of a line for hardcopy open, don't diff --git a/usr/src/usr.bin/ex/ex_vget.c b/usr/src/usr.bin/ex/ex_vget.c index 7ef7a3b523..12a3e9794b 100644 --- a/usr/src/usr.bin/ex/ex_vget.c +++ b/usr/src/usr.bin/ex/ex_vget.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_vget.c 6.1 %G%"; +static char *sccsid = "@(#)ex_vget.c 6.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -565,6 +565,7 @@ vudump(s) char *s; { register line *p; + char savelb[1024]; if (!trace) return; @@ -572,10 +573,16 @@ char *s; s, undkind, vundkind, lineno(unddel), lineno(undap1), lineno(undap2)); fprintf(trace, " undadot=%d, dot=%d, dol=%d, unddol=%d, truedol=%d\n", lineno(undadot), lineno(dot), lineno(dol), lineno(unddol), lineno(truedol)); - fprintf(trace, " ["); - for (p=zero+1; p<=truedol; p++) + fprintf(trace, " [\n"); + CP(savelb, linebuf); + fprintf(trace, "linebuf = '%s'\n", linebuf); + for (p=zero+1; p<=truedol; p++) { fprintf(trace, "%o ", *p); + getline(*p); + fprintf(trace, "'%s'\n", linebuf); + } fprintf(trace, "]\n"); + CP(linebuf, savelb); } #endif diff --git a/usr/src/usr.bin/ex/ex_vmain.c b/usr/src/usr.bin/ex/ex_vmain.c index 96144f020a..2791881c1c 100644 --- a/usr/src/usr.bin/ex/ex_vmain.c +++ b/usr/src/usr.bin/ex/ex_vmain.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_vmain.c 6.1 %G%"; +static char *sccsid = "@(#)ex_vmain.c 6.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -309,6 +309,10 @@ reread: * ^D Scroll down. Like scroll up. */ case CTRL(d): +#ifdef TRACE + if (trace) + fprintf(trace, "before vdown in ^D, dot=%d, wdot=%d, dol=%d\n", lineno(dot), lineno(wdot), lineno(dol)); +#endif if (hadcnt) vSCROLL = cnt; cnt = vSCROLL; @@ -318,7 +322,15 @@ reread: ind = 0; vmoving = 0; vdown(cnt, ind, 1); +#ifdef TRACE + if (trace) + fprintf(trace, "before vnline in ^D, dot=%d, wdot=%d, dol=%d\n", lineno(dot), lineno(wdot), lineno(dol)); +#endif vnline(NOSTR); +#ifdef TRACE + if (trace) + fprintf(trace, "after vnline in ^D, dot=%d, wdot=%d, dol=%d\n", lineno(dot), lineno(wdot), lineno(dol)); +#endif continue; /* diff --git a/usr/src/usr.bin/ex/ex_voper.c b/usr/src/usr.bin/ex/ex_voper.c index d6f055686a..fb8df380c0 100644 --- a/usr/src/usr.bin/ex/ex_voper.c +++ b/usr/src/usr.bin/ex/ex_voper.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_voper.c 6.1 %G%"; +static char *sccsid = "@(#)ex_voper.c 6.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -215,6 +215,10 @@ ein: case '%': vsave(); i = lmatchp((line *) 0); +#ifdef TRACE + if (trace) + fprintf(trace, "after lmatchp in %, dot=%d, wdot=%d, dol=%d\n", lineno(dot), lineno(wdot), lineno(dol)); +#endif getDOT(); forbid(!i); if (opf != vmove) diff --git a/usr/src/usr.bin/ex/ex_vops.c b/usr/src/usr.bin/ex/ex_vops.c index ea62f31b3c..177472709c 100644 --- a/usr/src/usr.bin/ex/ex_vops.c +++ b/usr/src/usr.bin/ex/ex_vops.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_vops.c 6.1 %G%"; +static char *sccsid = "@(#)ex_vops.c 6.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -97,6 +97,7 @@ bool show; /* if true update the screen */ else vreplace(undap1 - addr, undap2 - undap1, undkind == UNDPUT ? 0 : unddol - dol); +vudump("before big undo"); savenote = notecnt; undo(1); if (show && (vundkind != VMCHNG || addr != dot)) diff --git a/usr/src/usr.bin/ex/ex_vops2.c b/usr/src/usr.bin/ex/ex_vops2.c index 575b5a95b9..a03cdbb10d 100644 --- a/usr/src/usr.bin/ex/ex_vops2.c +++ b/usr/src/usr.bin/ex/ex_vops2.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_vops2.c 6.1 %G%"; +static char *sccsid = "@(#)ex_vops2.c 6.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -285,7 +285,12 @@ vappend(ch, cnt, indent) doomed = 0; } i = vreopen(LINE(vcline), lineDOT(), vcline); - doomed = savedoomed; +#ifdef TRACE + if (trace) + fprintf(trace, "restoring doomed from %d to %d\n", doomed, savedoomed); +#endif + if (ch == 'R') + doomed = savedoomed; } /* diff --git a/usr/src/usr.bin/ex/ex_vops3.c b/usr/src/usr.bin/ex/ex_vops3.c index 1f2e366012..cd89a6eb8a 100644 --- a/usr/src/usr.bin/ex/ex_vops3.c +++ b/usr/src/usr.bin/ex/ex_vops3.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char *sccsid = "@(#)ex_vops3.c 6.1 %G%"; +static char *sccsid = "@(#)ex_vops3.c 6.2 %G%"; #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" @@ -415,8 +415,10 @@ lskipbal(parens) register int c; do { - if (!lnext()) + if (!lnext()) { + wdot = NOLINE; return (0); + } c = *wcursor; if (c == parens[1]) level--; -- 2.20.1