document distributed with 4.1BSD
[unix-history] / usr / src / usr.bin / ex / ex_temp.c
index 53475d4..f285931 100644 (file)
@@ -1,5 +1,13 @@
-/* Copyright (c) 1981 Regents of the University of California */
-static char *sccsid = "@(#)ex_temp.c   7.2     %G%";
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char *sccsid = "@(#)ex_temp.c   7.5 (Berkeley) %G%";
+#endif not lint
+
 #include "ex.h"
 #include "ex_temp.h"
 #include "ex_vis.h"
 #include "ex.h"
 #include "ex_temp.h"
 #include "ex_vis.h"
@@ -326,6 +334,15 @@ oops:
        lseek(tfile, 0l, 0);
        if (write(tfile, (char *) &H, sizeof H) != sizeof H)
                goto oops;
        lseek(tfile, 0l, 0);
        if (write(tfile, (char *) &H, sizeof H) != sizeof H)
                goto oops;
+#ifdef notdef
+       /*
+        * This will insure that exrecover gets as much
+        * back after a crash as is absolutely possible,
+        * but can result in pregnant pauses between commands
+        * when the TSYNC call is made, so...
+        */
+       (void) fsync(tfile);
+#endif
 }
 
 TSYNC()
 }
 
 TSYNC()
@@ -368,7 +385,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
@@ -440,10 +457,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;
@@ -473,14 +489,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;
@@ -556,7 +571,6 @@ getREG()
 YANKreg(c)
        register int c;
 {
 YANKreg(c)
        register int c;
 {
-       struct rbuf arbuf;
        register line *addr;
        register struct strreg *sp;
        char savelb[LBSIZE];
        register line *addr;
        register struct strreg *sp;
        char savelb[LBSIZE];
@@ -567,7 +581,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;
@@ -646,10 +660,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;