Commit 62365111 authored by Boyuan Yang's avatar Boyuan Yang

Import Upstream version 1.81.6

parents
Changes since 1.81.5
* various compilation fixes
* support for newer DBs
* tcl support compiles again
Changes since 1.81.4
* add Changes document
* the preserve command overwrote the edited file; the problem
is really in DB; a bandaid was added
* configure changes
- -rpath now on by default
- check for iconv
* handle incomplete/invalid input
* upgrade libtool and automake
* Motif front-end was getting out of sync; fixed
* ^T works in presence of wide chars
* fix use of OPT_GLOBAL (YAMAMOTO Takashi <takashi.yamamoto@bigfoot.com>)
* missing fallback function added
* fix use of both leftright and number
(problem reported by Dima Dorfman <dima@unixfreak.org>)
* install everything 1.79 installed
* fix count argument for commands
(problem reported by Arfst Ludwig <Arfst.Ludwig@LHSystems.COM>)
* perl changes
- map no longer assumes its argument is the name of a perl function
- EXISTS for marks
* documentation changes
- vi.ref converted to texinfo
- vsplit documented
Changes since 1.81.3
* support for newer ncurses
* various other wide character related changes
* eliminate spurious cursor movements on split screens
* use of gtk-1.2 allowed again
* small fix to Motif front-end
/*-
* $Id: LICENSE,v 8.17 2000/08/18 14:58:41 bostic Exp $ (Sleepycat) $Date: 2000/08/18 14:58:41 $
*/
The following are the copyrights and redistribution conditions that apply
to this copy of the Vi software.
/*
* Copyright (c) 1991, 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
* Keith Bostic. All rights reserved.
* Copyright (c) 1999, 2000
* Sven Verdoolaege. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
# $Id: README,v 8.153 2001/04/30 09:31:12 skimo Exp $ (Berkeley) $Date: 2001/04/30 09:31:12 $
This is version 1.81.6 (2007-11-18) of nex/nvi, a reimplementation of the ex/vi
text editors originally distributed as part of the Fourth Berkeley
Software Distribution (4BSD), by the University of California, Berkeley.
The directory layout is as follows:
LICENSE ....... Copyright, use and redistribution information.
README ........ This file.
build.unix .... UNIX build directory.
catalog ....... Message catalogs; see catalog/README.
cl ............ Vi interface to the curses(3) library.
clib .......... C library replacement source code.
common ........ Code shared by ex and vi.
db ............ A stripped-down, replacement db(3) library.
dist .......... Various files used to build the vi distribution.
docs .......... Ex/vi documentation, both current and historic.
docs/README ... Documentation overview.
docs/edit ..... Edit: A tutorial.
docs/exref .... Ex Reference Manual -- Version 3.7.
docs/vi.man ... UNIX manual page for nex/nvi.
docs/vi.ref ... Nex/nvi reference manual.
docs/vitut .... An Introduction to Display Editing with Vi.
ex ............ Ex source code.
gtk ........... Vi gtk application.
include ....... Replacement include files.
ip ............ Library interface to vi: vi side.
ipc ........... Library interface to vi: application side.
motif ......... Vi motif application.
motif_l ....... Motif library interface to vi.
perl_api ...... Perl scripting language support.
perl_scripts .. Perl scripts.
regex ......... POSIX 1003.2 regular expression library.
tcl_api ....... Tcl scripting language support.
tcl_scripts ... Tcl scripts.
vi ............ Vi source code.
To build DB for a UNIX platform:
cd build.unix
../dist/configure
make
To build multiple UNIX versions of DB in the same source tree, create
a new directory then configure and build.
mkdir build.bsdos3.0
cd build.bsdos3.0
../dist/configure
make
For additional information about building DB for UNIX platforms, the
description of possible configuration options and other information
on DB configuration and build issues, see the file build.unix/README.
Bug fixes and updated versions of this software will periodically be made
available. For more information, as well as a list of Frequently Asked
Questions, see:
http://www.bostic.com/vi
To ask questions about vi, report vi problems, request notification of
future releases and/or bug fixes, or to contact the authors for any
reason, please send email to:
bostic@bostic.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
o This software is several years old and is the product of many folks' work.
This software was originally derived from software contributed to
the University of California, Berkeley by Steve Kirkendall, the
author of the vi clone elvis. Without his work, this work would
have been far more difficult.
IEEE POSIX 1003.2 style regular expression support is courtesy of
Henry Spencer, for which I am *very* grateful.
Elan Amir did the original 4BSD curses work that made it possible
to support a full-screen editor using curses.
George Neville-Neil added the Tcl interpreter, and the initial
interpreter design was his.
Sven Verdoolaege added the Perl interpreter.
Rob Mayoff provided the original Cscope support.
o Many, many people suggested enhancements, and provided bug reports and
testing, far too many to individually thank.
o From the original vi acknowledgements, by William Joy and Mark Horton:
Bruce Englar encouraged the early development of this display
editor. Peter Kessler helped bring sanity to version 2's
command layout. Bill Joy wrote versions 1 and 2.0 through 2.7,
and created the framework that users see in the present editor.
Mark Horton added macros and other features and made the editor
work on a large number of terminals and Unix systems.
o And...
The financial support of UUNET Communications Services is gratefully
acknowledged.
This is a development version of nvi.
Use at your own risk.
Please do not contact the original authors about bugs you
find in this version. Contact skimo-vi@kotnet.org instead.
There is no guarantee that anything in this version will be
available in upcoming stable releases.
New versions will be made available on
http://www.kotnet.org/~skimo/nvi
As always this software comes with absolutely NO WARRANTY.
Now read the original README file.
Sven Verdoolaege
This version of vi requires DB3.1 or better, which can be found
on http://www.sleepycat.com/ .
Note that there is a small problem with DB 3.2 in that it will
not let nvi read in a final line that doesn't end in a newline.
This should be fixed in DB 3.3
If your system library (such as glibc prior to version 2.2) uses a
previous version of db (e.g. DB2) internally, you must configure with
--enable-dynamic-loading to avoid symbols in the internally used db from
being resolved against the newer db.
If, on top of that, the vi binary is explicitly linked against that
previous version of db (such as might happen if you enable the perl
embedding), you should compile the 3.x version with all symbols internally
resolved. In case you use the Gnu linker (ld), this can be accomplished
by passing it the -Bsymbolic option. You can do this by setting CC
to e.g. "gcc -Wl,-Bsymbolic" prior to configuring db.
See docs/ref/build_unix/flags.html in the db distribution for more
information.
skimo@kotnet.org
# $Id: TODO,v 8.2 1997/04/12 15:53:31 bostic Exp $ (Berkeley) $Date: 1997/04/12 15:53:31 $
========================================================================
GENERAL
========================================================================
2.0: Open mode is not yet implemented.
========================================================================
DB
========================================================================
1.N When nvi edits files that don't have trailing newlines, it appends
one, regardless. This is required, by default, from POSIX.2.
1.N: If you run out of space in the recovery directory, the recovery
file is left in place.
2.0: It's known that it's possible to sync the backing files in the
wrong manner, leaving backup files that aren't recoverable. This
is going to be left alone until we have a logging version of DB,
which will hopefully fix this (or at least make it possible to
easily do so).
========================================================================
VI
========================================================================
1.N: Make the search pattern and command history (what the '.' command
executes) remembered between windows, or configurable so that it
is.
1.N: Change the screen scrolling to not eat user characters... i.e.
g/pattern/foo should not eat already entered chars.
1.N: The vi main command loop should use the general-purpose overflow
and underflow routines. In addition, the vi command loop uses
unsigned longs -- should probably be fixed as a 32-bit unsigned
type, and then check to make sure it's never used as as variable
type again.
1.N: Should "view" set a lock on the file?
1.N: Should "view" copy the file (or even open a recovery file)?
1.N: The strings found by searches should be highlighted until the next
character is entered.
1.N: Display a split vi screen for the :help command.
1.N: When getting a key for a continue screen, we should always read from
the terminal, not from a mapped key.
1.N: The sentence, paragraph and section movement commands don't match
historic practice in some boundary cases. This should be left
alone until POSIX 1003.2 makes up its mind.
1.N: The vs_sm_fill routine should scroll if possible, not always redraw.
1.N: Think about setting a dirty/inuse bits on the lines of the SMAP
structure. That way the message routines could steal lines and
refresh would continue to work, because it would know not to touch
the lines that were in use.
========================================================================
EX
========================================================================
2.0: ^C isn't passed to the shell in the script windows as an interrupt
character.
2.0: It would be nice to inverse video the replaced text during
interactive substitute.
2.0: The :args command should put the current file name out in reverse
video. This isn't going to be easy, currently only full lines can
be in reverse video, not just parts.
========================================================================
CURSES
========================================================================
1.N In single-line screens, have to press 'q' twice when quitting out
of a ":set all" display.
========================================================================
MOTIF/IPC
========================================================================
1.N: We currently permit the user to change the lines, columns and term
edit options. Shouldn't that be illegal in a window interface?
========================================================================
REDESIGN
========================================================================
2.0: There's a serious problem with error returns -- we need to separate
command failure from fatal error, consistently, over the entire source
tree. We need to rework all of vi to have three return values:
0: success
1: vi error, continue
2: fatal error, die
Right now we don't recognize fatal errors for what they are.
2.0: The complete list of POSIX.1 calls that can return EINTR are:
wait, waitpid, sleep, dup2, close, read, write,
fcntl(SETLCKW) tcsetattr, tcdrain
The problem is that technically, any system/library call can
return EINTR, so, while nvi blocks (most of?) the obvious ones,
someone may have to do a complete pass and block signals
everywhere.
2.0: The options hardtabs, lisp, optimize, redraw, and slowopen
are recognized, but not implemented.
2.0: Field editing shouldn't be hard to add to nvi:
Field editing file template:
version #
field # row/column start row/column stop
label field # Label string
re field # Matching re string.
field # row/column start row/column stop
label field # Label string
re field # Matching re string.
<tab> moves to the next field
<bs> in column 0 moves to the previous field
This diff is collapsed.
This diff is collapsed.
There are some known problems with Solaris curses.
Please give ncurses a try when you encounter a screen output problem.
Apparently, the more recent Solaris compilers invoke the incremental linker,
`ild', when the "-g" option is used and one or more "xxx.o" files are
specified on the command line during the link phase. Unfortunately, the
executable produced is up to 3-4 times as big as an executable generated
by the standard linker `ld'.
You can bypass this by adding "-xildoff" to LDFLAGS or by
setting CFLAGS (to something that does not contain "-g").
# $Id: Makefile,v 8.30 1996/11/27 11:59:09 bostic Exp $ (Berkeley) $Date: 1996/11/27 11:59:09 $
CAT= dutch english french german ru_SU.KOI8-R spanish swedish
FILES= ../cl/*.c ../common/*.c ../ex/*.c ../vi/*.c
all: dump ${CAT}
${CAT}: english.base
@echo "... $@"; \
rm -f $@; \
sort -u $@.base | \
awk '{ \
if ($$1 == 1) { \
print "\nMESSAGE NUMBER 1 IS NOT LEGAL"; \
exit 1; \
} \
if (++nline > $$1) { \
print "DUPLICATE MESSAGE NUMBER " $$1; \
exit 1; \
} \
for (; nline < $$1; ++nline) \
print ""; \
print $0; \
}' | \
sed -e '1s/^/VI_MESSAGE_CATALOG/' \
-e '/"/s/^[^"]*"//' \
-e '1!s/"$$/X/' > $@; \
chmod 444 $@; \
if grep DUPLICATE $@ > /dev/null; then \
grep DUPLICATE $@; \
fi; \
if grep 'NOT LEGAL' $@ > /dev/null; then \
grep 'NOT LEGAL' $@; \
fi
CHK= dutch.check english.check french.check german.check \
ru_SU.KOI8-R.check spanish.check swedish.check
check: ${CHK}
${CHK}: ${CAT}
@echo "... $@"; \
f=`basename $@ .check`; \
(echo "Unused message id's (this is okay):"; \
awk '{ \
while (++nline < $$1) \
printf "%03d\n", nline; \
}' < $$f.base; \
echo =========================; \
echo "MISSING ERROR MESSAGES (Please add!):"; \
awk '{print $$1}' < $$f.base | sort -u > __ck1; \
awk '{print $$1}' < english.base | sort -u > __ck2; \
comm -13 __ck1 __ck2; \
echo =========================; \
echo "Extra error messages (just delete them):"; \
comm -23 __ck1 __ck2; \
echo =========================; \
echo "MESSAGES WITH THE SAME MESSAGE ID's (FIX!):"; \
for j in \
`sed '/^$$/d' < $$f.base | sort -u | \
awk '{print $$1}' | uniq -d`; do \
egrep $$j $$f.base; \
done; \
echo =========================; \
echo "Duplicate messages, both id and message (this is okay):"; \
sed '/^$$/d' < $$f.base | sort | uniq -c | \
awk '$$1 != 1 { print $$0 }' | sort -n; \
echo =========================; \
echo "Duplicate messages, just message (this is okay):"; \
sed '/^$$/d' < $$f | sort | uniq -c | \
awk '$$1 != 1 { print $$0 }' | sort -n; \
echo =========================) > $@
english.base: dump ${FILES} #Makefile
./dump ${FILES} |\
sed -e '/|/!d' \
-e 's/|/ "/' \
-e 's/^"//' \
-e 's/\\"/"/g' |\
sort -n > $@
dump: dump.c
${CC} -O -o dump dump.c
clean:
rm -f dump dump.o ${CAT} english.base *.check __ck1 __ck2
# $Id: README,v 8.4 1994/11/22 09:52:04 bostic Exp $ (Berkeley) $Date: 1994/11/22 09:52:04 $
Generally, all non-system error and informational messages in nvi are
catalog messages, i.e. they can be tailored to a specific langauge.
Command strings, usage strings, system errors and other "known text"
are not. It would certainly be possible to internationalize all the
text strings in nvi, but it's unclear that it's the right thing to do.
First, there's no portable way to do message catalogs. The System V
scheme is a reasonable choice, but none of the 4BSD derived systems
support it. So, catalogs are completely implemented within nvi, and
don't require any library support.
Message catalogs in nvi are fairly simple. Every catalog message
consists of two parts -- an initial number followed by a pipe (`|')
character, followed by the English text for the message. For example:
msgq(sp, M_ERR, "001|This is an error message");
would be a typical message.
When the msgq() routine is called, if the user has specified a message
catalog and the format string (the third argument) has a leading number,
then it is converted to a record number, and that record is retrieved
from the message catalog and used as a replacement format string. If
the record can't be retrieved for any reason, the English text is displayed
instead.
Each message format string MUST map into the English format string, i.e.
it can't display more or different arguments than the English one.
For example:
msgq(sp, M_ERR, "002|Error: %d %x", arg1, arg2);
is a format string that displays two arguments. It is possible, however,
to reorder the arguments or to not display all of them. The convention
nvi uses is the System V printf(3) convention, i.e. "%[0-9]*$" is the name
of a specific, numbered argument. For example:
msgq(sp, M_ERR, "002|Error: %2$d %1$x", arg1, arg2);
displays the arguments in reverse order.
If the system supports this convention in its library printf routines
(as specified by the test #define NL_ARGMAX), nvi uses those routines.
Otherwise, there is some serious magic going on in common/msg.c to make
this all work.
Arguments to the msgq function are required to contain ONLY printable
characters. No further translation is done by the msgq routine before
displaying the message on the screen. For example, in the msgq call:
msgq(sp, M_ERR, "003|File: %s", file_name);
"file_name" must contain only printable characters. The routine
msg_print() returns a printable version of a string in allocated
memory. For example:
char *p;
p = msg_print(sp, file_name);
msgq(sp, M_ERR, M("003", "File: %s"), p);
FREE_SPACE(sp, p, 0);
makes sure that "file_name" is printable before calling the msgq
routine.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The message catalogs themselves are maintained in two files. The first
is the "base file" which contains two fields, a record number and the
message itself. All base files are named using the convention
"vi_<language>.base", e.g. the English one is "vi_english.base". For
example:
002 "Unable to create temporary file"
003 "Warning: %s is not a regular file"
004 "%s already locked, session is read-only"
005 "%s: remove"
006 "%s: close"
007 "%s: remove"
008 "%s: remove"
009 "Read-only file, not written; use ! to override"
010 "Read-only file, not written"
are the first few lines of the current vi_english.base file. Note that
message #1 is missing -- the first message of each catalog is a special
one, so that nvi can recognize message catalog files. It's added by the
Makefile script that creates the second version of the message catalog.
The second file is the file used by nvi to access messages, and is a list
of the messages, one per line:
VI_MESSAGE_CATALOG
Unable to create temporary fileX
Warning: %s is not a regular fileX
%s already locked, session is read-onlyX
%s: removeX
%s: closeX
%s: removeX
%s: removeX
Read-only file, not written; use ! to overrideX
Read-only file, not writtenX
Note that all messages have had a trailing 'X' character appended. This
is to provide nvi a place to store a trailing nul for the message so that
C library routines that expect one won't be disappointed.
These files are named for their language, e.g. "vi_english". The second
files are automatically created from the first files.
To create a new catalog for nvi:
Copy the file vi_english.base to a file that you can modify , e.g. "cp
vi_english.base vi_german.base". For each of the messages in the file,
replace the message with the string that you want to use. To find out
what the arguments to a message are, I'm afraid you'll have to search
the source code for the message number. You can find them fairly quickly
by doing:
cd ..; egrep '123\|' */*.[chys]
I'm sorry that there's not an easier way, but I couldn't think of
anything that wasn't a lot of work.
If, for some reason, you don't have the file vi_english.base, or you
have new sources for which you want to create a new base catalog, you
can create it by running the command "make english" in the catalog
directory.
Once you've translated all of the strings, then add your catalog to the
"CAT=" line of the Makefile, and run the command "make catalog". This
will create the second (and corresponding) file for each file named
<language>.base.
Don't worry about missing line numbers, i.e. base files that look like:
005 Message number 5.
007 Message number 7.
This simply means that a message was deleted during the course of nvi's
development. It will be taken care of automatically when you create
the second form of the file.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
If you add new messages to the nvi sources, you can check your work by
doing "make english; make check". The "make check" target lists unused
message numbers, duplicate message numbers, and duplicate messages.
Unused message numbers are only useful if you are condensing messages.
Duplicate message numbers are a serious problem and have to be fixed.
Duplicate messages are only interesting if a message appears often enough
that it's worth creating a routine so that the string is only need in
a single place.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
To select a catalog when running nvi, set the "msgcat" option. If the
value of this option ends with a '/', it is treated as the name of a
directory that contains a message catalog "vi_XXXX", where XXXX is the
value of the LANG environmental variable, if it's set, or the value of