Clean up deleted files.
This commit is contained in:
parent
c7f69ec3a1
commit
2b9550b580
|
@ -1,68 +0,0 @@
|
|||
The following options are missing:
|
||||
[no]optimize - affects screen redrawing method
|
||||
[no]redraw - simulate character insertion by redrawing line
|
||||
[no]slowopen - don't use character insertion
|
||||
tags="tags" - list of tags, used as TAGPATH
|
||||
|
||||
I'd like to improve the versatility of the options whose value is a command:
|
||||
cc, make, kp, and ep. I'd like to add some notation that allows you to say
|
||||
where to insert the current filename or current word.
|
||||
-------------------------------------------------------------------------------
|
||||
Currently, elvis is configured to look for | only in .exrc files. It doesn't
|
||||
look for | in any interactively entered command lines, yet.
|
||||
-------------------------------------------------------------------------------
|
||||
The 'p', '#', and 'l' flags aren't supported. Also, ex commands don't accept
|
||||
counts; e.g., ":c5" can't be used to change five lines.
|
||||
-------------------------------------------------------------------------------
|
||||
The following have been reported, but have not been verified. If you have
|
||||
experienced any of the following, and haven't reported it yet, then please
|
||||
report it now! I need more information about these bugs.
|
||||
|
||||
[Bugs that are not in this list should also be reported, of course.]
|
||||
|
||||
- Under VMS on an 80-column screen, after scolling sideways to approximately
|
||||
column 110, a ^L will not redraw the part of the line after the cursor.
|
||||
- On an Atari ST running under TOS: some ASCII keys seem to send '#' plus
|
||||
another key. (This is normal for non-ASCII keys like <F1> or <Help>, but
|
||||
ASCII keys should always send a single ASCII character.)
|
||||
-------------------------------------------------------------------------------
|
||||
BIG JOBS:
|
||||
Desirable extension: merge input mode and visual command mode.
|
||||
Display long lines by wrapping, like the real vi (if ":set sidescroll=0")
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
- In the ":w >>filename" command, elvis doesn't allow any whitespace between
|
||||
the ">>" and "filename".
|
||||
|
||||
- Elvis doesn't allow "backslash newline" inside a single EX command.
|
||||
|
||||
- VMS intercepts the control-T character, which is normally used to increase
|
||||
indentation. The <Tab> key works, but it doesn't do quite the same thing.
|
||||
(":map! ^I ^T" helps.)
|
||||
|
||||
- Under VMS, file I/O is very slow. Looking over the vmsio.c file, I get the
|
||||
impression that it is rather over-done for elvis. Its speed could
|
||||
probably be inproved.
|
||||
|
||||
- The errlist feature doesn't seem to work with the Borland compilers. Perhaps
|
||||
they write to stderr instead of stdout? This will probably be easy to solve
|
||||
once I modify the "cc" and "make" options, as described earlier.
|
||||
|
||||
- The command ":0" should move the cursor to line 1. Currently, it doesn't
|
||||
move the cursor at all.
|
||||
|
||||
- File preservation is still flakey. On DOS/TOS/VMS systems, it is also more
|
||||
complex that it should be.
|
||||
|
||||
- The act of appending to a cut buffer (as in "Ayy) sets file modification
|
||||
flag. It shouldn't!
|
||||
|
||||
- The .exrc file is limited to BLKSIZE bytes -- 2048 on most systems, but
|
||||
1024 on Minicx-PC, Coherent, and MS-DOS.
|
||||
|
||||
- I *still* haven't quite perfected the screen update code. If you suspect
|
||||
that the screen doesn't accurately reflect the contents of the edit buffer,
|
||||
then you should try doing a control-L.
|
||||
|
||||
I'll be overhauling the screen update code soon to make it wrap long lines
|
||||
like the real vi. I expect to fix this bug then.
|
|
@ -1,14 +0,0 @@
|
|||
# $Id: Makefile,v 1.6 1993/11/11 01:30:13 jtc Exp $
|
||||
|
||||
PROG= elvis
|
||||
CFLAGS+=-DBSD -DREGEX
|
||||
DPADD= ${LIBTERM}
|
||||
LDADD= -ltermcap
|
||||
SRCS= blk.c cmd1.c cmd2.c ctype.c curses.c cut.c ex.c input.c main.c misc.c \
|
||||
modify.c move1.c move2.c move3.c move4.c move5.c opts.c recycle.c \
|
||||
redraw.c regexp.c regsub.c system.c tio.c tmp.c unix.c vars.c vcmd.c vi.c
|
||||
LINKS= ${BINDIR}/elvis ${BINDIR}/vi ${BINDIR}/elvis ${BINDIR}/ex \
|
||||
${BINDIR}/elvis ${BINDIR}/view
|
||||
MLINKS= elvis.1 vi.1 elvis.1 ex.1 elvis.1 view.1
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -1,31 +0,0 @@
|
|||
Elvis is a clone of vi/ex, the standard UNIX editor. Elvis supports
|
||||
nearly all of the vi/ex commands, in both visual mode and colon mode.
|
||||
|
||||
Elvis runs under BSD UNIX, AT&T SysV UNIX, SCO Xenix, Minix, MS-DOS
|
||||
(Turbo-C or MSC 5.1), Atari TOS, OS9/68000, Coherent, VMS, and AmigaDos.
|
||||
Ports to other operating systems are in progress; contact me before you
|
||||
start porting it to some other OS, because somebody else may have
|
||||
already done it for you.
|
||||
|
||||
Elvis is freely redistributable, in either source form or executable
|
||||
form. There are no restrictions on how you may use it.
|
||||
|
||||
The file "elvisman.txt" contains the manual for elvis. It is a plain
|
||||
ASCII file with nothing more exotic than a newline character. It is
|
||||
formatted for 66-line, 80-column pages. There may also be an archive of
|
||||
"*.ms" and "*.man" files, which contain the TROFF source text used to
|
||||
generate that manual.
|
||||
|
||||
The file named "Makefile.mix" is used to compile elvis for all systems
|
||||
except VMS and possibly MS-DOS. You should copy "Makefile.mix" to
|
||||
"Makefile", and then edit "Makefile" to select the appropriate group of
|
||||
settings for your system.
|
||||
|
||||
|
||||
Author: Steve Kirkendall
|
||||
14407 SW Teal Blvd. #C
|
||||
Beaverton, OR 97005
|
||||
|
||||
E-mail: kirkenda@cs.pdx.edu
|
||||
|
||||
Phone: (503) 643-6980
|
|
@ -1,491 +0,0 @@
|
|||
/* blk.c */
|
||||
|
||||
/* Author:
|
||||
* Steve Kirkendall
|
||||
* 14407 SW Teal Blvd. #C
|
||||
* Beaverton, OR 97005
|
||||
* kirkenda@cs.pdx.edu
|
||||
*/
|
||||
|
||||
|
||||
/* This file contains the functions that get/put blocks from the temp file.
|
||||
* It also contains the "do" and "undo" functions.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: blk.c,v 1.4 1993/11/19 12:53:32 pk Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "config.h"
|
||||
#include "vi.h"
|
||||
|
||||
#ifndef NBUFS
|
||||
# define NBUFS 5 /* must be at least 3 -- more is better */
|
||||
#endif
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
BLK hdr; /* buffer for the header block */
|
||||
|
||||
static int b4cnt; /* used to count context of beforedo/afterdo */
|
||||
static struct _blkbuf
|
||||
{
|
||||
BLK buf; /* contents of a text block */
|
||||
unsigned short logical; /* logical block number */
|
||||
int dirty; /* must the buffer be rewritten? */
|
||||
}
|
||||
blk[NBUFS], /* buffers for text[?] blocks */
|
||||
*toonew, /* buffer which shouldn't be recycled yet */
|
||||
*newtoo, /* another buffer which should be recycled */
|
||||
*recycle = blk; /* next block to be recycled */
|
||||
|
||||
|
||||
|
||||
void blkflush P_((REG struct _blkbuf *this));
|
||||
|
||||
|
||||
|
||||
|
||||
/* This function wipes out all buffers */
|
||||
void blkinit()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NBUFS; i++)
|
||||
{
|
||||
blk[i].logical = 0;
|
||||
blk[i].dirty = FALSE;
|
||||
}
|
||||
for (i = 0; i < MAXBLKS; i++)
|
||||
{
|
||||
hdr.n[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function allocates a buffer and fills it with a given block's text */
|
||||
BLK *blkget(logical)
|
||||
int logical; /* logical block number to fetch */
|
||||
{
|
||||
REG struct _blkbuf *this; /* used to step through blk[] */
|
||||
REG int i;
|
||||
|
||||
/* if logical is 0, just return the hdr buffer */
|
||||
if (logical == 0)
|
||||
{
|
||||
return &hdr;
|
||||
}
|
||||
|
||||
/* see if we have that block in mem already */
|
||||
for (this = blk; this < &blk[NBUFS]; this++)
|
||||
{
|
||||
if (this->logical == (unsigned)logical)
|
||||
{
|
||||
newtoo = toonew;
|
||||
toonew = this;
|
||||
return &this->buf;
|
||||
}
|
||||
}
|
||||
|
||||
/* choose a block to be recycled */
|
||||
do
|
||||
{
|
||||
this = recycle++;
|
||||
if (recycle == &blk[NBUFS])
|
||||
{
|
||||
recycle = blk;
|
||||
}
|
||||
} while (this == toonew || this == newtoo);
|
||||
|
||||
/* if it contains a block, flush that block */
|
||||
blkflush(this);
|
||||
|
||||
/* fill this buffer with the desired block */
|
||||
this->logical = logical;
|
||||
if (hdr.n[logical])
|
||||
{
|
||||
/* it has been used before - fill it from tmp file */
|
||||
lseek(tmpfd, (long)hdr.n[logical] * (long)BLKSIZE, 0);
|
||||
if (read(tmpfd, this->buf.c, (unsigned)BLKSIZE) != BLKSIZE)
|
||||
{
|
||||
msg("Error reading back from tmp file!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* it is new - zero it */
|
||||
for (i = 0; i < BLKSIZE; i++)
|
||||
{
|
||||
this->buf.c[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* This isn't really a change, but it does potentially invalidate
|
||||
* the kinds of shortcuts that the "changes" variable is supposed
|
||||
* to protect us from... so count it as a change.
|
||||
*/
|
||||
changes++;
|
||||
|
||||
/* mark it as being "not dirty" */
|
||||
this->dirty = 0;
|
||||
|
||||
/* return it */
|
||||
newtoo = toonew;
|
||||
toonew = this;
|
||||
return &this->buf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This function writes a block out to the temporary file */
|
||||
void blkflush(this)
|
||||
REG struct _blkbuf *this; /* the buffer to flush */
|
||||
{
|
||||
long seekpos; /* seek position of the new block */
|
||||
unsigned short physical; /* physical block number */
|
||||
|
||||
/* if its empty (an orphan blkadd() maybe?) then make it dirty */
|
||||
if (this->logical && !*this->buf.c)
|
||||
{
|
||||
blkdirty(&this->buf);
|
||||
}
|
||||
|
||||
/* if it's an empty buffer or a clean version is on disk, quit */
|
||||
if (!this->logical || hdr.n[this->logical] && !this->dirty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* find a free place in the file */
|
||||
#ifndef NO_RECYCLE
|
||||
seekpos = allocate();
|
||||
lseek(tmpfd, seekpos, 0);
|
||||
#else
|
||||
seekpos = lseek(tmpfd, 0L, 2);
|
||||
#endif
|
||||
physical = seekpos / BLKSIZE;
|
||||
|
||||
/* put the block there */
|
||||
if (write(tmpfd, this->buf.c, (unsigned)BLKSIZE) != BLKSIZE)
|
||||
{
|
||||
msg("Trouble writing to tmp file");
|
||||
deathtrap(0);
|
||||
}
|
||||
this->dirty = FALSE;
|
||||
|
||||
/* update the header so it knows we put it there */
|
||||
hdr.n[this->logical] = physical;
|
||||
}
|
||||
|
||||
|
||||
/* This function sets a block's "dirty" flag or deletes empty blocks */
|
||||
void blkdirty(bp)
|
||||
BLK *bp; /* buffer returned by blkget() */
|
||||
{
|
||||
REG int i, j;
|
||||
REG char *scan;
|
||||
REG int k;
|
||||
|
||||
/* find the buffer */
|
||||
for (i = 0; i < NBUFS && bp != &blk[i].buf; i++)
|
||||
{
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (i >= NBUFS)
|
||||
{
|
||||
msg("blkdirty() called with unknown buffer at 0x%lx", bp);
|
||||
return;
|
||||
}
|
||||
if (blk[i].logical == 0)
|
||||
{
|
||||
msg("blkdirty called with freed buffer");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* if this block ends with line# INFINITY, then it must have been
|
||||
* allocated unnecessarily during tmpstart(). Forget it.
|
||||
*/
|
||||
if (lnum[blk[i].logical] == INFINITY)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (blk[i].buf.c[0])
|
||||
{
|
||||
msg("bkldirty called with non-empty extra BLK");
|
||||
}
|
||||
#endif
|
||||
blk[i].logical = 0;
|
||||
blk[i].dirty = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* count lines in this block */
|
||||
for (j = 0, scan = bp->c; *scan && scan < bp->c + BLKSIZE; scan++)
|
||||
{
|
||||
if (*scan == '\n')
|
||||
{
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
/* adjust lnum, if necessary */
|
||||
k = blk[i].logical;
|
||||
j += (lnum[k - 1] - lnum[k]);
|
||||
if (j != 0)
|
||||
{
|
||||
nlines += j;
|
||||
while (k < MAXBLKS && lnum[k] != INFINITY)
|
||||
{
|
||||
lnum[k++] += j;
|
||||
}
|
||||
}
|
||||
|
||||
/* if it still has text, mark it as dirty */
|
||||
if (*bp->c)
|
||||
{
|
||||
blk[i].dirty = TRUE;
|
||||
}
|
||||
else /* empty block, so delete it */
|
||||
{
|
||||
/* adjust the cache */
|
||||
k = blk[i].logical;
|
||||
for (j = 0; j < NBUFS; j++)
|
||||
{
|
||||
if (blk[j].logical >= (unsigned)k)
|
||||
{
|
||||
blk[j].logical--;
|
||||
}
|
||||
}
|
||||
|
||||
/* delete it from hdr.n[] and lnum[] */
|
||||
blk[i].logical = 0;
|
||||
blk[i].dirty = FALSE;
|
||||
while (k < MAXBLKS - 1)
|
||||
{
|
||||
hdr.n[k] = hdr.n[k + 1];
|
||||
lnum[k] = lnum[k + 1];
|
||||
k++;
|
||||
}
|
||||
hdr.n[MAXBLKS - 1] = 0;
|
||||
lnum[MAXBLKS - 1] = INFINITY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* insert a new block into hdr, and adjust the cache */
|
||||
BLK *blkadd(logical)
|
||||
int logical; /* where to insert the new block */
|
||||
{
|
||||
static long chg;
|
||||
REG int i;
|
||||
|
||||
/* if we're approaching the limit, then give a warning */
|
||||
if (hdr.n[MAXBLKS - 10] && chg != changes)
|
||||
{
|
||||
chg = changes;
|
||||
msg("WARNING: The edit buffer will overflow soon.");
|
||||
}
|
||||
if (hdr.n[MAXBLKS - 2])
|
||||
{
|
||||
msg("BAD NEWS: edit buffer overflow -- GOOD NEWS: text preserved");
|
||||
deathtrap(0);
|
||||
}
|
||||
|
||||
/* adjust hdr and lnum[] */
|
||||
for (i = MAXBLKS - 1; i > logical; i--)
|
||||
{
|
||||
hdr.n[i] = hdr.n[i - 1];
|
||||
lnum[i] = lnum[i - 1];
|
||||
}
|
||||
hdr.n[logical] = 0;
|
||||
lnum[logical] = lnum[logical - 1];
|
||||
|
||||
/* adjust the cache */
|
||||
for (i = 0; i < NBUFS; i++)
|
||||
{
|
||||
if (blk[i].logical >= (unsigned)logical)
|
||||
{
|
||||
blk[i].logical++;
|
||||
}
|
||||
}
|
||||
|
||||
/* return the new block, via blkget() */
|
||||
return blkget(logical);
|
||||
}
|
||||
|
||||
|
||||
/* This function forces all dirty blocks out to disk */
|
||||
void blksync()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NBUFS; i++)
|
||||
{
|
||||
/* blk[i].dirty = TRUE; */
|
||||
blkflush(&blk[i]);
|
||||
}
|
||||
if (*o_sync)
|
||||
{
|
||||
sync();
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
static MARK undocurs; /* where the cursor should go if undone */
|
||||
static long oldnlines;
|
||||
static long oldlnum[MAXBLKS];
|
||||
|
||||
|
||||
/* This function should be called before each command that changes the text.
|
||||
* It defines the state that undo() will reset the file to.
|
||||
*/
|
||||
void beforedo(forundo)
|
||||
int forundo; /* boolean: is this for an undo? */
|
||||
{
|
||||
REG int i;
|
||||
REG long l;
|
||||
|
||||
/* if this is a nested call to beforedo, quit! Use larger context */
|
||||
if (b4cnt++ > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* force all block buffers to disk */
|
||||
blksync();
|
||||
|
||||
#ifndef NO_RECYCLE
|
||||
/* perform garbage collection on blocks from tmp file */
|
||||
garbage();
|
||||
#endif
|
||||
|
||||
/* force the header out to disk */
|
||||
lseek(tmpfd, 0L, 0);
|
||||
if (write(tmpfd, hdr.c, (unsigned)BLKSIZE) != BLKSIZE)
|
||||
{
|
||||
msg("Trouble writing header to tmp file");
|
||||
deathtrap(0);
|
||||
}
|
||||
|
||||
/* copy or swap oldnlines <--> nlines, oldlnum <--> lnum */
|
||||
if (forundo)
|
||||
{
|
||||
for (i = 0; i < MAXBLKS; i++)
|
||||
{
|
||||
l = lnum[i];
|
||||
lnum[i] = oldlnum[i];
|
||||
oldlnum[i] = l;
|
||||
}
|
||||
l = nlines;
|
||||
nlines = oldnlines;
|
||||
oldnlines = l;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < MAXBLKS; i++)
|
||||
{
|
||||
oldlnum[i] = lnum[i];
|
||||
}
|
||||
oldnlines = nlines;
|
||||
}
|
||||
|
||||
/* save the cursor position */
|
||||
undocurs = cursor;
|
||||
|
||||
/* upon return, the calling function continues and makes changes... */
|
||||
}
|
||||
|
||||
/* This function marks the end of a (nested?) change to the file */
|
||||
void afterdo()
|
||||
{
|
||||
if (--b4cnt)
|
||||
{
|
||||
/* after abortdo(), b4cnt may decribe nested beforedo/afterdo
|
||||
* pairs incorrectly. If it is decremented to often, then
|
||||
* keep b4cnt sane but don't do anything else.
|
||||
*/
|
||||
if (b4cnt < 0)
|
||||
b4cnt = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* make sure the cursor wasn't left stranded in deleted text */
|
||||
if (markline(cursor) > nlines)
|
||||
{
|
||||
cursor = MARK_LAST;
|
||||
}
|
||||
/* NOTE: it is still possible that markidx(cursor) is after the
|
||||
* end of a line, so the Vi mode will have to take care of that
|
||||
* itself */
|
||||
|
||||
/* if a significant change has been made to this file, then set the
|
||||
* MODIFIED flag.
|
||||
*/
|
||||
if (significant)
|
||||
{
|
||||
setflag(file, MODIFIED);
|
||||
setflag(file, UNDOABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/* This function cuts short the current set of changes. It is called after
|
||||
* a SIGINT.
|
||||
*/
|
||||
void abortdo()
|
||||
{
|
||||
/* finish the operation immediately. */
|
||||
if (b4cnt > 0)
|
||||
{
|
||||
b4cnt = 1;
|
||||
afterdo();
|
||||
}
|
||||
|
||||
/* in visual mode, the screen is probably screwed up */
|
||||
if (mode == MODE_COLON)
|
||||
{
|
||||
mode = MODE_VI;
|
||||
}
|
||||
if (mode == MODE_VI)
|
||||
{
|
||||
redraw(MARK_UNSET, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* This function discards all changes made since the last call to beforedo() */
|
||||
int undo()
|
||||
{
|
||||
BLK oldhdr;
|
||||
|
||||
/* if beforedo() has never been run, fail */
|
||||
if (!tstflag(file, UNDOABLE))
|
||||
{
|
||||
msg("You haven't modified this file yet.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* read the old header form the tmp file */
|
||||
lseek(tmpfd, 0L, 0);
|
||||
if (read(tmpfd, oldhdr.c, (unsigned)BLKSIZE) != BLKSIZE)
|
||||
{
|
||||
msg("Trouble rereading the old header from tmp file");
|
||||
}
|
||||
|
||||
/* "do" the changed version, so we can undo the "undo" */
|
||||
cursor = undocurs;
|
||||
beforedo(TRUE);
|
||||
/* This is a change */
|
||||
significant = TRUE;
|
||||
afterdo();
|
||||
|
||||
/* wipe out the block buffers - we can't assume they're correct */
|
||||
blkinit();
|
||||
|
||||
/* use the old header -- and therefore the old text blocks */
|
||||
hdr = oldhdr;
|
||||
|
||||
changes++;
|
||||
|
||||
return TRUE;
|
||||
}
|
1946
usr.bin/elvis/cmd1.c
1946
usr.bin/elvis/cmd1.c
File diff suppressed because it is too large
Load Diff
1038
usr.bin/elvis/cmd2.c
1038
usr.bin/elvis/cmd2.c
File diff suppressed because it is too large
Load Diff
|
@ -1,637 +0,0 @@
|
|||
/*
|
||||
* vi configuration file
|
||||
* We try to automatically configure to various compilers and operating
|
||||
* systems. Extend the autoconf section as needed.
|
||||
*
|
||||
* $Id: config.h,v 1.4 1993/08/10 15:44:23 mycroft Exp $
|
||||
*/
|
||||
|
||||
#include <sys/unistd.h>
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
# define _CONFIG_H
|
||||
|
||||
/*************************** autoconf section ************************/
|
||||
|
||||
/* Commodore-Amiga */
|
||||
#ifdef amiga
|
||||
# define AMIGA 1
|
||||
# define COMPILED_BY "Manx Aztec C 5.2b"
|
||||
# define TINYSTACK 1
|
||||
#endif
|
||||
|
||||
/* standard unix V (?) */
|
||||
#ifdef M_SYSV
|
||||
# define UNIXV 1
|
||||
# ifdef M_XENIX
|
||||
# ifndef M_I386
|
||||
# define TINYSTACK 1
|
||||
# endif
|
||||
# endif
|
||||
# undef COHERENT
|
||||
#endif
|
||||
|
||||
/* xelos system, University of Ulm */
|
||||
#ifdef xelos
|
||||
# define UNIXV 1
|
||||
#endif
|
||||
|
||||
/* BSD UNIX? */
|
||||
#ifdef bsd
|
||||
# define BSD 1
|
||||
#else
|
||||
# ifdef sun
|
||||
# ifndef M_SYSV
|
||||
# define BSD 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Microsoft C: sorry, Watcom does the same thing */
|
||||
#ifdef M_I86
|
||||
# ifndef M_SYSV
|
||||
# define MSDOS 1
|
||||
# ifdef IBMC2
|
||||
# define COMPILED_BY "IBM C/2 1.00"
|
||||
# else
|
||||
# define MICROSOFT 1
|
||||
# define COMPILED_BY "Microsoft C 5.10"
|
||||
# endif
|
||||
# define TINYSTACK 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Borland's Turbo C */
|
||||
#ifdef __TURBOC__
|
||||
# define MSDOS 1
|
||||
# define TURBOC 1
|
||||
# ifdef __BORLANDC__
|
||||
# define COMPILED_BY "Borland C 2.00"
|
||||
# else
|
||||
# define COMPILED_BY (__TURBOC__ >= 661 ? "Turbo C++ 1.00" : "Turbo C 2.00")
|
||||
# endif
|
||||
# define TINYSTACK 1
|
||||
#endif
|
||||
|
||||
/* Tos Mark-Williams */
|
||||
#ifdef M68000
|
||||
# define TOS 1
|
||||
# define COMPILED_BY "Mark Williams C"
|
||||
# define TINYSTACK 1
|
||||
#endif
|
||||
|
||||
/* Tos GNU-C */
|
||||
#ifdef __atarist__
|
||||
# ifdef __gem__
|
||||
# define TOS 1
|
||||
# define COMPILED_BY "GNU-C " __VERSION__
|
||||
# define TINYSTACK 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* OS9/68000 */
|
||||
#ifdef OSK
|
||||
# define COMPILED_BY "Microware C V2.3 Edition 40"
|
||||
# define TINYSTACK 1
|
||||
#endif
|
||||
|
||||
/* DEC Rainbow, running MS-DOS (handled by earlier MS-DOS tests) */
|
||||
/* (would need -DRAINBOW in CFLAGS to compile a Rainbow-compatible .EXE) */
|
||||
|
||||
#ifdef VMS
|
||||
# define COMPILED_BY "VAX/VMS VAXC compiler"
|
||||
# undef VMS
|
||||
# define VMS 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COHERENT
|
||||
# ifdef _I386
|
||||
# define COH_386 1
|
||||
# define COH_286 0
|
||||
# else
|
||||
# define COH_386 0
|
||||
# define COH_286 1
|
||||
# endif
|
||||
# undef COHERENT
|
||||
# define COHERENT 1
|
||||
#endif
|
||||
|
||||
/*************************** end of autoconf section ************************/
|
||||
|
||||
/* All undefined symbols are defined to zero here, to allow for older */
|
||||
/* compilers which dont understand #if defined() or #if UNDEFINED_SYMBOL */
|
||||
|
||||
/*************************** operating systems *****************************/
|
||||
|
||||
#ifndef BSD
|
||||
# define BSD 0 /* UNIX - Berkeley 4.x */
|
||||
#endif
|
||||
|
||||
#ifndef UNIXV
|
||||
# define UNIXV 0 /* UNIX - AT&T SYSV */
|
||||
#endif
|
||||
|
||||
#ifndef UNIX7
|
||||
# define UNIX7 0 /* UNIX - version 7 */
|
||||
#endif
|
||||
|
||||
#ifndef MSDOS
|
||||
# define MSDOS 0 /* PC */
|
||||
#endif
|
||||
|
||||
#ifndef TOS
|
||||
# define TOS 0 /* Atari ST */
|
||||
#endif
|
||||
|
||||
#ifndef AMIGA
|
||||
# define AMIGA 0 /* Commodore Amiga */
|
||||
#endif
|
||||
|
||||
#ifndef OSK
|
||||
# define OSK 0 /* OS-9 / 68k */
|
||||
#endif
|
||||
|
||||
#ifndef COHERENT
|
||||
# define COHERENT 0 /* Coherent */
|
||||
#endif
|
||||
|
||||
#ifndef RAINBOW /* DEC Rainbow support, under MS-DOS */
|
||||
# define RAINBOW 0
|
||||
#endif
|
||||
|
||||
#ifndef VMS
|
||||
# define VMS 0 /* VAX/VMS */
|
||||
#endif
|
||||
|
||||
/* Minix has no predefines */
|
||||
#if !BSD && !UNIXV && !UNIX7 && !MSDOS && !TOS && !AMIGA && !OSK && !COHERENT && !VMS
|
||||
# define MINIX 1
|
||||
#else
|
||||
# define MINIX 0
|
||||
#endif
|
||||
|
||||
/* generic combination of Unices */
|
||||
#if UNIXV || UNIX7 || BSD || MINIX || COHERENT
|
||||
# define ANY_UNIX 1
|
||||
#else
|
||||
# define ANY_UNIX 0
|
||||
#endif
|
||||
|
||||
#ifndef TINYSTACK
|
||||
# define TINYSTACK 0
|
||||
#endif
|
||||
|
||||
/*************************** compilers **************************************/
|
||||
|
||||
#ifndef AZTEC_C
|
||||
# define AZTEC_C 0
|
||||
#endif
|
||||
|
||||
#ifndef MICROSOFT
|
||||
# define MICROSOFT 0
|
||||
#endif
|
||||
|
||||
#ifndef TURBOC
|
||||
# define TURBOC 0
|
||||
#endif
|
||||
|
||||
/* Should we use "new style" ANSI C prototypes? */
|
||||
#ifdef __STDC__
|
||||
# define NEWSTYLE 1
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
# define NEWSTYLE 1
|
||||
#endif
|
||||
#ifndef NEWSTYLE
|
||||
# define NEWSTYLE 0
|
||||
#endif
|
||||
|
||||
#if NEWSTYLE
|
||||
# define P_(s) s
|
||||
#else
|
||||
# define P_(s) ()
|
||||
#endif
|
||||
|
||||
/******************************* Credit ************************************/
|
||||
|
||||
#if MSDOS
|
||||
# define CREDIT "Ported to MS-DOS by Guntram Blohm & Martin Patzel"
|
||||
# if RAINBOW
|
||||
# define CREDIT2 "Rainbow support added by Willett Kempton"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if AMIGA
|
||||
# define CREDIT "Ported to AmigaDOS 2.04 by Mike Rieser & Dale Rahn"
|
||||
#endif
|
||||
|
||||
#if TOS
|
||||
# define CREDIT "Ported to Atari/TOS by Guntram Blohm & Martin Patzel"
|
||||
#endif
|
||||
|
||||
#if OSK
|
||||
# define CREDIT "Ported to Microware OS9/68k by Peter Reinig"
|
||||
#endif
|
||||
|
||||
#if COHERENT
|
||||
# define CREDIT "Ported to Coherent by Esa Ahola"
|
||||
#endif
|
||||
|
||||
#if VMS
|
||||
# define CREDIT "Ported to VAX/VMS by John Campbell"
|
||||
#endif
|
||||
/*************************** functions depending on OS *********************/
|
||||
|
||||
/* There are two terminal-related functions that we need: ttyread() and
|
||||
* ttywrite(). The ttyread() function implements read-with-timeout and is
|
||||
* a true function on all systems. The ttywrite() function is almost always
|
||||
* just a macro...
|
||||
*/
|
||||
#if !TOS && !AMIGA
|
||||
# define ttywrite(buf, len) write(1, buf, (unsigned)(len)) /* raw write */
|
||||
#endif
|
||||
|
||||
/* The strchr() function is an official standard now, so everybody has it
|
||||
* except Unix version 7 (which is old) and BSD Unix (which is academic).
|
||||
* Those guys use something called index() to do the same thing.
|
||||
*/
|
||||
#if BSD || UNIX7 || OSK
|
||||
# define strchr index
|
||||
# define strrchr rindex
|
||||
#endif
|
||||
#if !NEWSTYLE
|
||||
extern char *strchr();
|
||||
#endif
|
||||
|
||||
/* BSD uses bcopy() instead of memcpy() */
|
||||
#if BSD
|
||||
# define memcpy(dest, src, siz) bcopy(src, dest, siz)
|
||||
#endif
|
||||
|
||||
/* BSD uses getwd() instead of getcwd(). The arguments are a little different,
|
||||
* but we'll ignore that and hope for the best; adding arguments to the macro
|
||||
* would mess up an "extern" declaration of the function.
|
||||
*
|
||||
* Also, the Coherent-286 uses getwd(), but Coherent-386 uses getcwd()
|
||||
*/
|
||||
#if BSD
|
||||
#ifndef _POSIX_VERSION
|
||||
# define getcwd getwd
|
||||
#endif
|
||||
#endif
|
||||
#if COH_286
|
||||
# define getcwd getwd
|
||||
#endif
|
||||
extern char *getcwd();
|
||||
|
||||
/* text versa binary mode for read/write */
|
||||
#if !TOS
|
||||
#define tread(fd,buf,n) read(fd,buf,(unsigned)(n))
|
||||
#define twrite(fd,buf,n) write(fd,buf,(unsigned)(n))
|
||||
#endif
|
||||
|
||||
/**************************** Compiler quirks *********************************/
|
||||
|
||||
/* the UNIX version 7 and (some) TOS compilers, don't allow "void" */
|
||||
#if UNIX7 || TOS
|
||||
# define void int
|
||||
#endif
|
||||
|
||||
/* as far as I know, all compilers except version 7 support unsigned char */
|
||||
/* NEWFLASH: the Minix-ST compiler has subtle problems with unsigned char */
|
||||
#if UNIX7 || MINIX
|
||||
# define UCHAR(c) ((c) & 0xff)
|
||||
# define uchar char
|
||||
#else
|
||||
# define UCHAR(c) ((unsigned char)(c))
|
||||
# define uchar unsigned char
|
||||
#endif
|
||||
|
||||
/* Some compilers prefer to have malloc declared as returning a (void *) */
|
||||
/* ANSI, on the other hand, needs the arguments to free() to be cast */
|
||||
#ifndef __STDC__
|
||||
# if BSD || AMIGA || MINIX
|
||||
extern void *malloc();
|
||||
# define _free_(ptr) free((void *)ptr)
|
||||
# else
|
||||
extern char *malloc();
|
||||
# define _free_(ptr) free((char *)ptr)
|
||||
# endif
|
||||
#else
|
||||
# define _free_(ptr) free((void *)ptr)
|
||||
#endif /* __STDC__ */
|
||||
|
||||
/* everybody but Amiga wants lseek declared here */
|
||||
#if !AMIGA
|
||||
extern long lseek();
|
||||
#endif
|
||||
|
||||
/* ANSI C has getenv() declared in stdlib.h, which we've already included.
|
||||
* Other compilers will need it declared here, though.
|
||||
*/
|
||||
#ifndef __STDC__
|
||||
extern char *getenv();
|
||||
#endif
|
||||
|
||||
/* Signal handler functions used to return an int value, which was ignored.
|
||||
* On newer systems, signal handlers are void functions. Here, we try to
|
||||
* guess the proper return type for this system.
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
# define SIGTYPE void
|
||||
#else
|
||||
# if MSDOS
|
||||
# define SIGTYPE void
|
||||
# else
|
||||
# if UNIXV
|
||||
# define SIGTYPE void /* Note: This is wrong for SCO Xenix. */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#ifndef SIGTYPE
|
||||
# define SIGTYPE int
|
||||
#endif
|
||||
|
||||
/******************* Names of files and environment vars **********************/
|
||||
|
||||
#if ANY_UNIX
|
||||
# ifndef TMPDIR
|
||||
# if MINIX
|
||||
# define TMPDIR "/usr/tmp" /* Keep elvis' temp files off RAM disk! */
|
||||
# else
|
||||
# define TMPDIR "/var/tmp" /* directory where temp files live */
|
||||
# endif
|
||||
# endif
|
||||
# ifndef PRSVDIR
|
||||
# define PRSVDIR "/var/preserve" /* directory where preserved file live */
|
||||
# endif
|
||||
# ifndef PRSVINDEX
|
||||
# define PRSVINDEX "/var/preserve/Index" /* index of files in PRSVDIR */
|
||||
# endif
|
||||
# ifndef EXRC
|
||||
# define EXRC ".exrc" /* init file in current directory */
|
||||
# endif
|
||||
# define SCRATCHOUT "%s/soXXXXXX" /* temp file used as input to filter */
|
||||
# ifndef SHELL
|
||||
# define SHELL "/bin/sh" /* default shell */
|
||||
# endif
|
||||
# if COHERENT
|
||||
# ifndef REDIRECT
|
||||
# define REDIRECT ">" /* Coherent CC writes errors to stdout */
|
||||
# endif
|
||||
# endif
|
||||
# define gethome(x) getenv("HOME")
|
||||
#endif
|
||||
|
||||
#if AMIGA /* Specify AMIGA environment */
|
||||
# ifndef CC_COMMAND
|
||||
# define CC_COMMAND "cc" /* generic C compiler */
|
||||
# endif
|
||||
# ifndef COLON
|
||||
# define COLON ':' /* Amiga files can also end in `:' */
|
||||
# endif
|
||||
# ifndef SYSEXRC
|
||||
# define SYSEXRC "S:" EXRC /* name of ".exrc" file in system dir */
|
||||
# endif
|
||||
# ifndef MAXRCLEN
|
||||
# define MAXRCLEN 2048 /* max size of a .exrc file */
|
||||
# endif
|
||||
# ifndef NBUFS
|
||||
# define NBUFS 10 /* must be at least 3 -- more is better */
|
||||
# endif
|
||||
# ifndef NEEDSYNC
|
||||
# define NEEDSYNC TRUE /* assume ":se sync" by default */
|
||||
# endif
|
||||
# ifndef PRSVDIR
|
||||
# define PRSVDIR "Elvis:" /* directory where preserved file live */
|
||||
# endif
|
||||
# ifndef PRSVINDEX
|
||||
# define PRSVINDEX "Elvis:Index" /* index of files in PRSVDIR */
|
||||
# endif
|
||||
# ifndef REDIRECT
|
||||
# define REDIRECT ">" /* Amiga writes errors to stdout */
|
||||
# endif
|
||||
# ifndef SCRATCHIN
|
||||
# define SCRATCHIN "%sSIXXXXXX"
|
||||
# endif
|
||||
# ifndef SCRATCHOUT
|
||||
# define SCRATCHOUT "%sSOXXXXXX"
|
||||
# endif
|
||||
# ifndef SHELL
|
||||
# define SHELL "newshell" /* default shell */
|
||||
# endif
|
||||
# ifndef TERMTYPE
|
||||
# define TERMTYPE "amiga" /* default termtype */
|
||||
# endif
|
||||
# ifndef TMPDIR /* for AMIGA should end in `:' or `/' */
|
||||
# define TMPDIR "T:" /* directory where temp files live */
|
||||
# endif
|
||||
# ifndef TMPNAME
|
||||
# define TMPNAME "%selv_%x.%x" /* format of names for temp files */
|
||||
# endif
|
||||
# define gethome(x) getenv("HOME")
|
||||
#endif
|
||||
|
||||
#if MSDOS || TOS
|
||||
/* do not change TMPNAME and SCRATCH*: they MUST begin with '%s\\'! */
|
||||
# ifndef TMPDIR
|
||||
# define TMPDIR "C:\\tmp" /* directory where temp files live */
|
||||
# endif
|
||||
# ifndef PRSVDIR
|
||||
# define PRSVDIR "C:\\preserve" /* directory where preserved file live */
|
||||
# endif
|
||||
# ifndef PRSVINDEX
|
||||
# define PRSVINDEX "C:\\preserve\\Index" /* index of files in PRSVDIR */
|
||||
# endif
|
||||
# define TMPNAME "%s\\elv_%x.%x" /* temp file */
|
||||
# if MSDOS
|
||||
# if MICROSOFT
|
||||
# define CC_COMMAND "cl -c" /* C compiler */
|
||||
# else
|
||||
# if __BORLANDC__ /* Borland C */
|
||||
# define CC_COMMAND "bcc" /* C compiler */
|
||||
# else
|
||||
# if TURBOC /* Turbo C */
|
||||
# define CC_COMMAND "tcc" /* C compiler */
|
||||
# endif /* TURBOC */
|
||||
# endif /* BORLANDC */
|
||||
# endif /* MICROSOFT */
|
||||
# endif /* MSDOS */
|
||||
# define SCRATCHIN "%s\\siXXXXXX" /* DOS ONLY - output of filter program */
|
||||
# define SCRATCHOUT "%s\\soXXXXXX" /* temp file used as input to filter */
|
||||
# define SLASH '\\'
|
||||
# ifndef SHELL
|
||||
# if TOS
|
||||
# define SHELL "shell.ttp" /* default shell */
|
||||
# else
|
||||
# define SHELL "command.com" /* default shell */
|
||||
# endif
|
||||
# endif
|
||||
# define NEEDSYNC TRUE /* assume ":se sync" by default */
|
||||
# if TOS && __GNUC__ /* probably on other systems, too */
|
||||
# define REDIRECT "2>" /* GNUC reports on 2, others on 1 */
|
||||
# define CC_COMMAND "gcc -c"
|
||||
# else
|
||||
# define REDIRECT ">" /* shell's redirection of stderr */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if VMS
|
||||
/* do not change TMPNAME, and SCRATCH*: they MUST begin with '%s\\'! */
|
||||
# ifndef TMPDIR
|
||||
# define TMPDIR "sys$scratch:" /* directory where temp files live */
|
||||
# endif
|
||||
# define TMPNAME "%selv_%x.%x;1" /* temp file */
|
||||
# define SCRATCHIN "%ssiXXXXXX" /* DOS ONLY - output of filter program */
|
||||
# define SCRATCHOUT "%ssoXXXXXX" /* temp file used as input to filter */
|
||||
# define SLASH '\:' /* Worry point... jdc */
|
||||
# ifndef SHELL
|
||||
# define SHELL "" /* default shell */
|
||||
# endif
|
||||
# define REDIRECT ">" /* shell's redirection of stderr */
|
||||
# define tread(fd,buf,n) vms_read(fd,buf,(unsigned)(n))
|
||||
# define close vms_close
|
||||
# define lseek vms_lseek
|
||||
# define unlink vms_delete
|
||||
# define delete __delete /* local routine conflicts w/VMS rtl routine. */
|
||||
# define rpipe vms_rpipe
|
||||
# define rpclose vms_rpclose
|
||||
# define ttyread vms_ttyread
|
||||
# define gethome(x) getenv("HOME")
|
||||
/* There is no sync() on vms */
|
||||
# define sync()
|
||||
/* jdc -- seems VMS external symbols are case insensitive */
|
||||
# define m_fWord m_fw_ord
|
||||
# define m_bWord m_bw_ord
|
||||
# define m_eWord m_ew_ord
|
||||
# define m_Nsrch m_n_srch
|
||||
# define m_Fch m_f_ch
|
||||
# define m_Tch m_t_ch
|
||||
# define v_Xchar v_x_char
|
||||
/* jdc -- also, braindead vms curses always found by linker. */
|
||||
# define LINES elvis_LINES
|
||||
# define COLS elvis_COLS
|
||||
# define curscr elvis_curscr
|
||||
# define stdscr elvis_stdscr
|
||||
# define initscr elvis_initscr
|
||||
# define endwin elvis_endwin
|
||||
# define wrefresh elvis_wrefresh
|
||||
#endif
|
||||
|
||||
#if OSK
|
||||
# ifndef TMPDIR
|
||||
# define TMPDIR "/dd/tmp" /* directory where temp files live */
|
||||
# endif
|
||||
# ifndef PRSVDIR
|
||||
# define PRSVDIR "/dd/usr/preserve" /* directory where preserved file live */
|
||||
# endif
|
||||
# ifndef PRSVINDEX
|
||||
# define PRSVINDEX "/dd/usr/preserve/Index" /* index of files in PRSVDIR */
|
||||
# endif
|
||||
# ifndef CC_COMMAND
|
||||
# define CC_COMMAND "cc -r" /* name of the compiler */
|
||||
# endif
|
||||
# ifndef EXRC
|
||||
# define EXRC ".exrc" /* init file in current directory */
|
||||
# endif
|
||||
# define SCRATCHOUT "%s/soXXXXXX" /* temp file used as input to filter */
|
||||
# ifndef SHELL
|
||||
# define SHELL "shell" /* default shell */
|
||||
# endif
|
||||
# define FILEPERMS (S_IREAD|S_IWRITE) /* file permissions used for creat() */
|
||||
# define REDIRECT ">>-" /* shell's redirection of stderr */
|
||||
# define sync() /* OS9 doesn't need a sync() */
|
||||
# define gethome(x) getenv("HOME")
|
||||
#endif
|
||||
|
||||
#ifndef TAGS
|
||||
# define TAGS "tags" /* name of the tags file */
|
||||
#endif
|
||||
|
||||
#ifndef TMPNAME
|
||||
# define TMPNAME "%s/elv_%x.%x" /* format of names for temp files */
|
||||
#endif
|
||||
|
||||
#ifndef EXINIT
|
||||
# define EXINIT "EXINIT" /* name of EXINIT environment variable */
|
||||
#endif
|
||||
|
||||
#ifndef EXRC
|
||||
# define EXRC "elvis.rc" /* name of ".exrc" file in current dir */
|
||||
#endif
|
||||
|
||||
#ifndef HMEXRC
|
||||
# define HMEXRC EXRC /* name of ".exrc" file in home dir */
|
||||
#endif
|
||||
|
||||
#ifndef KEYWORDPRG
|
||||
# define KEYWORDPRG "ref"
|
||||
#endif
|
||||
|
||||
#ifndef SCRATCHOUT
|
||||
# define SCRATCHIN "%s/SIXXXXXX"
|
||||
# define SCRATCHOUT "%s/SOXXXXXX"
|
||||
#endif
|
||||
|
||||
#ifndef ERRLIST
|
||||
# define ERRLIST "errs"
|
||||
#endif
|
||||
|
||||
#ifndef SLASH
|
||||
# define SLASH '/'
|
||||
#endif
|
||||
|
||||
#ifndef SHELL
|
||||
# define SHELL "shell"
|
||||
#endif
|
||||
|
||||
#ifndef REG
|
||||
# define REG register
|
||||
#endif
|
||||
|
||||
#ifndef NEEDSYNC
|
||||
# define NEEDSYNC FALSE
|
||||
#endif
|
||||
|
||||
#ifndef FILEPERMS
|
||||
# define FILEPERMS 0666
|
||||
#endif
|
||||
|
||||
#ifndef PRESERVE
|
||||
# define PRESERVE "/usr/libexec/elvispreserve" /* name of the "preserve" program */
|
||||
#endif
|
||||
|
||||
#ifndef CC_COMMAND
|
||||
# define CC_COMMAND "cc -c"
|
||||
#endif
|
||||
|
||||
#ifndef MAKE_COMMAND
|
||||
# define MAKE_COMMAND "make"
|
||||
#endif
|
||||
|
||||
#ifndef REDIRECT
|
||||
# define REDIRECT "2>"
|
||||
#endif
|
||||
|
||||
#ifndef BLKSIZE
|
||||
# ifdef CRUNCH
|
||||
# define BLKSIZE 1024
|
||||
# else
|
||||
# define BLKSIZE 2048
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef KEYBUFSIZE
|
||||
# define KEYBUFSIZE 1000
|
||||
#endif
|
||||
|
||||
#ifndef MAILER
|
||||
# define MAILER "mail"
|
||||
#endif
|
||||
|
||||
#ifndef gethome
|
||||
extern char *gethome();
|
||||
#endif
|
||||
|
||||
#endif /* ndef _CONFIG_H */
|
|
@ -1,81 +0,0 @@
|
|||
/* ctype.c */
|
||||
|
||||
/* This file contains the tables and initialization function for elvis'
|
||||
* version of <ctype.h>. It should be portable.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: ctype.c,v 1.3 1993/08/02 17:53:46 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include "ctype.h"
|
||||
|
||||
void _ct_init P_((uchar *));
|
||||
|
||||
uchar _ct_toupper[256];
|
||||
uchar _ct_tolower[256];
|
||||
uchar _ct_ctypes[256];
|
||||
|
||||
/* This function initializes the tables used by the ctype macros. It should
|
||||
* be called at the start of the program. It can be called again anytime you
|
||||
* wish to change the non-standard "flipcase" list. The "flipcase" list is
|
||||
* a string of characters which are taken to be lowercase/uppercase pairs.
|
||||
* If you don't want to use any special flipcase characters, then pass an
|
||||
* empty string.
|
||||
*/
|
||||
void _ct_init(flipcase)
|
||||
uchar *flipcase; /* list of non-standard lower/upper letter pairs */
|
||||
{
|
||||
int i;
|
||||
uchar *scan;
|
||||
|
||||
/* reset all of the tables */
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
_ct_toupper[i] = _ct_tolower[i] = i;
|
||||
_ct_ctypes[i] = 0;
|
||||
}
|
||||
|
||||
/* add the digits */
|
||||
for (scan = (uchar *)"0123456789"; *scan; scan++)
|
||||
{
|
||||
_ct_ctypes[*scan] |= _CT_DIGIT | _CT_ALNUM;
|
||||
}
|
||||
|
||||
/* add the whitespace */
|
||||
for (scan = (uchar *)" \t\n\r\f"; *scan; scan++)
|
||||
{
|
||||
_ct_ctypes[*scan] |= _CT_SPACE;
|
||||
}
|
||||
|
||||
/* add the standard ASCII letters */
|
||||
for (scan = (uchar *)"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ"; *scan; scan += 2)
|
||||
{
|
||||
_ct_ctypes[scan[0]] |= _CT_LOWER | _CT_ALNUM;
|
||||
_ct_ctypes[scan[1]] |= _CT_UPPER | _CT_ALNUM;
|
||||
_ct_toupper[scan[0]] = scan[1];
|
||||
_ct_tolower[scan[1]] = scan[0];
|
||||
}
|
||||
|
||||
/* add the flipcase letters */
|
||||
for (scan = flipcase; scan[0] && scan[1]; scan += 2)
|
||||
{
|
||||
_ct_ctypes[scan[0]] |= _CT_LOWER | _CT_ALNUM;
|
||||
_ct_ctypes[scan[1]] |= _CT_UPPER | _CT_ALNUM;
|
||||
_ct_toupper[scan[0]] = scan[1];
|
||||
_ct_tolower[scan[1]] = scan[0];
|
||||
}
|
||||
|
||||
/* include '_' in the isalnum() list */
|
||||
_ct_ctypes[UCHAR('_')] |= _CT_ALNUM;
|
||||
|
||||
/* !!! find the control characters in an ASCII-dependent way */
|
||||
for (i = 0; i < ' '; i++)
|
||||
{
|
||||
_ct_ctypes[i] |= _CT_CNTRL;
|
||||
}
|
||||
_ct_ctypes[127] |= _CT_CNTRL;
|
||||
_ct_ctypes[255] |= _CT_CNTRL;
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
# This is the Makefile for Elvis' "doc" directory. It makes use of a
|
||||
# troff-like formatter called mroff. Since you probably don't have mroff,
|
||||
# you'll need to edit this Makefile before you can fully use it. It can
|
||||
# also use nroff, though, so you should be able to get something out of it.
|
||||
#
|
||||
# make Use nroff to create an ASCII version of the manual.
|
||||
# make foo.doc Use nroff to create an ASCII version of foo.man or foo.ms
|
||||
# make manual Use MROFF to print a typeset manual on a laser printer
|
||||
# make foo.1200 Use MROFF to print a typeset version of foo.man or foo.ms
|
||||
# make foo.100 Use MROFF to print a draft-quality version of foo.man or foo.ms
|
||||
# make foo.more Use MROFF to preview foo.man or foo.more on your terminal
|
||||
#
|
||||
|
||||
###############################################################################
|
||||
# Definitions...
|
||||
|
||||
MAN= ctags.man elvis.man elvprsv.man elvrec.man fmt.man ref.man
|
||||
MS= title.ms index.ms intro.ms visual.ms ex.ms regexp.ms options.ms\
|
||||
cutbufs.ms differ.ms internal.ms cflags.ms termcap.ms environ.ms\
|
||||
versions.ms question.ms
|
||||
DOC= title.doc index.doc intro.doc visual.doc ex.doc regexp.doc options.doc\
|
||||
cutbufs.doc differ.doc internal.doc cflags.doc termcap.doc environ.doc\
|
||||
versions.doc question.doc\
|
||||
ctags.doc elvis.doc elvprsv.doc elvrec.doc fmt.doc ref.doc
|
||||
MANUAL= title.1200 index.1200 intro.1200 visual.1200 ex.1200 regexp.1200 options.1200\
|
||||
cutbufs.1200 differ.1200 internal.1200 cflags.1200 termcap.1200 environ.1200\
|
||||
versions.1200\
|
||||
ctags.1200 elvis.1200 elvprsv.1200 elvrec.1200 fmt.1200 ref.1200
|
||||
VER= ver.ms
|
||||
TROFF= mroff
|
||||
NROFF= nroff
|
||||
|
||||
###############################################################################
|
||||
# Rules...
|
||||
|
||||
.SUFFIXES: .tmp .100 .1200 .more .doc .man .ms .vga .vgas
|
||||
|
||||
.ms.tmp:
|
||||
$(TROFF) -ms $(VER) $< >tmp
|
||||
|
||||
.man.tmp:
|
||||
$(TROFF) -man $< >tmp
|
||||
|
||||
.ms.more:
|
||||
$(TROFF) -ms $(VER) $< | draft | more
|
||||
|
||||
.man.more:
|
||||
$(TROFF) -man $< | draft | more
|
||||
|
||||
.ms.1200:
|
||||
$(TROFF) -ms $(VER) $< | hp2 1200 | lp -og $(PRINTER)
|
||||
|
||||
.man.1200:
|
||||
$(TROFF) -man $< | hp2 1200 | lp -og $(PRINTER)
|
||||
|
||||
.ms.100:
|
||||
$(TROFF) -ms $(VER) $< | hp2 100 | lp -og $(PRINTER)
|
||||
|
||||
.man.100:
|
||||
$(TROFF) -man $< | hp2 100 | lp -og $(PRINTER)
|
||||
|
||||
.ms.doc:
|
||||
$(NROFF) -ms $(VER) $< >$@
|
||||
|
||||
.man.doc:
|
||||
$(NROFF) -man $< >$@
|
||||
|
||||
.ms.vga:
|
||||
$(TROFF) -ms $(VER) $< >/tmp/foo
|
||||
-vga /tmp/foo
|
||||
rm /tmp/foo
|
||||
|
||||
.ms.vgas:
|
||||
$(TROFF) -ms $(VER) $< >/tmp/foo
|
||||
-vgas /tmp/foo
|
||||
rm /tmp/foo
|
||||
|
||||
#############################################################################
|
||||
# Targets...
|
||||
|
||||
Elvisman.txt: $(DOC)
|
||||
cat $(DOC) | col -b >Elvisman.txt
|
||||
#cat $(DOC) | col -b -x | sed 's/^/ /' >Elvisman.txt
|
||||
|
||||
manual: $(MANUAL)
|
||||
|
||||
clean:
|
||||
rm -f *.doc
|
|
@ -1,48 +0,0 @@
|
|||
# $Id: Makefile,v 1.2 1993/08/02 17:53:27 mycroft Exp $
|
||||
|
||||
NROFF= nroff
|
||||
HPROFF= troff
|
||||
HPDEST= >/dev/hp
|
||||
PSROFF= troff -p
|
||||
PSDEST= >/dev/lp
|
||||
MS= title.ms index.ms intro.ms visual.ms ex.ms regexp.ms options.ms \
|
||||
cutbufs.ms differ.ms internal.ms makefile.ms cflags.ms termcap.ms \
|
||||
environ.ms versions.ms question.ms
|
||||
MAN= ctags.man elvis.man elvprsv.man elvrec.man fmt.man ref.man
|
||||
DOC= title.doc index.doc intro.doc visual.doc ex.doc regexp.doc options.doc \
|
||||
cutbufs.doc differ.doc internal.doc makefile.doc cflags.doc termcap.doc \
|
||||
environ.doc versions.doc question.doc ctags.doc elvis.doc elvprsv.doc \
|
||||
elvrec.doc fmt.doc ref.doc
|
||||
PS= title.ps index.ps intro.ps visual.ps ex.ps regexp.ps options.ps \
|
||||
cutbufs.ps differ.ps internal.ps makefile.ps cflags.ps termcap.ps \
|
||||
environ.ps versions.ps question.ps ctags.ps elvis.ps elvprsv.ps \
|
||||
elvrec.ps fmt.ps ref.ps
|
||||
HP= title.ps index.ps intro.hp visual.hp ex.hp regexp.hp options.hp \
|
||||
cutbufs.hp differ.hp internal.hp makefile.hp cflags.hp termcap.hp \
|
||||
environ.hp versions.hp question.hp ctags.hp elvis.hp elvprsv.hp \
|
||||
elvrec.hp fmt.hp ref.hp
|
||||
|
||||
.SUFFIXES: .test .doc .ps .hp .ms .man
|
||||
.ms.doc:
|
||||
$(NROFF) -ms ver.ms $*.ms | col -bx >$*.doc
|
||||
.man.doc:
|
||||
$(NROFF) -man $*.man | col -bx >$*.doc
|
||||
.ms.ps:
|
||||
$(PSROFF) -ms ver.ms $*.ms $(PSDEST)
|
||||
.man.ps:
|
||||
$(PSROFF) -man $*.man $(PSDEST)
|
||||
.ms.hp:
|
||||
$(HPROFF) -ms ver.ms $*.ms $(HPDEST)
|
||||
.man.hp:
|
||||
$(HPROFF) -man $*.man $(HPDEST)
|
||||
.ms.test:
|
||||
$(PSROFF) -ms ver.ms $*.ms >/dev/null
|
||||
.man.test:
|
||||
$(PSROFF) -man $*.man >/dev/null
|
||||
|
||||
../Elvisman.txt: $(DOC)
|
||||
cat $(DOC) >../Elvisman.txt
|
||||
Elvisman.ps: $(PS)
|
||||
Elvisman.hp: $(HP)
|
||||
clean:
|
||||
rm -f $(DOC) Elvisman.txt
|
|
@ -1,286 +0,0 @@
|
|||
.Go 10 "CFLAGS"
|
||||
.PP
|
||||
\*E uses many preprocessor symbols to control compilation.
|
||||
Some of these control the sizes of buffers and such.
|
||||
The "-DNO_XXXX" options remove small sets of related features.
|
||||
.PP
|
||||
Most \*E users will probably want to keep all features available.
|
||||
Minix-PC users, though, will have to sacrifice some sets because otherwise
|
||||
\*E would be too bulky to compile.
|
||||
The "asld" phase of the compiler craps out.
|
||||
.IP "-DM_SYSV, -Dbsd, -DTOS, -DCOHERENT, -Damiga"
|
||||
These flags tell the compiler that \*E is being compiled for
|
||||
System-V UNIX, BSD UNIX, Atari TOS, Coherent, or AmigaDos, respectively.
|
||||
For other systems, the config.h file can generally figure it out automatically.
|
||||
.IP -DRAINBOW
|
||||
For MS-DOS systems, this causes support for the DEC Rainbow to be compiled
|
||||
into \*E.
|
||||
.IP -DNO_S5WINSIZE
|
||||
Some versions of SysV UNIX don't support support the "winsize"
|
||||
style of screen-size testing.
|
||||
If you have a SysV system and can't compile "curses.c",
|
||||
then try adding -DNO_S5WINSIZE to the CFLAGS.
|
||||
.IP -DTERMIOS
|
||||
POSIX is a SysV-derived specification which uses a terminal control
|
||||
package called "termios", instead of "termio".
|
||||
Some other SysV systems may also use termios.
|
||||
You can make elvis uses termios instead of the more common termio
|
||||
by adding -DTERMIOS to CFLAGS.
|
||||
(Note: This hasn't been tested very well.)
|
||||
.IP -DNBUFS=\fInumber\fP
|
||||
\*E keeps most of your text in a temporary file;
|
||||
only a small amount is actually stored in RAM.
|
||||
This flag allows you to control how much of the file can be in RAM at any time.
|
||||
The default is 5 blocks, and the minimum is 3 blocks.
|
||||
(See the -DBLKSIZE flag, below.)
|
||||
.IP
|
||||
More RAM allows global changes to happen a little faster.
|
||||
If you're just making many small changes in one section of a file, though,
|
||||
extra RAM won't help much.
|
||||
.IP -DBLKSIZE=\fInumber\fP
|
||||
This controls the size of blocks that \*E uses internally.
|
||||
The value of BLKSIZE must be a power of two.
|
||||
Every time you double BLKSIZE, you quadruple the size of a text file that
|
||||
\*E can handle, but you also cause the temporary file to grow faster.
|
||||
For MS-DOS, Coherent, and Minix-PC, the default value is 1024, which allows
|
||||
you to edit files up to almost 512K bytes long.
|
||||
For all other systems, the default value is 2048, which allows you to edit
|
||||
files that are nearly 2 megabytes long.
|
||||
.IP
|
||||
The BLKSIZE also determines the maximum line length, and a few other limits.
|
||||
BLKSIZE should be either 256, 512, 1024, or 2048.
|
||||
Values other than these can lead to strange behaviour.
|
||||
.IP -DTMPDIR=\fIstring\fP
|
||||
This sets the default value of the "directory" option, which specifies where
|
||||
the temporary files should reside.
|
||||
The value of TMPDIR must be a string, so be sure your value includes the
|
||||
quote characters on each end.
|
||||
.IP "-DEXRC=\fIstr\fP, -DHMEXRC=\fIstr\fP, -DSYSEXRC=\fIstr\fP, -DEXINIT=\fIstr\fP"
|
||||
This lets you control the names of the initialization files.
|
||||
Their values must be strings, so be careful about quoting.
|
||||
.IP
|
||||
EXRC is the name of the initialization file in the current directory.
|
||||
Its default value is ".exrc" on UNIX systems -- the same as the real vi.
|
||||
Since that isn't a legal DOS filename, under DOS the default is "elvis.rc".
|
||||
For other systems, check the config.h file.
|
||||
.IP
|
||||
HMEXRC is the name of the initialization file in your home directory.
|
||||
By default, it is the same as EXRC.
|
||||
\*E will automatically prepend the name of your home directory to HMEXRC
|
||||
at run time, so don't give a full path name.
|
||||
.IP
|
||||
SYSEXRC is the name of a system-wide initialization file.
|
||||
It has no default value;
|
||||
if you don't define a value for it, then
|
||||
the code that supports SYSEXRC just isn't compiled.
|
||||
The value of SYSEXRC should be a full pathname, in quotes.
|
||||
.IP
|
||||
EXINIT is the name of an environment variable that can contain initialization
|
||||
commands.
|
||||
Normally, its value is "EXINIT".
|
||||
.IP -DKEYWORDPRG=\fIstring\fP
|
||||
This flag determines the default value of the "keywordprg" option.
|
||||
Its value must be a string, so be careful about quoting.
|
||||
The default value of this flag is "ref", which is a C reference program.
|
||||
.IP "-DCC_COMMAND=\fIstring\fP -DMAKE_COMMAND=\fIstring\fP -DERRLIST=\fIstring\fP"
|
||||
These control the names of the C compiler, the "make" utility, and the
|
||||
error output file, respectively.
|
||||
They are only used if -DNO_ERRLIST is not given.
|
||||
.IP
|
||||
The default value of CC_COMMAND depends on the Operating System and compiler
|
||||
that you use to compile elvis;
|
||||
for UNIX, the default is "cc".
|
||||
The default values of MAKE_COMMAND and ERRLIST are "make" and "errlist",
|
||||
respectively.
|
||||
.IP -DMAXRCLEN=\fInumber\fP
|
||||
This determines how large a :@ macro command can be (measured in bytes).
|
||||
The default is 1000 bytes.
|
||||
If you increase this value significantly,
|
||||
then you may need to allocate extra memory for the stack.
|
||||
See the "CHMEM" setting in the Makefile.
|
||||
.IP -DSHELL=\fIstring\fP
|
||||
This is the default value of the "shell" option, and hence
|
||||
the default shell used from within \*E.
|
||||
This only controls the default;
|
||||
the value you give here may be overridden at run-time by setting
|
||||
an environment variable named SHELL (or COMSPEC for MS-DOS).
|
||||
Its value must be a string constant, so be careful about quoting.
|
||||
.IP -DMAILER=\fIstring\fP
|
||||
This is the name of the program that \*E uses to send mail to a user whose
|
||||
text has just been preserved.
|
||||
(See the manual page for the \fIelvprsv\fR program.)
|
||||
If your system doesn't use electronic mail, then this option is irrelevent.
|
||||
For UNIX and OS-9 systems, though, the value should be a quoted string.
|
||||
The default value is "mail", but
|
||||
SysV users may prefer to use "mailx", and BSD users may prefer "Mail".
|
||||
.IP -DTAGS=\fIstring\fP
|
||||
This sets the name of the "tags" file,
|
||||
which is used by the :tag command.
|
||||
Its value must be a string constant, so be careful about quoting.
|
||||
.IP "-DCS_IBMPC -DCS_LATIN1 -DCS_SPECIAL"
|
||||
The digraph table and flipcase option will normally start out empty.
|
||||
However, if you add -DCS_IBMPC or -DCS_LATIN1 to your CFLAGS,
|
||||
then they will start out filled with values that are appropriate for the
|
||||
IBM PC character set or the ISO Latin-1 character set, respectively.
|
||||
.IP
|
||||
You can also use -DCS_IBMPC and -DCS_SPECIAL together to get digraphs
|
||||
that produce the PC's graphic characters.
|
||||
.IP "-DDEBUG -DEBUG2"
|
||||
-DDEBUG adds the ":debug" and ":validate" commands,
|
||||
and also adds many internal consistency checks.
|
||||
It increases the size of the ".text" segment by about 6K.
|
||||
.IP
|
||||
-DDEBUG2 causes a line to be appended to a file called "debug.out"
|
||||
everytime any change is made to the edit buffer.
|
||||
.IP -DCRUNCH
|
||||
This flag removes some non-critical code, so that \*E is smaller.
|
||||
For example, it removes a short-cut from the regexp package, so that
|
||||
text searches are slower.
|
||||
Also, screen updates are not as efficient.
|
||||
A couple of obscure features are disabled by this, too.
|
||||
.IP -DNO_MKEXRC
|
||||
This removes the ":mkexrc" command,
|
||||
so you have to create any .exrc files manually.
|
||||
The size of the .text segment will be reduced by about 1500 bytes.
|
||||
.IP -DNO_CHARATTR
|
||||
Permanently disables the charattr option.
|
||||
This reduces the size of your ".text" segment by about 850 bytes.
|
||||
.IP -DNO_RECYCLE
|
||||
Normally, \*E will recycle space (from the temporary file) which contains
|
||||
totally obsolete text.
|
||||
This flag disables this recycling.
|
||||
Without recycling, the ".text" segment is about 1K smaller
|
||||
than it would otherwise be,
|
||||
but the tmp file grows much faster.
|
||||
If you have a lot of free space on your hard disk,
|
||||
but \*E is too bulky to run with recycling,
|
||||
then try it without recycling.
|
||||
.IP
|
||||
When using a version of \*E that has been compiled with -DNO_RECYCLE,
|
||||
you should be careful to avoid making many small changes to a file
|
||||
because each individual change will cause the tmp file to grow by at least 1k.
|
||||
Hitting "x" thirty times counts as thirty changes,
|
||||
but typing "30x" counts as one change.
|
||||
Also, you should occasionally do a ":w" followed by a ":e" to start with a
|
||||
fresh tmp file.
|
||||
.IP
|
||||
Interestingly, the real vi never recycles space from its temporary file.
|
||||
.IP -DNO_SENTENCE
|
||||
Leaves out the "(" and ")" visual mode commands.
|
||||
Also, the "[[", "]]", "{", and "}" commands will not recognize *roff macros.
|
||||
The sections and paragraphs options go away.
|
||||
This saves about 650 bytes in the ".text" segment.
|
||||
.IP -DNO_CHARSEARCH
|
||||
Leaves out the visual commands which locate a given character
|
||||
in the current line:
|
||||
"f", "t", "F", "T", "," and ";".
|
||||
This saves about 900 bytes.
|
||||
.IP -DNO_EXTENSIONS
|
||||
Leaves out the "K" and "#" visual commands.
|
||||
Also, the arrow keys will no longer work in input mode.
|
||||
Regular expressions will no longer recognize the \\{\\} operator.
|
||||
(Other extensions are either inherent in the design of \*E,
|
||||
or are controlled by more specific flags,
|
||||
or are too tiny to be worth removing.)
|
||||
This saves about 250 bytes.
|
||||
.IP -DNO_MAGIC
|
||||
Permanently disables the "magic" option, so that most meta-characters
|
||||
in a regular expression are *NOT* recognized.
|
||||
This saves about 3k of space in the ".text" segment, because
|
||||
the complex regular expression code can be replaced by much simpler code.
|
||||
.IP -DNO_SHOWMODE
|
||||
Permanently disables the "showmode" option, saving about 250 bytes.
|
||||
.IP -DNO_CURSORSHAPE
|
||||
Normally, \*E tries to adjust the shape of the cursor as a reminder
|
||||
of which mode you're in.
|
||||
The -DNO_CURSORSHAPE flag disables this, saving about 150 bytes.
|
||||
.IP -DNO_DIGRAPH
|
||||
To allow entry of non-ASCII characters, \*E supports digraphs.
|
||||
A digraph is a single (non-ASCII) character which is entered as a
|
||||
combination of two other (ASCII) characters.
|
||||
If you don't need to input non-ASCII characters,
|
||||
or if your keyboard supports a better way of entering non-ASCII characters,
|
||||
then you can disable the digraph code and save about 450 bytes.
|
||||
.IP -DNO_ERRLIST
|
||||
\*E adds a ":errlist" command, which is useful to programmers.
|
||||
If you don't need this feature, you can disable it via the -DNO_ERRLIST flag.
|
||||
This will reduce the .text segment by about 900 bytes, and the .bss segment
|
||||
by about 300 bytes.
|
||||
.IP -DNO_ABBR
|
||||
The -DNO_ABBR flag disables the ":abbr" command,
|
||||
and reduces the size of \*E by about 250 bytes.
|
||||
.IP -DNO_OPTCOLS
|
||||
When \*E displays the current options settings via the ":set" command,
|
||||
the options are normally sorted into columns.
|
||||
The -DNO_OPTCOLS flag causes the options to be sorted across the rows,
|
||||
which is much simpler for the computer.
|
||||
The -DNO_OPTCOLS flag will reduce the size of your .text segment by about
|
||||
500 bytes.
|
||||
.IP -DNO_MODELINES
|
||||
This removes all support for modelines.
|
||||
.IP -DNO_TAG
|
||||
This disables tag lookup.
|
||||
It reduces the size of the .text segment by about 750 bytes.
|
||||
.IP -DNO_TAGSTACK
|
||||
This disables the tagstack.
|
||||
The ^T and :pop commands will no longer be available.
|
||||
.IP "-DNO_ALT_FKEY, -DNO_CTRL_FKEY, -DNO_SHIFT_FKEY, -DNO_FKEY"
|
||||
These remove explicit support of function keys.
|
||||
-DNO_ALT_FKEY removes support for the <alternate> versions function keys.
|
||||
-DNO_CTRL_FKEY removes support for the <control> and <alternate> versions function keys.
|
||||
-DNO_SHIFT_FKEY removes support for the <shift>, <control>, and <alternate> versions function keys.
|
||||
-DNO_FKEY removes all support of function keys.
|
||||
.IP
|
||||
\*E's ":map" command normally allows you to use the special sequence "#<n>"
|
||||
to map function key <n>.
|
||||
For example, ":map #1 {!}fmt^M" will cause the <F1> key to reformat a paragraph.
|
||||
\*E checks the :k1=: field in the termcap description of your terminal
|
||||
to figure out what code is sent by the <F1> key.
|
||||
This is handy because it allows you to create a .exrc file which maps function
|
||||
keys the same way regardless of what type of terminal you use.
|
||||
.IP
|
||||
That behaviour is standard; most implementations of the real vi supports it too.
|
||||
\*E extends this to allow you to use "#1s" to refer to <shift>+<F1>,
|
||||
"#1c" to refer to <control>+<F1>, and
|
||||
"#1a" to refer to <alt>+<F1>.
|
||||
The termcap description for the terminal should have fields named
|
||||
:s1=:c1=:a1=: respectively, to define the code sent by these key conbinations.
|
||||
(You should also have :k2=:s2=:c2=:a2=: for the <F2> key, and so on.)
|
||||
.IP
|
||||
But there may be problems.
|
||||
The terminfo database doesn't support :s1=:c1=:a1=:, so no terminfo terminal
|
||||
description could ever support shift/control/alt function keys;
|
||||
so you might as well add -DNO_SHIFT_FKEY to CFLAGS if you're using terminfo.
|
||||
.IP
|
||||
Note that, even if you have -DNO_FKEYS, you can still configure \*E to use
|
||||
your function keys my mapping the literal character codes sent by the key.
|
||||
You just couldn't do it in a terminal-independent way.
|
||||
.IP "-DTERM_925, -DTERM_AMIGA, -DTERM_VT100, -DTERM_VT52, etc."
|
||||
The tinytcap.c file contains descriptions of several terminal types.
|
||||
For each system that uses tinytcap, a reasonable subset of the available
|
||||
descriptions is actually compiled into \*E.
|
||||
If you wish to enlarge this subset, then you can add the appropriate -DTERM_XXX
|
||||
flag to your CFLAGS settings.
|
||||
.IP
|
||||
For a list of the available terminal types, check the tinytcap.c file.
|
||||
.IP -DINTERNAL_TAGS
|
||||
Normally, \*E uses the "ref" program to perform tag lookup.
|
||||
This is more powerful than the real vi's tag lookup,
|
||||
but it can be much slower.
|
||||
.IP
|
||||
If you add -DINTERNAL_TAGS to your CFLAGS setting,
|
||||
then \*E will use its own internal tag lookup code, which is faster.
|
||||
.IP -DPRSVDIR=\fIdirectory\fR
|
||||
This controls where preserved files will be placed.
|
||||
An appropriate default has been chosen for each Operating System,
|
||||
so you probably don't need to worry about it.
|
||||
.IP -DFILEPERMS=\fInumber\fR
|
||||
This affects the attributes of files that are created by \*E;
|
||||
it is used as the second argument to the creat() function.
|
||||
The default is 0666 which (on UNIX systems at least) means that
|
||||
anybody can read or write the new file, but nobody can execute it.
|
||||
On UNIX systems, the creat() call modifies this via the umask setting.
|
||||
.IP -DKEYBUFSIZE=\fInumber\fR
|
||||
This determines the size of the type-ahead buffer that elvis uses.
|
||||
It also limits the size of keymaps that it can handle.
|
||||
The default is 1000 characters, which should be plenty.
|
|
@ -1,4 +0,0 @@
|
|||
case $1 in
|
||||
-*) shift;;
|
||||
esac
|
||||
sed 's/.//g' $*
|
|
@ -1,84 +0,0 @@
|
|||
.TH CTAGS 1
|
||||
.SH NAME
|
||||
ctags - Generates "tags" and (optionally) "refs" files
|
||||
.SH SYNOPSIS
|
||||
\fBctags\fP [\fB-stvra\fP] \fIfilesnames\fP...
|
||||
.SH DESCRIPTION
|
||||
\fIctags\fP generates the "tags" and "refs" files
|
||||
from a group of C source files.
|
||||
The "tags" file is used by Elvis' ":tag" command,
|
||||
control-] command,
|
||||
and -t option.
|
||||
The "refs" file is sometimes used by the \fIref(1)\fP program.
|
||||
.PP
|
||||
Each C source file is scanned for #define statements and
|
||||
global function definitions.
|
||||
The name of the macro or function becomes the name of a tag.
|
||||
For each tag, a line is added to the "tags" file which contains:
|
||||
.RS
|
||||
.nf
|
||||
- the name of the tag
|
||||
- a tab character
|
||||
- the name of the file containing the tag
|
||||
- a tab character
|
||||
- a way to find the particular line within the file.
|
||||
.RE
|
||||
.fi
|
||||
.PP
|
||||
The filenames list will typically be the names of all C source
|
||||
files in the current directory, like this:
|
||||
.RS
|
||||
.nf
|
||||
$ ctags -stv *.[ch]
|
||||
.RE
|
||||
.fi
|
||||
.SH OPTIONS
|
||||
.IP \fB-t\fR
|
||||
Include typedefs.
|
||||
A tag will be generated for each user-defined type.
|
||||
Also tags will be generated for struct and enum names.
|
||||
Types are considered to be global if they are defined in a header file,
|
||||
and static if they are defined in a C source file.
|
||||
.IP \fB-v\fR
|
||||
Include variable declarations.
|
||||
A tag will be generated for each variable, except for those that are declared
|
||||
inside the body of a function.
|
||||
.IP \fB-s\fR
|
||||
Include static tags.
|
||||
\fICtags\fR will normally put global tags in the "tags" file, and silently ignore
|
||||
the static tags.
|
||||
This flag causes both global and static tags to be added.
|
||||
The name of a static tag is generated by prefixing the name of the declared
|
||||
item with the name of the file where it is defined, with a colon in between.
|
||||
For example, "static foo(){}" in "bar.c" results in a tag named "bar.c:foo".
|
||||
.IP \fB-r\fP
|
||||
This causes \fIctags\fP to generate both "tags" and "refs".
|
||||
Without \fB-r\fP, it would only generate "tags".
|
||||
.IP \fB-a\fR
|
||||
Append to "tags", and maybe "refs".
|
||||
Normally, \fIctags\fR overwrites these files each time it is invoked.
|
||||
This flag is useful when you have to many files in the current directory
|
||||
for you to list them on a single command-line;
|
||||
it allows you to split the arguments among several invocations.
|
||||
.SH FILES
|
||||
.IP tags
|
||||
A cross-reference that lists each tag name, the name of the source file that
|
||||
contains it, and a way to locate a particular line in the source file.
|
||||
.IP refs
|
||||
The "refs" file contains the definitions for each tag in the "tags" file,
|
||||
and very little else.
|
||||
This file can be useful, for example, when licensing restrictions prevent
|
||||
you from making the source code to the standard C library readable by everybody,
|
||||
but you still everybody to know what arguments the library functions need.
|
||||
.SH BUGS
|
||||
.PP
|
||||
\fIctags\fR is sensitive to indenting and line breaks.
|
||||
Consequently, it might not discover all of the tags in a file that
|
||||
is formatted in an unusual way.
|
||||
.SH "SEE ALSO"
|
||||
elvis(1), refs(1)
|
||||
.SH AUTHOR
|
||||
.nf
|
||||
Steve Kirkendall
|
||||
kirkenda@cs.pdx.edu
|
||||
.fi
|
|
@ -1,130 +0,0 @@
|
|||
.Go 6 "CUT BUFFERS"
|
||||
.PP
|
||||
When \*E deletes text, it stores that text in a cut buffer.
|
||||
This happens in both visual mode and EX mode.
|
||||
There is no practical limit to how much text a cut buffer can hold.
|
||||
.PP
|
||||
There are 36 cut buffers:
|
||||
26 named buffers ("a through "z),
|
||||
9 anonymous buffers ("1 through "9),
|
||||
and 1 extra cut buffer (".).
|
||||
.PP
|
||||
In EX mode, the :move and :copy commands use a cut buffer to temporarily
|
||||
hold the text to be moved/copied.
|
||||
.NH 2
|
||||
Putting text into a Cut Buffer
|
||||
.PP
|
||||
In visual mode, text is copied into a cut buffer when you use the
|
||||
d, y, c, C, s, or x commands.
|
||||
There are also a few others.
|
||||
.PP
|
||||
By default, the text goes into the "1 buffer.
|
||||
The text that used to be in "1 gets shifted into "2,
|
||||
"2 gets shifted into "3, and so on.
|
||||
The text that used to be in "9 is lost.
|
||||
This way, the last 9 things you deleted are still accessible.
|
||||
.PP
|
||||
You can also put the text into a named buffer -- "a through "z.
|
||||
To do this, you should type the buffer's name
|
||||
(two keystrokes: a double-quote and a lowercase letter)
|
||||
before the command that will cut the text.
|
||||
When you do this, "1 through "9 are not affected by the cut.
|
||||
.PP
|
||||
You can append text to one of the named buffers.
|
||||
To do this, type the buffer's name in uppercase
|
||||
(a double-quote and an uppercase letter)
|
||||
before the d/y/c/C/s/x command.
|
||||
.PP
|
||||
The ". buffer is special.
|
||||
It isn't affected by the d/y/c/C/s/x command.
|
||||
Instead, it stores the text that you typed in
|
||||
the last time you were in input mode.
|
||||
It is used to implement the . visual command,
|
||||
and ^A in input mode.
|
||||
.PP
|
||||
In EX mode (also known as colon mode),
|
||||
the :delete, :change, and :yank commands all copy text into a cut buffer.
|
||||
Like the visual commands, these EX commands normally use the "1 buffer,
|
||||
but you can use one of the named buffers by giving its name after the command.
|
||||
For example,
|
||||
.sp 1
|
||||
.ti +0.5i
|
||||
:20,30y a
|
||||
.sp
|
||||
.LP
|
||||
will copy lines 20 through 30 into cut buffer "a.
|
||||
.PP
|
||||
You can't directly put text into the ". buffer, or the "2 through "9 buffers.
|
||||
.NH 2
|
||||
Pasting from a Cut Buffer
|
||||
.PP
|
||||
There are two styles of pasting:
|
||||
line-mode and character-mode.
|
||||
If a cut buffer contains whole lines (from a command like "dd")
|
||||
then line-mode pasting is used;
|
||||
if it contains partial lines (from a command like "dw")
|
||||
then character-mode pasting is used.
|
||||
The EX commands always cut whole lines.
|
||||
.PP
|
||||
Character-mode pasting causes the text to be inserted into the line that
|
||||
the cursor is on.
|
||||
.PP
|
||||
Line-mode pasting inserts the text on a new line above or below the line
|
||||
that the cursor is on.
|
||||
It doesn't affect the cursor's line at all.
|
||||
.PP
|
||||
In visual mode, the p and P commands insert text from a cut buffer.
|
||||
Uppercase P will insert it before the cursor,
|
||||
and lowercase p will insert it after the cursor.
|
||||
Normally, these commands will paste from the "1 buffer, but you can
|
||||
specify any other buffer to paste from.
|
||||
Just type its name (a double-quote and another character)
|
||||
before you type the P or p.
|
||||
.PP
|
||||
In EX mode, the (pu)t command pastes text after a given line.
|
||||
To paste from a buffer other that "1,
|
||||
enter its name after the command.
|
||||
.NH 2
|
||||
Macros
|
||||
.PP
|
||||
The contents of a named cut buffer can be executed as a series of
|
||||
ex/vi commands.
|
||||
.PP
|
||||
To put the instructions into the cut buffer, you must first insert
|
||||
them into the file, and then delete them into a named cut buffer.
|
||||
.PP
|
||||
To execute a cut buffer's contents as EX commands,
|
||||
you should give the EX command "@" and the name of the buffer.
|
||||
For example, :@z will execute "z as a series of EX commands.
|
||||
.PP
|
||||
To execute a cut buffer's contents as visual commands,
|
||||
you should give the visual command "@" and the letter of the buffer's name.
|
||||
The visual "@" command is different from the EX "@" command.
|
||||
They interpret the cut buffer's contents differently.
|
||||
.PP
|
||||
The visual @ command can be rather finicky.
|
||||
Each character in the buffer is interpretted as a keystroke.
|
||||
If you load the instructions into the cut buffer via a "zdd command,
|
||||
then the newline character at the end of the line will be executed just
|
||||
like any other character, so the cursor would be moved down 1 line.
|
||||
If you don't want the cursor to move down 1 line at the end of each
|
||||
@z command, then you should load the cut buffer by saying 0"zD instead.
|
||||
.PP
|
||||
Although cut buffers can hold any amount of text,
|
||||
\*E can only \fIexecute\fR small buffers.
|
||||
The size limit is roughly 1000 characters, for either EX macros or VI macros.
|
||||
If a buffer is too large to execute, an error message is displayed.
|
||||
.PP
|
||||
You can't nest :@ commands.
|
||||
You can't run :@ commands from your .exrc file,
|
||||
or any other :source file either.
|
||||
Similarly, you can't run a :source command from within an @ command.
|
||||
Hopefully, these restrictions will be lifted in a later version.
|
||||
.NH 2
|
||||
The Effect of Switching Files
|
||||
.PP
|
||||
When \*E first starts up, all cut buffers are empty.
|
||||
When you switch to a different file
|
||||
(via the :n or :e commands perhaps)
|
||||
the 9 anonymous cut buffers are emptied again,
|
||||
but the other 27 buffers ("a through "z, and ".) retain their text.
|
|
@ -1,166 +0,0 @@
|
|||
.Go 7 "DIFFERENCES BETWEEN \*E & BSD VI/EX"
|
||||
.PP
|
||||
\*E is not 100% compatible with the real vi/ex.
|
||||
\*E has many small extensions, some omissions, and a few features which
|
||||
are implemented in a slightly different manner.
|
||||
.NH 2
|
||||
Extensions
|
||||
.IP "Save Configuration" 1i
|
||||
The :mkexrc command saves the current :set, :map, :ab, :color, and :digraph
|
||||
configurations in the ".exrc" file in your current directory.
|
||||
.IP "Previous File" 1i
|
||||
The :N or :prev command moves backwards through the args list.
|
||||
.IP "Center Current Row" 1i
|
||||
In visual command mode, the (lowercase) "zz" command will center the current
|
||||
line on the screen, like "z=".
|
||||
.IP "Changing Repeat Count" 1i
|
||||
The default count value for . is the same as the previous command
|
||||
which . is meant to repeat.
|
||||
However, you can supply a new count if you wish.
|
||||
For example, after "3dw", "." will delete 3 words,
|
||||
but "5." will delete 5 words.
|
||||
.IP "Previous Text" 1i
|
||||
The text which was most recently input
|
||||
(via a "cw" command, or something similar)
|
||||
is saved in a cut buffer called ". (which
|
||||
is a pretty hard name to write in an English sentence).
|
||||
.IP "Keyword Lookup" 1i
|
||||
In visual command mode, you can move the cursor onto a word and press
|
||||
shift-K to have \*E run a reference program to look that word up.
|
||||
This command alone is worth the price of admission!
|
||||
See the ctags and ref programs.
|
||||
.IP "Increment/Decrement" 1i
|
||||
In visual command mode, you can move the cursor onto a number and
|
||||
then hit ## or #+ to increment that number by 1.
|
||||
To increment it by a larger amount,
|
||||
type in the increment value before hitting the initial #.
|
||||
The number can also be decremented or set by hitting #- or #=, respectively.
|
||||
.IP "Input Mode" 1i
|
||||
You can backspace past the beginning of the line.
|
||||
.IP "" 1i
|
||||
The arrow keys work in input mode.
|
||||
.IP "" 1i
|
||||
If you type control-A, then the text that you input last time is inserted.
|
||||
You will remain in input mode, so you can backspace over part of it,
|
||||
or add more to it.
|
||||
(This is sort of like control-@ on the real vi,
|
||||
except that control-A really works.)
|
||||
.IP "" 1i
|
||||
Control-P will insert the contents of the cut buffer.
|
||||
.IP "" 1i
|
||||
Real vi can only remember up to 128 characters of input,
|
||||
but \*E can remember any amount.
|
||||
.IP "" 1i
|
||||
The ^T and ^D keys can adjust the indent of a line no matter where
|
||||
the cursor happens to be in that line.
|
||||
.IP "" 1i
|
||||
You can save your file and exit \*E directly from input mode by hitting
|
||||
control-Z twice.
|
||||
.IP "" 1i
|
||||
\*E supports digraphs as a way to enter non-ASCII characters.
|
||||
.IP "Start in Input Mode" 1i
|
||||
If you ":set inputmode" in your .exrc file, then \*E will start up in
|
||||
input mode instead of visual command mode.
|
||||
.IP "Visible Fonts" 1i
|
||||
With ":set charattr", \*E can display "backslash-f" style character attributes on the
|
||||
screen as you edit.
|
||||
The following example shows the recognized atributes:
|
||||
.sp
|
||||
.ti +0.5i
|
||||
normal \\fBboldface\\fR \\fIitalics\\fR \\fUunderlined\\fR normal
|
||||
.sp
|
||||
NOTE: you must compile \*E without the -DNO_CHARATTR flag for
|
||||
this to work.
|
||||
.IP "File Syncing" 1i
|
||||
After a crash, you can usually recover the altered form of the file
|
||||
from the temporary file that \*E uses -- unless the temporary file was
|
||||
corrupted.
|
||||
.IP "" 1i
|
||||
UNIX systems use a delayed-write cache, which means that when \*E tries to
|
||||
write to the temporary file, the information might still be in RAM instead
|
||||
of on the disk.
|
||||
A power failure at that time would cause the in-RAM information to be lost.
|
||||
UNIX's sync() call will force all such information to disk.
|
||||
.IP "" 1i
|
||||
MS-DOS and Atari TOS don't write a file's length to disk until that file
|
||||
is closed.
|
||||
Consequently, the temporary file would appear to be 0 bytes long if power
|
||||
failed when we were editing.
|
||||
To avoid this problem, a sync() function has been written which will close
|
||||
the temporary file and then immediately reopen it.
|
||||
.IP "Cursor Shape" 1i
|
||||
\*E changes the shape of the cursor to indicate which mode you're in,
|
||||
if your terminal's termcap entry includes the necessary capabilities.
|
||||
.IP "Hide nroff Lines" 1i
|
||||
The ":set hideformat" option hides nroff format control lines.
|
||||
(They are displayed on the screen as blank lines.)
|
||||
.ne 7
|
||||
.IP "Compiler Interface" 1i
|
||||
\*E is clever enough to parse the error messages emitted by many compilers.
|
||||
To use this feature,
|
||||
you should collect your compiler's error messages into a file called "errlist";
|
||||
\*E will read this file,
|
||||
determine which source file caused the error messages,
|
||||
start editing that file,
|
||||
move the cursor to the line where the error was detected,
|
||||
and display the error message on the status line.
|
||||
Nifty!
|
||||
.IP "Visible Text Selection" 1i
|
||||
In visual command mode, 'v' starts visibly selecting characters and
|
||||
\&'V' starts visibly selecting whole lines.
|
||||
The character or line where the cursor is located becomes one
|
||||
endpoint of the selection.
|
||||
You can then use the standard cursor movement commands to move the cursor
|
||||
to the other endpoint, and then press one of the operator commands
|
||||
(c/d/y/</>/!/=/\\).
|
||||
The operator will then immediately be applied to the selected text.
|
||||
.IP "Pop-up Menu Operator" 1i
|
||||
The '\\' key is a new operator,
|
||||
similar in operation to the c/d/y/</>/! operators.
|
||||
It conjures up a menu, from which you can select any of the other
|
||||
operators plus a few other common commands.
|
||||
.IP "Preset Filter Operator" 1i
|
||||
The '=' key is another new operator.
|
||||
It is similar to the '!' operator, except that while
|
||||
\&'!' asks you to type in a filter command each time,
|
||||
\&'=' assumes it should always run the command stored in the \fIequalprg\fR option.
|
||||
.IP "Move to a Given Percentage" 1i
|
||||
The '%' movement key can now accept an optional count.
|
||||
Without a count, the '%' key still moves to a matching parenthesis
|
||||
like it always did.
|
||||
With a count somewhere between 1 and 100, though, it moves the cursor to
|
||||
approximately a given percentage of the way through the file.
|
||||
For example, typing "50%" will move the cursor to the middle of the file.
|
||||
.IP "Regular Expressions"
|
||||
In regular expressions, several new forms of closure operators are supported:
|
||||
\\{\fIn\fR}, \\{\fIn\fR,\fIm\fR}, \\+, and \\?.
|
||||
.NH 2
|
||||
Omissions
|
||||
.PP
|
||||
The replace mode is a hack.
|
||||
It doesn't save the text that it overwrites.
|
||||
.PP
|
||||
Long lines are displayed differently -- where the real vi would
|
||||
wrap a long line onto several rows of the screen, \*E simply
|
||||
displays part of the line, and allows you to scroll the screen
|
||||
sideways to see the rest of it.
|
||||
.PP
|
||||
The ":preserve" and ":recover" commands are missing.
|
||||
So is the -r flag.
|
||||
I've never had a good reason to use ":preserve",
|
||||
and since ":recover" is used so rarely
|
||||
I decided to implement it as a separate program.
|
||||
There's no need to load the recovery code into memory every
|
||||
time you edit a file, I figured.
|
||||
.PP
|
||||
LISP support is missing.
|
||||
However, the = key is still an operator that reformats lines of text.
|
||||
By default, it reformats lines by sending them through the \fIfmt\fP filter,
|
||||
but you could write your own LISP beautifier and configure elvis to use it.
|
||||
Key mappings could take care of most other differences.
|
||||
Auto-indent is the only thing that is irrecoverably lost.
|
||||
.PP
|
||||
Autoindent mode acts a little different from the real vi, anyway.
|
||||
It doesn't handle ^^D or 0^D correctly.
|
||||
On the other hand, it \fIdoes\fP allow ^D and ^T to be used anywhere in the
|
||||
line, to adjust the indentation for the whole line.
|
|
@ -1,7 +0,0 @@
|
|||
# $Id: Makefile,v 1.3 1993/08/02 17:54:19 mycroft Exp $
|
||||
|
||||
PROG= elvisrecover
|
||||
CFLAGS+=-I${.CURDIR}/../elvis
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
.PATH: ${.CURDIR}/../elvis
|
|
@ -1,31 +0,0 @@
|
|||
Elvis is a clone of vi/ex, the standard UNIX editor. Elvis supports
|
||||
nearly all of the vi/ex commands, in both visual mode and colon mode.
|
||||
|
||||
Elvis runs under BSD UNIX, AT&T SysV UNIX, SCO Xenix, Minix, MS-DOS
|
||||
(Turbo-C or MSC 5.1), Atari TOS, OS9/68000, Coherent, VMS, and AmigaDos.
|
||||
Ports to other operating systems are in progress; contact me before you
|
||||
start porting it to some other OS, because somebody else may have
|
||||
already done it for you.
|
||||
|
||||
Elvis is freely redistributable, in either source form or executable
|
||||
form. There are no restrictions on how you may use it.
|
||||
|
||||
The file "elvisman.txt" contains the manual for elvis. It is a plain
|
||||
ASCII file with nothing more exotic than a newline character. It is
|
||||
formatted for 66-line, 80-column pages. There may also be an archive of
|
||||
"*.ms" and "*.man" files, which contain the TROFF source text used to
|
||||
generate that manual.
|
||||
|
||||
The file named "Makefile.mix" is used to compile elvis for all systems
|
||||
except VMS and possibly MS-DOS. You should copy "Makefile.mix" to
|
||||
"Makefile", and then edit "Makefile" to select the appropriate group of
|
||||
settings for your system.
|
||||
|
||||
|
||||
Author: Steve Kirkendall
|
||||
14407 SW Teal Blvd. #C
|
||||
Beaverton, OR 97005
|
||||
|
||||
E-mail: kirkenda@cs.pdx.edu
|
||||
|
||||
Phone: (503) 643-6980
|
|
@ -1,48 +0,0 @@
|
|||
.\" $Id: elvisrecover.1,v 1.4 1993/08/02 17:54:20 mycroft Exp $ -*- nroff -*-
|
||||
.TH ELVREC 1
|
||||
.SH NAME
|
||||
elvrec - Recover the modified version of a file after a crash
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fBelvrec\fP [\fIpreservedfile\fP [\fInewfile\fR]]
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
If you're editing a file when \fIelvis\fP dies, the system crashes, or power fails,
|
||||
the most recent version of your text will be preserved.
|
||||
The preserved text is stored in a special directory; it does NOT overwrite
|
||||
your text file automatically.
|
||||
.PP
|
||||
The \fIelvrec\fP program locates the preserved version of a given file,
|
||||
and writes it over the top of your text file -- or to a new file, if you prefer.
|
||||
The recovered file will have nearly all of your changes.
|
||||
.PP
|
||||
To see a list of all recoverable files, run \fIelvrec\fP with no arguments.
|
||||
.SH FILES
|
||||
.IP /usr/preserve/p*
|
||||
The text that was preserved when \fIelvis\fP died.
|
||||
.IP /usr/preserve/Index
|
||||
A text file which lists the names of all preserved files, and the names
|
||||
of the /usr/preserve/p* files which contain their preserved text.
|
||||
.SH BUGS
|
||||
.PP
|
||||
\fIelvrec\fP is very picky about filenames.
|
||||
You must tell it to recover the file using exactly the same pathname as
|
||||
when you were editing it.
|
||||
The simplest way to do this is to go into the same directory that you were
|
||||
editing, and invoke \fIelvrec\fP with the same filename as \fIelvis\fP.
|
||||
If that doesn't work, then try running \fIelvrec\fP with no arguments,
|
||||
to see exactly which pathname it is using for the desired file.
|
||||
.PP
|
||||
Due to the permissions on the /usr/preserve directory, on UNIX systems
|
||||
\fIelvrec\fP must be run as superuser.
|
||||
This is accomplished by making the \fIelvrec\fP executable be owned by "root"
|
||||
and setting its "set user id" bit.
|
||||
.PP
|
||||
If you're editing a nameless buffer when \fIelvis\fP dies, then \fIelvrec\fP
|
||||
will pretend that the file was named "foo".
|
||||
.SH AUTHOR
|
||||
.nf
|
||||
Steve Kirkendall
|
||||
kirkenda@cs.pdx.edu
|
||||
.fi
|
|
@ -1,206 +0,0 @@
|
|||
/* elvrec.c */
|
||||
|
||||
/* This file contains the file recovery program */
|
||||
|
||||
/* Author:
|
||||
* Steve Kirkendall
|
||||
* 14407 SW Teal Blvd. #C
|
||||
* Beaverton, OR 97005
|
||||
* kirkenda@cs.pdx.edu
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: elvisrecover.c,v 1.3 1993/08/02 17:54:21 mycroft Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "vi.h"
|
||||
|
||||
void recover P_((char *, char *));
|
||||
void main P_((int, char **));
|
||||
|
||||
|
||||
void recover(basename, outname)
|
||||
char *basename; /* the name of the file to recover */
|
||||
char *outname; /* the name of the file to write to */
|
||||
{
|
||||
char pathname[500]; /* full pathname of the file to recover */
|
||||
char line[600]; /* a line from the /usr/preserve/Index file */
|
||||
int ch; /* a character from the text being recovered */
|
||||
FILE *from; /* the /usr/preserve file, or /usr/preserve/Index */
|
||||
FILE *to; /* the user's text file */
|
||||
char *ptr;
|
||||
#if OSK
|
||||
int uid;
|
||||
#endif
|
||||
|
||||
/* convert basename to a full pathname */
|
||||
if (basename)
|
||||
{
|
||||
#ifndef CRUNCH
|
||||
# if MSDOS || TOS
|
||||
if (!basename[0] || basename[1] != ':')
|
||||
# else
|
||||
if (basename[0] != SLASH)
|
||||
# endif
|
||||
{
|
||||
ptr = getcwd(pathname, sizeof pathname);
|
||||
if (ptr != pathname)
|
||||
{
|
||||
strcpy(pathname, ptr);
|
||||
}
|
||||
ptr = pathname + strlen(pathname);
|
||||
*ptr++ = SLASH;
|
||||
strcpy(ptr, basename);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
strcpy(pathname, basename);
|
||||
}
|
||||
}
|
||||
|
||||
#if OSK
|
||||
uid = getuid();
|
||||
if(setuid(0))
|
||||
exit(_errmsg(errno, "Can't set uid\n"));
|
||||
#endif
|
||||
/* scan the /usr/preserve/Index file, for the *oldest* unrecovered
|
||||
* version of this file.
|
||||
*/
|
||||
from = fopen(PRSVINDEX, "r");
|
||||
while (from && fgets(line, sizeof line, from))
|
||||
{
|
||||
/* strip off the newline from the end of the string */
|
||||
line[strlen(line) - 1] = '\0';
|
||||
|
||||
/* parse the line into a "preserve" name and a "text" name */
|
||||
for (ptr = line; *ptr != ' '; ptr++)
|
||||
{
|
||||
}
|
||||
*ptr++ = '\0';
|
||||
|
||||
/* If the "preserve" file is missing, then ignore this line
|
||||
* because it describes a file that has already been recovered.
|
||||
*/
|
||||
if (access(line, 0) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* are we looking for a specific file? */
|
||||
if (basename)
|
||||
{
|
||||
/* quit if we found it */
|
||||
if (!strcmp(ptr, pathname))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* list this file as "available for recovery" */
|
||||
puts(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* file not found? */
|
||||
if (!basename || !from || feof(from))
|
||||
{
|
||||
if (from != NULL) fclose(from);
|
||||
if (basename)
|
||||
{
|
||||
fprintf(stderr, "%s: no recovered file has that exact name\n", pathname);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (from != NULL) fclose(from);
|
||||
|
||||
/* copy the recovered text back into the user's file... */
|
||||
|
||||
/* open the /usr/preserve file for reading */
|
||||
from = fopen(line, "r");
|
||||
if (!from)
|
||||
{
|
||||
perror(line);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
#if ANY_UNIX
|
||||
/* Be careful about user-id. We want to be running under the user's
|
||||
* real id when we open/create the user's text file... but we want
|
||||
* to be superuser when we delete the /usr/preserve file. For UNIX,
|
||||
* we accomplish this by deleting the /usr/preserve file *now*,
|
||||
* when it is open but before we've read it. Then we revert to the
|
||||
* user's real id.
|
||||
*/
|
||||
unlink(line);
|
||||
setuid(getuid());
|
||||
#endif
|
||||
#if OSK
|
||||
setuid(uid);
|
||||
#endif
|
||||
|
||||
if (outname == NULL) return;
|
||||
|
||||
/* open the user's file for writing */
|
||||
to = fopen(outname, "w");
|
||||
if (!to)
|
||||
{
|
||||
perror(ptr);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* copy the text */
|
||||
while ((ch = getc(from)) != EOF)
|
||||
{
|
||||
putc(ch, to);
|
||||
}
|
||||
|
||||
#if !ANY_UNIX
|
||||
#if OSK
|
||||
fclose(from);
|
||||
setuid(0);
|
||||
#endif
|
||||
/* delete the /usr/preserve file */
|
||||
unlink(line);
|
||||
#if OSK
|
||||
setuid(uid);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
/* check arguments */
|
||||
if (argc > 3)
|
||||
{
|
||||
fprintf(stderr, "usage: %s [preserved_file [recovery_file]]\n", argv[0]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* recover the requested file, or list recoverable files */
|
||||
if (argc == 3)
|
||||
{
|
||||
/* recover the file, but write it to a different filename */
|
||||
recover (argv[1], argv[2]);
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
/* recover the file */
|
||||
recover(argv[1], argv[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* list the recoverable files */
|
||||
recover((char *)0, (char *)0);
|
||||
}
|
||||
|
||||
/* success! */
|
||||
exit(0);
|
||||
}
|
Loading…
Reference in New Issue