changed the way the INDEX operator is evaluated to better
[unix-history] / usr / src / usr.bin / ex / ex_temp.c
index 4890085..e50ff8a 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex_temp.c   4.2 %G%";
+/* Copyright (c) 1981 Regents of the University of California */
+static char *sccsid = "@(#)ex_temp.c   7.3     %G%";
 #include "ex.h"
 #include "ex_temp.h"
 #include "ex_vis.h"
 #include "ex.h"
 #include "ex_temp.h"
 #include "ex_vis.h"
@@ -167,32 +167,41 @@ getblock(atl, iof)
        if (iof == READ) {
                if (hitin2 == 0) {
                        if (ichang2) {
        if (iof == READ) {
                if (hitin2 == 0) {
                        if (ichang2) {
+#ifdef CRYPT
                                if(xtflag)
                                        crblock(tperm, ibuff2, CRSIZE, (long)0);
                                if(xtflag)
                                        crblock(tperm, ibuff2, CRSIZE, (long)0);
+#endif
                                blkio(iblock2, ibuff2, write);
                        }
                        ichang2 = 0;
                        iblock2 = bno;
                        blkio(bno, ibuff2, read);
                                blkio(iblock2, ibuff2, write);
                        }
                        ichang2 = 0;
                        iblock2 = bno;
                        blkio(bno, ibuff2, read);
+#ifdef CRYPT
                        if(xtflag)
                                crblock(tperm, ibuff2, CRSIZE, (long)0);
                        if(xtflag)
                                crblock(tperm, ibuff2, CRSIZE, (long)0);
+#endif
                        hitin2 = 1;
                        return (ibuff2 + off);
                }
                hitin2 = 0;
                if (ichanged) {
                        hitin2 = 1;
                        return (ibuff2 + off);
                }
                hitin2 = 0;
                if (ichanged) {
+#ifdef CRYPT
                        if(xtflag)
                                crblock(tperm, ibuff, CRSIZE, (long)0);
                        if(xtflag)
                                crblock(tperm, ibuff, CRSIZE, (long)0);
+#endif
                        blkio(iblock, ibuff, write);
                }
                ichanged = 0;
                iblock = bno;
                blkio(bno, ibuff, read);
                        blkio(iblock, ibuff, write);
                }
                ichanged = 0;
                iblock = bno;
                blkio(bno, ibuff, read);
+#ifdef CRYPT
                if(xtflag)
                        crblock(tperm, ibuff, CRSIZE, (long)0);
                if(xtflag)
                        crblock(tperm, ibuff, CRSIZE, (long)0);
+#endif
                return (ibuff + off);
        }
        if (oblock >= 0) {
                return (ibuff + off);
        }
        if (oblock >= 0) {
+#ifdef CRYPT
                if(xtflag) {
                        /*
                         * Encrypt block before writing, so some devious
                if(xtflag) {
                        /*
                         * Encrypt block before writing, so some devious
@@ -206,6 +215,7 @@ getblock(atl, iof)
                        crblock(tperm, crbuf, CRSIZE, (long)0);
                        blkio(oblock, crbuf, write);
                } else
                        crblock(tperm, crbuf, CRSIZE, (long)0);
                        blkio(oblock, crbuf, write);
                } else
+#endif
                        blkio(oblock, obuff, write);
        }
        oblock = bno;
                        blkio(oblock, obuff, write);
        }
        oblock = bno;
@@ -321,7 +331,7 @@ oops:
 TSYNC()
 {
 
 TSYNC()
 {
 
-       if (dirtcnt > 12) {
+       if (dirtcnt > MAXDIRT) {        /* mjm: 12 --> MAXDIRT */
 #ifdef VMUNIX
                if (stilinc)
                        tflush();
 #ifdef VMUNIX
                if (stilinc)
                        tflush();
@@ -358,7 +368,7 @@ struct      rbuf {
        short   rb_prev;
        short   rb_next;
        char    rb_text[BUFSIZ - 2 * sizeof (short)];
        short   rb_prev;
        short   rb_next;
        char    rb_text[BUFSIZ - 2 * sizeof (short)];
-} *rbuf;
+} *rbuf, KILLrbuf, putrbuf, YANKrbuf, regrbuf;
 #ifdef VMUNIX
 short  rused[256];
 #else
 #ifdef VMUNIX
 short  rused[256];
 #else
@@ -430,10 +440,9 @@ int        shread();
 KILLreg(c)
        register int c;
 {
 KILLreg(c)
        register int c;
 {
-       struct rbuf arbuf;
        register struct strreg *sp;
 
        register struct strreg *sp;
 
-       rbuf = &arbuf;
+       rbuf = &KILLrbuf;
        sp = mapreg(c);
        rblock = sp->rg_first;
        sp->rg_first = sp->rg_last = 0;
        sp = mapreg(c);
        rblock = sp->rg_first;
        sp->rg_first = sp->rg_last = 0;
@@ -463,14 +472,13 @@ int       getREG();
 putreg(c)
        char c;
 {
 putreg(c)
        char c;
 {
-       struct rbuf arbuf;
        register line *odot = dot;
        register line *odol = dol;
        register int cnt;
 
        deletenone();
        appendnone();
        register line *odot = dot;
        register line *odol = dol;
        register int cnt;
 
        deletenone();
        appendnone();
-       rbuf = &arbuf;
+       rbuf = &putrbuf;
        rnleft = 0;
        rblock = 0;
        rnext = mapreg(c)->rg_first;
        rnleft = 0;
        rblock = 0;
        rnext = mapreg(c)->rg_first;
@@ -546,9 +554,9 @@ getREG()
 YANKreg(c)
        register int c;
 {
 YANKreg(c)
        register int c;
 {
-       struct rbuf arbuf;
        register line *addr;
        register struct strreg *sp;
        register line *addr;
        register struct strreg *sp;
+       char savelb[LBSIZE];
 
        if (isdigit(c))
                kshift();
 
        if (isdigit(c))
                kshift();
@@ -556,7 +564,7 @@ YANKreg(c)
                KILLreg(c);
        strp = sp = mapreg(c);
        sp->rg_flags = inopen && cursor && wcursor;
                KILLreg(c);
        strp = sp = mapreg(c);
        sp->rg_flags = inopen && cursor && wcursor;
-       rbuf = &arbuf;
+       rbuf = &YANKrbuf;
        if (sp->rg_last) {
                regio(sp->rg_last, read);
                rnleft = sp->rg_nleft;
        if (sp->rg_last) {
                regio(sp->rg_last, read);
                rnleft = sp->rg_nleft;
@@ -565,6 +573,7 @@ YANKreg(c)
                rblock = 0;
                rnleft = 0;
        }
                rblock = 0;
                rnleft = 0;
        }
+       CP(savelb,linebuf);
        for (addr = addr1; addr <= addr2; addr++) {
                getline(*addr);
                if (sp->rg_flags) {
        for (addr = addr1; addr <= addr2; addr++) {
                getline(*addr);
                if (sp->rg_flags) {
@@ -577,6 +586,7 @@ YANKreg(c)
        }
        rbflush();
        killed();
        }
        rbflush();
        killed();
+       CP(linebuf,savelb);
 }
 
 kshift()
 }
 
 kshift()
@@ -633,10 +643,9 @@ char c;
 char *buf;
 int buflen;
 {
 char *buf;
 int buflen;
 {
-       struct rbuf arbuf;
        register char *p, *lp;
 
        register char *p, *lp;
 
-       rbuf = &arbuf;
+       rbuf = &regrbuf;
        rnleft = 0;
        rblock = 0;
        rnext = mapreg(c)->rg_first;
        rnleft = 0;
        rblock = 0;
        rnext = mapreg(c)->rg_first;
@@ -662,6 +671,7 @@ int buflen;
  * Encryption routines.  These are essentially unmodified from ed.
  */
 
  * Encryption routines.  These are essentially unmodified from ed.
  */
 
+#ifdef CRYPT
 /*
  * crblock: encrypt/decrypt a block of text.
  * buf is the buffer through which the text is both input and
 /*
  * crblock: encrypt/decrypt a block of text.
  * buf is the buffer through which the text is both input and
@@ -801,3 +811,4 @@ char *buffer;
        close(pf[1]);
        /* end of nonportable part */
 }
        close(pf[1]);
        /* end of nonportable part */
 }
+#endif