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
/* 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"
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.
defwind = 10*defwind + *cp - '0';
break;
defwind = 10*defwind + *cp - '0';
break;
case 'x':
/* -x: encrypted mode */
xflag = 1;
break;
case 'x':
/* -x: encrypted mode */
xflag = 1;
break;
default:
smerror("Unknown option %s\n", av[0]);
default:
smerror("Unknown option %s\n", av[0]);
if(xflag){
key = getpass(KEYPROMPT);
kflag = crinit(key, perm);
}
if(xflag){
key = getpass(KEYPROMPT);
kflag = crinit(key, perm);
}
/*
* If we are doing a recover and no filename
/*
* If we are doing a recover and no filename
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;
if(xflag) {
xtflag = 1;
makekey(key, tperm);
}
if(xflag) {
xtflag = 1;
makekey(key, tperm);
}
/* 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
#define UNDNONE 3
#define UNDPUT 4
#define UNDNONE 3
#define UNDPUT 4
/*
* Various miscellaneous flags and buffers needed by the encryption routines.
*/
/*
* Various miscellaneous flags and buffers needed by the encryption routines.
*/
char *key;
char crbuf[CRSIZE];
char *getpass();
char *key;
char crbuf[CRSIZE];
char *getpass();
/*
* Function type definitions
/*
* Function type definitions
/* 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"
error(" Directory");
case S_IFREG:
error(" Directory");
case S_IFREG:
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))
fp = genbuf;
while(fp < &genbuf[ninbuf]) {
if (*fp++ & 0200) {
fp = genbuf;
while(fp < &genbuf[ninbuf]) {
if (*fp++ & 0200) {
fp = genbuf;
cntch += ninbuf+1;
}
fp = genbuf;
cntch += ninbuf+1;
}
for (;;) {
if (--nib < 0) {
nib = fp - genbuf;
for (;;) {
if (--nib < 0) {
nib = fp - genbuf;
if(kflag)
crblock(perm, genbuf, nib, cntch);
if(kflag)
crblock(perm, genbuf, nib, cntch);
if (write(io, genbuf, nib) != nib) {
wrerror();
}
if (write(io, genbuf, nib) != nib) {
wrerror();
}
}
} while (a1 <= addr2);
nib = fp - genbuf;
}
} while (a1 <= addr2);
nib = fp - genbuf;
if(kflag)
crblock(perm, genbuf, nib, cntch);
if(kflag)
crblock(perm, genbuf, nib, cntch);
if (write(io, genbuf, nib) != nib) {
wrerror();
}
if (write(io, genbuf, nib) != nib) {
wrerror();
}
/* 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"
if (iof == READ) {
if (hitin2 == 0) {
if (ichang2) {
if (iof == READ) {
if (hitin2 == 0) {
if (ichang2) {
if(xtflag)
crblock(tperm, ibuff2, CRSIZE, (long)0);
if(xtflag)
crblock(tperm, ibuff2, CRSIZE, (long)0);
blkio(iblock2, ibuff2, write);
}
ichang2 = 0;
iblock2 = bno;
blkio(bno, ibuff2, read);
blkio(iblock2, ibuff2, write);
}
ichang2 = 0;
iblock2 = bno;
blkio(bno, ibuff2, read);
if(xtflag)
crblock(tperm, ibuff2, CRSIZE, (long)0);
if(xtflag)
crblock(tperm, ibuff2, CRSIZE, (long)0);
hitin2 = 1;
return (ibuff2 + off);
}
hitin2 = 0;
if (ichanged) {
hitin2 = 1;
return (ibuff2 + off);
}
hitin2 = 0;
if (ichanged) {
if(xtflag)
crblock(tperm, ibuff, CRSIZE, (long)0);
if(xtflag)
crblock(tperm, ibuff, CRSIZE, (long)0);
blkio(iblock, ibuff, write);
}
ichanged = 0;
iblock = bno;
blkio(bno, ibuff, read);
blkio(iblock, ibuff, write);
}
ichanged = 0;
iblock = bno;
blkio(bno, ibuff, read);
if(xtflag)
crblock(tperm, ibuff, CRSIZE, (long)0);
if(xtflag)
crblock(tperm, ibuff, CRSIZE, (long)0);
return (ibuff + off);
}
if (oblock >= 0) {
return (ibuff + off);
}
if (oblock >= 0) {
if(xtflag) {
/*
* Encrypt block before writing, so some devious
if(xtflag) {
/*
* Encrypt block before writing, so some devious
crblock(tperm, crbuf, CRSIZE, (long)0);
blkio(oblock, crbuf, write);
} else
crblock(tperm, crbuf, CRSIZE, (long)0);
blkio(oblock, crbuf, write);
} else
blkio(oblock, obuff, write);
}
oblock = bno;
blkio(oblock, obuff, write);
}
oblock = bno;
* Encryption routines. These are essentially unmodified from ed.
*/
* Encryption routines. These are essentially unmodified from ed.
*/
/*
* 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
close(pf[1]);
/* end of nonportable part */
}
close(pf[1]);
/* end of nonportable part */
}