BSD 4_4 release
[unix-history] / usr / src / usr.bin / ex / ex_io.c
index 9fd0a72..d38a673 100644 (file)
@@ -1,12 +1,14 @@
 /*-
 /*-
- * Copyright (c) 1980 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * %sccs.include.proprietary.c%
+ * This module is believed to contain source code proprietary to AT&T.
+ * Use and redistribution is subject to the Berkeley Software License
+ * Agreement and your Software Agreement with AT&T (Western Electric).
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)ex_io.c    7.20 (Berkeley) %G%";
+static char sccsid[] = "@(#)ex_io.c    8.1 (Berkeley) 6/9/93";
 #endif /* not lint */
 
 #include "ex.h"
 #endif /* not lint */
 
 #include "ex.h"
@@ -417,6 +419,10 @@ rop(c)
                error(" Directory");
 
        case S_IFREG:
                error(" Directory");
 
        case S_IFREG:
+#ifdef CRYPT
+               if (xflag)
+                       break;
+#endif
                i = read(io, (char *)&head, sizeof(head));
                (void)lseek(io, 0L, L_SET);
                if (i != sizeof(head))
                i = read(io, (char *)&head, sizeof(head));
                (void)lseek(io, 0L, L_SET);
                if (i != sizeof(head))
@@ -834,6 +840,18 @@ getfile()
                                }
                                return (EOF);
                        }
                                }
                                return (EOF);
                        }
+#ifdef CRYPT
+                       if (kflag) {
+                               fp = genbuf;
+                               while(fp < &genbuf[ninbuf]) {
+                                       if (*fp++ & 0200) {
+                                               crblock(perm, genbuf, ninbuf+1,
+       cntch);
+                                               break;
+                                       }
+                               }
+                       }
+#endif
                        fp = genbuf;
                        cntch += ninbuf+1;
                }
                        fp = genbuf;
                        cntch += ninbuf+1;
                }
@@ -891,6 +909,10 @@ int isfilter;
                for (;;) {
                        if (--nib < 0) {
                                nib = fp - genbuf;
                for (;;) {
                        if (--nib < 0) {
                                nib = fp - genbuf;
+#ifdef CRYPT
+                               if(kflag && !isfilter)
+                                        crblock(perm, genbuf, nib, cntch);
+#endif
                                if (write(io, genbuf, nib) != nib) {
                                        wrerror();
                                }
                                if (write(io, genbuf, nib) != nib) {
                                        wrerror();
                                }
@@ -905,6 +927,10 @@ int isfilter;
                }
        } while (a1 <= addr2);
        nib = fp - genbuf;
                }
        } while (a1 <= addr2);
        nib = fp - genbuf;
+#ifdef CRYPT
+       if(kflag && !isfilter)
+               crblock(perm, genbuf, nib, cntch);
+#endif
        if (write(io, genbuf, nib) != nib) {
                wrerror();
        }
        if (write(io, genbuf, nib) != nib) {
                wrerror();
        }