=========================================
| Jeffrey D. Silverman |
| User Support Specialist |
| Wilmer Clinical Trials and Biometry |
| Johns Hopkins University |
| Baltimore, MD |
=========================================
P.S./epilogue: The file had been backed up the night before. No serious
work was lost. (in case anyone wondered/cared to find out).
> Q's: is there a way to encript a file in vi?
Yes, with some vi's; check your man pages.
> how is this done (what keystrokes)?
man vi
> how is this unencripted/decoded?
man vi
Some vi's support the -x option on the command line, and they
will then encrypt/decrypt the file being edited with a password
they will prompt you to give.
This is very dependent, though, on the specific VI
implementation, and is not true for all the vi's out there.
The VI of SunOS 4.3 for instance supported this...
The VIM of Linux doesn't support it yet (at version 4.x which
I have installed on my Linux box at home--dunno about newer
versions, have to check it out).
> > how is this done (what keystrokes)?
> man vi
This is done transparently when you load and save the file.
CAREFUL THOUGH... while you are editing the file, it's
unencrypted contents might be in /tmp somewhere !!!
> > how is this unencripted/decoded?
> man vi
Using the crypt() library function, on every line of input,
as far as I remember from some old SunOS manuals...
This is truly very implementation dependent, however, as it
has been pointed out previously...
The bottom line is:
Why would you like VI to en/decrypt the files on-the-fly?
Isn't it better to have some external program, such as PGP
for the encryption? Just a tought...
From the orginial question in comp.misc somebody was editing
a file when exiting they typed :X instead of :x.
I tried to explain that if they use command vi -x <file> and
type the same keystokes after :X. They may be able to retrieve
a clear file which they must save as new filename.
I problably didn't make clear is that keys stokes after :X in
the orginal file was taken as the password. Since the person
editing the file was going to run a spell checker that could
be the password.
richk