made CRYPT an #ifdef
authorMark Horton <mark@ucbvax.Berkeley.EDU>
Wed, 20 Aug 1980 15:24:37 +0000 (07:24 -0800)
committerMark Horton <mark@ucbvax.Berkeley.EDU>
Wed, 20 Aug 1980 15:24:37 +0000 (07:24 -0800)
SCCS-vsn: usr.bin/ex/ex.c 4.3
SCCS-vsn: usr.bin/ex/ex.h 4.3
SCCS-vsn: usr.bin/ex/ex_io.c 4.3
SCCS-vsn: usr.bin/ex/ex_temp.c 4.3

usr/src/usr.bin/ex/ex.c
usr/src/usr.bin/ex/ex.h
usr/src/usr.bin/ex/ex_io.c
usr/src/usr.bin/ex/ex_temp.c

index 4c46891..c3f4c64 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (c) 1980 Regents of the University of California */
 /* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex.c        4.2 %G%";
+static char *sccsid = "@(#)ex.c        4.2 8/1/80";
 #include "ex.h"
 #include "ex_argv.h"
 #include "ex_temp.h"
 #include "ex.h"
 #include "ex_argv.h"
 #include "ex_temp.h"
@@ -96,9 +96,6 @@ main(ac, av)
        normf = tty;
 #endif
        ppid = getpid();
        normf = tty;
 #endif
        ppid = getpid();
-#ifdef HORSE
-       horse(ac, av);
-#endif
        /*
         * Defend against d's, v's, w's, and a's in directories of
         * path leading to our true name.
        /*
         * Defend against d's, v's, w's, and a's in directories of
         * path leading to our true name.
@@ -229,10 +226,12 @@ main(ac, av)
                                defwind = 10*defwind + *cp - '0';
                        break;
 
                                defwind = 10*defwind + *cp - '0';
                        break;
 
+#ifdef CRYPT
                case 'x':
                        /* -x: encrypted mode */
                        xflag = 1;
                        break;
                case 'x':
                        /* -x: encrypted mode */
                        xflag = 1;
                        break;
+#endif
 
                default:
                        smerror("Unknown option %s\n", av[0]);
 
                default:
                        smerror("Unknown option %s\n", av[0]);
@@ -245,10 +244,12 @@ main(ac, av)
                ac--, av++;
        }
 
                ac--, av++;
        }
 
+#ifdef CRYPT
        if(xflag){
                key = getpass(KEYPROMPT);
                kflag = crinit(key, perm);
        }
        if(xflag){
                key = getpass(KEYPROMPT);
                kflag = crinit(key, perm);
        }
+#endif
 
        /*
         * If we are doing a recover and no filename
 
        /*
         * If we are doing a recover and no filename
@@ -385,10 +386,12 @@ init()
        for (i = 0; i <= 'z'-'a'+1; i++)
                names[i] = 1;
        anymarks = 0;
        for (i = 0; i <= 'z'-'a'+1; i++)
                names[i] = 1;
        anymarks = 0;
+#ifdef CRYPT
         if(xflag) {
                 xtflag = 1;
                 makekey(key, tperm);
         }
         if(xflag) {
                 xtflag = 1;
                 makekey(key, tperm);
         }
+#endif
 }
 
 /*
 }
 
 /*
index a295ee3..cf67a08 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (c) 1980 Regents of the University of California */
 /* Copyright (c) 1980 Regents of the University of California */
-/* sccs id:    @(#)ex.h        4.2 %G%  */
+/* sccs id:    @(#)ex.h        4.3 %G%  */
 #ifdef V6
 #include <retrofit.h>
 #endif
 #ifdef V6
 #include <retrofit.h>
 #endif
@@ -297,6 +297,7 @@ line        *undadot;               /* If we saved all lines, dot reverts here */
 #define        UNDNONE         3
 #define        UNDPUT          4
 
 #define        UNDNONE         3
 #define        UNDPUT          4
 
+#ifdef CRYPT
 /*
  * Various miscellaneous flags and buffers needed by the encryption routines.
  */
 /*
  * Various miscellaneous flags and buffers needed by the encryption routines.
  */
@@ -310,6 +311,7 @@ char        tperm[768];
 char   *key;
 char   crbuf[CRSIZE];
 char   *getpass();
 char   *key;
 char   crbuf[CRSIZE];
 char   *getpass();
+#endif
 
 /*
  * Function type definitions
 
 /*
  * Function type definitions
index 52db2a6..4f91826 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (c) 1980 Regents of the University of California */
 /* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex_io.c     4.2 %G%";
+static char *sccsid = "@(#)ex_io.c     4.3 %G%";
 #include "ex.h"
 #include "ex_argv.h"
 #include "ex_temp.h"
 #include "ex.h"
 #include "ex_argv.h"
 #include "ex_temp.h"
@@ -329,8 +329,10 @@ rop(c)
                error(" Directory");
 
        case S_IFREG:
                error(" Directory");
 
        case S_IFREG:
+#ifdef CRYPT
                if (xflag)
                        break;
                if (xflag)
                        break;
+#endif
                i = read(io, (char *) &magic, sizeof(magic));
                lseek(io, 0l, 0);
                if (i != sizeof(magic))
                i = read(io, (char *) &magic, sizeof(magic));
                lseek(io, 0l, 0);
                if (i != sizeof(magic))
@@ -582,6 +584,7 @@ getfile()
                                }
                                return (EOF);
                        }
                                }
                                return (EOF);
                        }
+#ifdef CRYPT
                        fp = genbuf;
                        while(fp < &genbuf[ninbuf]) {
                                if (*fp++ & 0200) {
                        fp = genbuf;
                        while(fp < &genbuf[ninbuf]) {
                                if (*fp++ & 0200) {
@@ -591,6 +594,7 @@ cntch);
                                        break;
                                }
                        }
                                        break;
                                }
                        }
+#endif
                        fp = genbuf;
                        cntch += ninbuf+1;
                }
                        fp = genbuf;
                        cntch += ninbuf+1;
                }
@@ -638,8 +642,10 @@ putfile()
                for (;;) {
                        if (--nib < 0) {
                                nib = fp - genbuf;
                for (;;) {
                        if (--nib < 0) {
                                nib = fp - genbuf;
+#ifdef CRYPT
                                if(kflag)
                                         crblock(perm, genbuf, nib, cntch);
                                if(kflag)
                                         crblock(perm, genbuf, nib, cntch);
+#endif
                                if (write(io, genbuf, nib) != nib) {
                                        wrerror();
                                }
                                if (write(io, genbuf, nib) != nib) {
                                        wrerror();
                                }
@@ -654,8 +660,10 @@ putfile()
                }
        } while (a1 <= addr2);
        nib = fp - genbuf;
                }
        } while (a1 <= addr2);
        nib = fp - genbuf;
+#ifdef CRYPT
        if(kflag)
                crblock(perm, genbuf, nib, cntch);
        if(kflag)
                crblock(perm, genbuf, nib, cntch);
+#endif
        if (write(io, genbuf, nib) != nib) {
                wrerror();
        }
        if (write(io, genbuf, nib) != nib) {
                wrerror();
        }
index 4890085..4eb3667 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (c) 1980 Regents of the University of California */
 /* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex_temp.c   4.2 %G%";
+static char *sccsid = "@(#)ex_temp.c   4.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;
@@ -662,6 +672,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 +812,4 @@ char *buffer;
        close(pf[1]);
        /* end of nonportable part */
 }
        close(pf[1]);
        /* end of nonportable part */
 }
+#endif