Add build glue and docs
This commit is contained in:
parent
8d01a27e2b
commit
4391d5e9d4
|
@ -0,0 +1,17 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
|
||||
.include "Makefile.inc"
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.if ${MKSHARE} != "no"
|
||||
SUBDIR+= catalog
|
||||
.endif
|
||||
|
||||
SUBDIR+= usr.bin
|
||||
|
||||
.if ${MKDOC} != "no"
|
||||
SUBDIR+= docs
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,10 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
DIST= ${NETBSDSRCDIR}/external/bsd/nvi/dist
|
||||
.PATH: ${DIST}
|
||||
BINDIR=/usr/bin
|
||||
|
||||
CWARNFLAGS.clang+= -Wno-error=unused-const-variable
|
||||
VERSION=1.81.6-2013-11-20
|
|
@ -0,0 +1,103 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.29 (Berkeley) 10/19/96
|
||||
|
||||
NOMAN= # defined
|
||||
|
||||
.include "../Makefile.inc"
|
||||
|
||||
.PATH: ${DIST}/catalog
|
||||
|
||||
CATALOG= dutch english french german ru_RU.KOI8-R ru_SU.KOI8-R \
|
||||
spanish swedish
|
||||
|
||||
VI_FILES= ${DIST}/cl/*.c ${DIST}/common/*.c \
|
||||
${DIST}/ex/*.c ${DIST}/vi/*.c
|
||||
FILES= ${CATALOG}
|
||||
FILESDIR= /usr/share/nvi/catalog
|
||||
|
||||
HOSTPROG= dump
|
||||
SRCS= dump.c
|
||||
|
||||
CLEANFILES+= ${CATALOG} english.base *.check __ck1 __ck2
|
||||
|
||||
realall: ${CATALOG}
|
||||
|
||||
${CATALOG}: ${CATALOG:S/$/.base/}
|
||||
@echo "... $@"; \
|
||||
rm -f $@; \
|
||||
if test -f $@.base; then \
|
||||
f=$@.base; \
|
||||
else \
|
||||
f=${DIST}/catalog/$@.base; \
|
||||
fi; \
|
||||
sort -u $$f | \
|
||||
${TOOL_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; \
|
||||
}' | \
|
||||
${TOOL_SED} -e '1s/^/VI_MESSAGE_CATALOG/' \
|
||||
-e '/"/s/^[^"]*"//' \
|
||||
-e '1!s/"$$/X/' > $@; \
|
||||
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_RU.KOI8-R.check spanish.check swedish.check
|
||||
check: ${CHK}
|
||||
${CHK}: ${CATALOG}
|
||||
@echo "... $@"; \
|
||||
f=${DIST}/catalog/`basename $@ .check`; \
|
||||
(echo "Unused message id's (this is okay):"; \
|
||||
${TOOL_AWK} '{ \
|
||||
while (++nline < $$1) \
|
||||
printf "%03d\n", nline; \
|
||||
}' < ${DIST}/catalog/$$f.base; \
|
||||
echo =========================; \
|
||||
echo "MISSING ERROR MESSAGES (Please add!):"; \
|
||||
${TOOL_AWK} '{print $$1}' < $$f.base | sort -u > __ck1; \
|
||||
${TOOL_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 \
|
||||
`${TOOL_SED} '/^$$/d' < $$f.base | sort -u | \
|
||||
${TOOL_AWK} '{print $$1}' | uniq -d`; do \
|
||||
egrep $$j $$f.base; \
|
||||
done; \
|
||||
echo =========================; \
|
||||
echo "Duplicate messages, both id and message (this is okay):"; \
|
||||
${TOOL_SED} '/^$$/d' < $$f.base | sort | uniq -c | \
|
||||
${TOOL_AWK} '$$1 != 1 { print $$0 }' | sort -n; \
|
||||
echo =========================; \
|
||||
echo "Duplicate messages, just message (this is okay):"; \
|
||||
${TOOL_SED} '/^$$/d' < $$f | sort | uniq -c | \
|
||||
${TOOL_AWK} '$$1 != 1 { print $$0 }' | sort -n; \
|
||||
echo =========================) > $@
|
||||
|
||||
english.base: dump ${VI_FILES} #Makefile
|
||||
${_MKTARGET_CREATE}
|
||||
./dump ${VI_FILES} |\
|
||||
${TOOL_SED} -e '/|/!d' \
|
||||
-e 's/|/ "/' \
|
||||
-e 's/^"//' \
|
||||
-e 's/\\"/"/g' |\
|
||||
sort -n > $@
|
||||
|
||||
.include <bsd.hostprog.mk>
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
|
||||
SUBDIR= USD.doc info
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
|
||||
SUBDIR= edit exref vi.ref vitut
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,24 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/8/93
|
||||
|
||||
.include "../../../Makefile.inc"
|
||||
.PATH: ${DIST}/docs/edit
|
||||
DIR= usd/11.edit
|
||||
SRCS= edittut.ms
|
||||
MACROS= -ms
|
||||
|
||||
all: paper.ps
|
||||
|
||||
paper.ps: ${SRCS}
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > ${.TARGET}
|
||||
|
||||
# index for versatec is different from the one in edit.tut
|
||||
# because the fonts are different and entries reference page
|
||||
# rather than section numbers. if you have a typesetter
|
||||
# you should just use the index in edit.tut, and ignore editvindex.
|
||||
|
||||
editvindex:
|
||||
${TOOL_ROFF_RAW} ${MACROS} -n22 edit.vindex
|
||||
|
||||
.include <bsd.doc.mk>
|
|
@ -0,0 +1,113 @@
|
|||
.\" $NetBSD: edit.vindex,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1993
|
||||
.\" The Regents of the University of California. 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.
|
||||
.\"
|
||||
.\" @(#)edit.vindex 8.1 (Berkeley) 6/8/93
|
||||
.\"
|
||||
.bd I
|
||||
.ND
|
||||
.TL
|
||||
Index
|
||||
.sp 3
|
||||
.2C
|
||||
.nf
|
||||
addressing, \fIsee\fR line numbers
|
||||
append mode, 4
|
||||
backslash (\\), 18
|
||||
buffer, 2
|
||||
command mode, 4
|
||||
context search, 8, 10, 13, 18
|
||||
control characters (``^'' notation), 8
|
||||
control-d, 6
|
||||
current filename, 19, 20
|
||||
current line (.), 9, 15
|
||||
diagnostic messages, 4
|
||||
disk, 2
|
||||
documentation, 21
|
||||
edit (to begin editing session), 3, 7
|
||||
editing commands:
|
||||
.in +2
|
||||
append (a), 4, 7
|
||||
change (c), 16
|
||||
copy (co), 13
|
||||
delete (d), 13-14
|
||||
edit (e), 12
|
||||
file (f), 19
|
||||
global (g), 18-19
|
||||
move (m), 12-13
|
||||
number (nu), 9
|
||||
preserve (pre), 20-21
|
||||
print (p), 8
|
||||
quit (q), 5, 11
|
||||
quit! (q!), 11
|
||||
read (r), 20
|
||||
recover (rec), 20
|
||||
substitute (s), 9-10, 17, 18
|
||||
undo (u), 14, 17
|
||||
write (w), 5-6, 11, 19-20
|
||||
z, 11
|
||||
.sp 10i
|
||||
! (shell escape), 19
|
||||
$= , 15
|
||||
+, 15
|
||||
\-, 15
|
||||
//, 8, 18
|
||||
??, 18
|
||||
\&\fB.\fR, 9, 15
|
||||
\&\fB.\fR=, 9, 15
|
||||
.in -2
|
||||
erasing
|
||||
.ti +2
|
||||
characters (#), 8
|
||||
.ti +2
|
||||
lines (@), 8
|
||||
ex (text editor), 21
|
||||
\fIEx Reference Manual\fR, 21
|
||||
file, 1
|
||||
file recovery, 20
|
||||
filename, 2
|
||||
Interrupt (message), 7
|
||||
line numbers, \fIsee also\fR current line
|
||||
.ti +2
|
||||
dollar sign ($), 8, 12-13, 15
|
||||
.ti +2
|
||||
dot (.), 9, 15
|
||||
.ti +2
|
||||
relative (+ and \-), 15, 16
|
||||
logging out, 6
|
||||
login procedure, 2
|
||||
``magic'' characters, 21
|
||||
non-printing characters, 8
|
||||
``not found'' (message), 3
|
||||
program, 1
|
||||
recovery \fIsee\fR file recovery
|
||||
shell, 18
|
||||
shell escape (!), 19
|
||||
special characters (^, $, \e), 18
|
||||
text input mode, 4
|
||||
UNIX, 1
|
|
@ -0,0 +1,21 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.8 (Berkeley) 10/10/96
|
||||
|
||||
.include "../../../Makefile.inc"
|
||||
.PATH: ${DIST}/docs/exref
|
||||
|
||||
DIR= usd/12.ex
|
||||
SRCS= ex.rm ex.summary
|
||||
MACROS= -ms
|
||||
CLEANFILES= summary.ps
|
||||
|
||||
all: paper.ps summary.ps
|
||||
|
||||
paper.ps: ex.rm
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > ${.TARGET}
|
||||
|
||||
summary.ps: ex.summary
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > ${.TARGET}
|
||||
|
||||
.include <bsd.doc.mk>
|
|
@ -0,0 +1,35 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.20 (Berkeley) 8/18/96
|
||||
|
||||
DIR= usd/13.viref
|
||||
SRCS= vi.ref ex.cmd.roff set.opt.roff vi.cmd.roff ref.so
|
||||
MACROS= -me
|
||||
CLEANFILES+= vi.ref.txt vi.ref.ps index index.so
|
||||
|
||||
all: vi.ref.txt vi.ref.ps
|
||||
|
||||
vi.ref.txt: vi.ref index.so
|
||||
${TOOL_SOELIM} vi.ref | ${TOOL_TBL} | ${TOOL_ROFF_ASCII} ${MACROS} > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
vi.ref.ps: vi.ref index.so
|
||||
${TOOL_SOELIM} vi.ref | ${TOOL_TBL} | ${TOOL_ROFF_PS} ${MACROS} > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
index.so: vi.ref
|
||||
# Build index.so, side-effect of building the paper.
|
||||
${TOOL_SOELIM} vi.ref | ${TOOL_TBL} | \
|
||||
${TOOL_ROFF_PS} ${MACROS} > /dev/null
|
||||
sed -e 's/MINUSSIGN/\\-/' \
|
||||
-e 's/DOUBLEQUOTE/""/' \
|
||||
-e "s/SQUOTE/'/" \
|
||||
-e 's/ /__SPACE/g' < index | \
|
||||
sort -u '-t ' +0 -1 +1n | awk -f merge.awk | \
|
||||
sed -e 's/__SPACE/ /g' > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
.include <bsd.doc.mk>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,18 @@
|
|||
# $NetBSD: merge.awk,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
#
|
||||
# @(#)merge.awk 8.3 (Berkeley) 5/25/94
|
||||
#
|
||||
# merge index entries into one line per label
|
||||
$1 == prev {
|
||||
printf ", %s", $2;
|
||||
next;
|
||||
}
|
||||
{
|
||||
if (NR != 1)
|
||||
printf "\n";
|
||||
printf "%s \t%s", $1, $2;
|
||||
prev = $1;
|
||||
}
|
||||
END {
|
||||
printf "\n"
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
.\" $NetBSD: ref.so,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\" Copyright (c) 1994, 1995, 1996
|
||||
.\" Keith Bostic. All rights reserved.
|
||||
.\"
|
||||
.\" See the LICENSE file for redistribution information.
|
||||
.\"
|
||||
.\" @(#)ref.so 8.9 (Berkeley) 8/17/96
|
||||
.\"
|
||||
.\"
|
||||
.\" indented paragraph, with spaces between the items, bold font
|
||||
.de IP
|
||||
.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3
|
||||
.sp 1
|
||||
.nr PS \\n(ps
|
||||
.nr ps 0
|
||||
.ip "\fB\\$1\fP" \\$2
|
||||
.nr ps \\n(PS
|
||||
.br
|
||||
..
|
||||
.\" indented paragraph, no spaces between the items, bold font
|
||||
.de Ip
|
||||
.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3
|
||||
.nr PS \\n(ps
|
||||
.nr ps 0
|
||||
.ns
|
||||
.ip "\fB\\$1\fP" \\$2
|
||||
.nr ps \\n(PS
|
||||
.br
|
||||
..
|
||||
.\" start nested .IP
|
||||
.de SS
|
||||
.sp
|
||||
.ba +5n
|
||||
..
|
||||
.\" end nested .IP
|
||||
.de SE
|
||||
.ba -5n
|
||||
..
|
||||
.\" nested .IP, no spaces, normal font
|
||||
.de SP
|
||||
.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3
|
||||
.nr PS \\n(ps
|
||||
.nr ps 0
|
||||
.ns
|
||||
.ip "\\$1" 9n
|
||||
.nr ps \\n(PS
|
||||
..
|
||||
.\" typewriter font
|
||||
.de LI
|
||||
\&\fC\\$1\fP\\$2
|
||||
..
|
||||
.\" ex/vi names in command font
|
||||
.de EV
|
||||
\&\fB\\$1\fP/\fB\\$2\fP\\$3
|
||||
..
|
||||
.\" command names
|
||||
.de CO
|
||||
\&\fB\\$1\fP\\$2
|
||||
..
|
||||
.\" key words for index
|
||||
.de KY
|
||||
.sy echo >>index '\\$1 \\n%'
|
||||
..
|
||||
.\" option names
|
||||
.de OP
|
||||
\&\fB\\$1\fP\\$2
|
||||
..
|
||||
.\" paren quoted (typewriter font)
|
||||
.de PQ
|
||||
(\*(lq\fC\\$1\fP\*(rq)\\$2
|
||||
..
|
||||
.\" quoted bold
|
||||
.de QB
|
||||
\*(lq\fB\\$1\fP\*(rq\\$2
|
||||
..
|
||||
.\" quoted command
|
||||
.de QC
|
||||
\*(lq\fB\\$1\fP\*(rq\\$2
|
||||
..
|
||||
.\" quoted option
|
||||
.de QO
|
||||
\*(lq\fB\\$1\fP\*(rq\\$2
|
||||
..
|
||||
.\" quoted (no font change)
|
||||
.de QQ
|
||||
\*(lq\\$1\*(rq\\$2
|
||||
..
|
||||
.\" quoted (typewriter font)
|
||||
.de QT
|
||||
\*(lq\fC\\$1\fP\*(rq\\$2
|
||||
..
|
||||
.\" section macro to build TOC
|
||||
.de SH
|
||||
.(x
|
||||
\\$2
|
||||
.)x
|
||||
.sh \\$1 "\\$2"
|
||||
..
|
||||
.\" manual section
|
||||
.de XR
|
||||
\&\fI\\$1\fP(\\$2)\\$3
|
||||
..
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
#
|
||||
# @(#)Makefile 8.7 (Berkeley) 8/18/96
|
||||
|
||||
.include "../../../Makefile.inc"
|
||||
.PATH: ${DIST}/docs/vitut
|
||||
DIR= usd/12.vi
|
||||
SRCS= vi.in vi.chars
|
||||
MACROS= -ms
|
||||
CLEANFILES+= vitut.ps summary.ps viapwh.ps
|
||||
|
||||
all: vitut.ps summary.ps viapwh.ps
|
||||
|
||||
vitut.ps: ${SRCS}
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
summary.ps: vi.summary
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
viapwh.ps: vi.apwh.ms
|
||||
${TOOL_TBL} ${.ALLSRC} | ${TOOL_ROFF_PS} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
.include <bsd.doc.mk>
|
|
@ -0,0 +1,55 @@
|
|||
# @(#)ev 8.4 (Berkeley) 4/29/94
|
||||
|
||||
Ev: Vi: Result:
|
||||
<CK> <CK> (Cursor keys). Move around the file.
|
||||
|
||||
Meta key commands:
|
||||
^A<#> <#>G Goto line #.
|
||||
^A$ G Goto the end of the file.
|
||||
^A/ / Prompt and execute a forward search.
|
||||
^A: : Prompt and execute an ex command.
|
||||
^A? ? Prompt and execute a backward search.
|
||||
^Ac y'<c> Copy to mark in line mode (or copy the current line).
|
||||
^AC y`<c> Copy to mark in character mode.
|
||||
^Ad d'<c> Delete to mark in line mode (or delete the current line).
|
||||
^AD d`<c> Delete to mark in character mode.
|
||||
^Aj J Join lines.
|
||||
^Am m<c> Mark the current cursor position.
|
||||
^AN N Repeat search in the reverse direction.
|
||||
^An ^A Search for the word under the cursor.
|
||||
^Ar u Redo a command.
|
||||
^Au u Undo a command.
|
||||
|
||||
Single key commands:
|
||||
^B ^B Page up a screen.
|
||||
^C ^C Interrupt long-running commands.
|
||||
^D ^D Page down a half-screen.
|
||||
^E $ End of line.
|
||||
^F ^F Page down a screen.
|
||||
^G ^G File status/information.
|
||||
^H X Delete the character to the left of the cursor.
|
||||
^I (TAB)
|
||||
^J j Cursor down one line.
|
||||
^K k Cursor up one line.
|
||||
^L ^L Redraw the screen.
|
||||
^M (CR) ^M In insert mode, split the line at the current cursor,
|
||||
creating a new line.
|
||||
In overwrite mode, cursor down one line.
|
||||
^N n Repeat previous search, in previous direction.
|
||||
^O (UNUSED)
|
||||
^P p Paste the cut text at the cursor position.
|
||||
^Q (XON/XOFF)
|
||||
^R (UNUSED)
|
||||
^S (XON/XOFF)
|
||||
^T D Truncate the line at the cursor position.
|
||||
^U ^U Page up a half-screen.
|
||||
^V<c> ^V<c> Insert/overwrite with a literal next character.
|
||||
^W w Move forward one whitespace separated word.
|
||||
^X x Delete the current character.
|
||||
^Y (UNUSED)
|
||||
^Z ^Z Suspend.
|
||||
|
||||
New ex mode commands:
|
||||
|
||||
^A:set ov[erwrite] Toggle "insert" mode, so that input keys overwrite
|
||||
the existing characters.
|
|
@ -0,0 +1,230 @@
|
|||
MOVING THE CURSOR:
|
||||
k - cursor up ^F - page forward /<pattern><CR> - search forward
|
||||
j - cursor down ^B - page backward ?<pattern><CR> - search backward
|
||||
h - cursor left w - move forward a "word" n - repeat the last search
|
||||
l - cursor right b - move backward a "word"
|
||||
|
||||
ENTERING TEXT:
|
||||
a - append after the cursor. Use the <escape> key to return to
|
||||
i - insert before the cursor. command mode.
|
||||
o - open a new line below the cursor.
|
||||
O - open new line above the cursor.
|
||||
|
||||
WRITING AND EXITING:
|
||||
:w<Enter> - write the file
|
||||
:q<Enter> - exit the file
|
||||
:q!<Enter> - exit without writing the file
|
||||
:#<Enter> - move to a line (e.g., :35<Enter> moves to line 35)
|
||||
|
||||
MISCELLANEOUS:
|
||||
^G - display the file name
|
||||
J - join two lines (use i<Enter><escape> to split a line)
|
||||
u - undo the last change (enter . after a 'u' to undo more than one change)
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
VI COMMANDS:
|
||||
^A search forward for cursor word
|
||||
^B scroll up by screens
|
||||
^C interrupt an operation (e.g. read, write, search)
|
||||
^D scroll down by half screens (setting count)
|
||||
^E scroll down by lines
|
||||
^F scroll down by screens
|
||||
^G file status
|
||||
^H move left by characters
|
||||
^J move down by lines
|
||||
^L redraw screen
|
||||
^M move down by lines (to first non-blank)
|
||||
^N move down by lines
|
||||
^P move up by lines
|
||||
^R redraw screen
|
||||
^T tag pop
|
||||
^U half page up (set count)
|
||||
^V input a literal character
|
||||
^W move to next screen
|
||||
^Y page up by lines
|
||||
^Z suspend editor
|
||||
^[ <escape> exit input mode, cancel partial commands
|
||||
^\ switch to ex mode
|
||||
^] tag push cursor word
|
||||
^^ switch to previous file
|
||||
<space> move right by columns
|
||||
! filter through command(s) to motion
|
||||
# number increment/decrement
|
||||
$ move to last column
|
||||
% move to match
|
||||
& repeat substitution
|
||||
' move to mark (to first non-blank)
|
||||
( move back sentence
|
||||
) move forward sentence
|
||||
+ move down by lines (to first non-blank)
|
||||
, reverse last F, f, T or t search
|
||||
- move up by lines (to first non-blank)
|
||||
. repeat the last command
|
||||
/ search forward
|
||||
0 move to first character
|
||||
: ex command
|
||||
; repeat last F, f, T or t search
|
||||
< shift lines left to motion
|
||||
> shift lines right to motion
|
||||
? search backward
|
||||
@ execute buffer
|
||||
A append to the line
|
||||
B move back bigword
|
||||
C change to end-of-line
|
||||
D delete to end-of-line
|
||||
E move to end of bigword
|
||||
F character in line backward search
|
||||
G move to line
|
||||
H move to count lines from screen top
|
||||
I insert before first nonblank
|
||||
J join lines
|
||||
L move to screen bottom
|
||||
M move to screen middle
|
||||
N reverse last search
|
||||
O insert above line
|
||||
P insert before cursor from buffer
|
||||
Q switch to ex mode
|
||||
R replace characters
|
||||
S substitute for the line(s)
|
||||
T before character in line backward search
|
||||
U Restore the current line
|
||||
W move to next bigword
|
||||
X delete character before cursor
|
||||
Y copy line
|
||||
ZZ save file and exit
|
||||
[[ move back section
|
||||
]] move forward section
|
||||
^ move to first non-blank
|
||||
_ move to first non-blank
|
||||
` move to mark
|
||||
a append after cursor
|
||||
b move back word
|
||||
c change to motion
|
||||
d delete to motion
|
||||
e move to end of word
|
||||
f character in line forward search
|
||||
h move left by columns
|
||||
i insert before cursor
|
||||
j move down by lines
|
||||
k move up by lines
|
||||
l move right by columns
|
||||
m set mark
|
||||
n repeat last search
|
||||
o append after line
|
||||
p insert after cursor from buffer
|
||||
r replace character
|
||||
s substitute character
|
||||
t before character in line forward search
|
||||
u undo last change
|
||||
w move to next word
|
||||
x delete character
|
||||
y copy text to motion into a cut buffer
|
||||
z reposition the screen
|
||||
{ move back paragraph
|
||||
| move to column
|
||||
} move forward paragraph
|
||||
~ reverse case
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
EX COMMANDS:
|
||||
^D: scroll lines
|
||||
!: filter lines through commands or run commands
|
||||
#: display numbered lines
|
||||
&: repeat the last subsitution
|
||||
*: execute a buffer
|
||||
<: shift lines left
|
||||
=: display line number
|
||||
>: shift lines right
|
||||
@: execute a buffer
|
||||
append: append input to a line
|
||||
abbreviate: specify an input abbreviation
|
||||
args: display file argument list
|
||||
bg: background the current screen
|
||||
change: change lines to input
|
||||
cd: change the current directory
|
||||
chdir: change the current directory
|
||||
copy: copy lines elsewhere in the file
|
||||
cscope: create a set of tags using a cscope command
|
||||
delete: delete lines from the file
|
||||
display: display buffers, screens or tags
|
||||
[Ee]dit: begin editing another file
|
||||
[Ee]x: begin editing another file
|
||||
exusage: display ex command usage statement
|
||||
file: display (and optionally set) file name
|
||||
fg: switch the current screen and a backgrounded screen
|
||||
global: execute a global command on lines matching an RE
|
||||
help: display help statement
|
||||
insert: insert input before a line
|
||||
join: join lines into a single line
|
||||
k: mark a line position
|
||||
list: display lines in an unambiguous form
|
||||
move: move lines elsewhere in the file
|
||||
mark: mark a line position
|
||||
map: map input or commands to one or more keys
|
||||
mkexrc: write a .exrc file
|
||||
[Nn]ext: edit (and optionally specify) the next file
|
||||
number: change display to number lines
|
||||
open: enter "open" mode (not implemented)
|
||||
print: display lines
|
||||
perl: run the perl interpreter with the command
|
||||
perldo: run the perl interpreter with the command, on each line
|
||||
preserve: preserve an edit session for recovery
|
||||
[Pp]revious: edit the previous file in the file argument list
|
||||
put: append a cut buffer to the line
|
||||
quit: exit ex/vi
|
||||
read: append input from a command or file to the line
|
||||
recover: recover a saved file
|
||||
resize: grow or shrink the current screen
|
||||
rewind: re-edit all the files in the file argument list
|
||||
s: substitute on lines matching an RE
|
||||
script: run a shell in a screen
|
||||
set: set options (use ":set all" to see all options)
|
||||
shell: suspend editing and run a shell
|
||||
source: read a file of ex commands
|
||||
stop: suspend the edit session
|
||||
suspend: suspend the edit session
|
||||
t: copy lines elsewhere in the file
|
||||
[Tt]ag: edit the file containing the tag
|
||||
tagnext: move to the next tag
|
||||
tagpop: return to the previous group of tags
|
||||
tagprev: move to the previous tag
|
||||
tagtop: discard all tags
|
||||
tcl: run the tcl interpreter with the command
|
||||
undo: undo the most recent change
|
||||
unabbreviate: delete an abbreviation
|
||||
unmap: delete an input or command map
|
||||
v: execute a global command on lines NOT matching an RE
|
||||
version: display the program version information
|
||||
visual: enter visual (vi) mode from ex mode
|
||||
[Vv]isual: edit another file (from vi mode only)
|
||||
viusage: display vi key usage statement
|
||||
write: write the file
|
||||
wn: write the file and switch to the next file
|
||||
wq: write the file and exit
|
||||
xit: exit
|
||||
yank: copy lines to a cut buffer
|
||||
z: display different screens of the file
|
||||
~: replace previous RE with previous replacement string,
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Edit options:
|
||||
noaltwerase filec="" nomodeline scroll=17 notildeop
|
||||
autoindent flash msgcat="./" nosearchincr timeout
|
||||
autoprint hardtabs=0 noprint="" nosecure nottywerase
|
||||
noautowrite noiclower nonumber shiftwidth=8 noverbose
|
||||
backup="" noignorecase nooctal noshowmatch warn
|
||||
nobeautify keytime=6 open noshowmode window=35
|
||||
cedit="" noleftright optimize sidescroll=16 nowindowname
|
||||
columns=80 lines=36 print="" noslowopen wraplen=0
|
||||
comment nolisp prompt nosourceany wrapmargin=0
|
||||
noedcompatible nolist readonly tabstop=8 wrapscan
|
||||
escapetime=1 lock noredraw taglength=0 nowriteany
|
||||
noerrorbells magic remap tags="tags"
|
||||
exrc matchtime=7 report=5 term="xterm"
|
||||
noextended mesg ruler noterse
|
||||
cdpath="/usr/src/local/nvi:/tmp"
|
||||
directory="/tmp"
|
||||
matchchars="[]{}()<>"
|
||||
paragraphs="IPLPPPQPP LIpplpipbp"
|
||||
recdir="/var/tmp/vi.recover"
|
||||
sections="NHSHH HUnhsh"
|
||||
shell="/bin/csh"
|
||||
shellmeta="~{[*?$`'"\"
|
|
@ -0,0 +1,12 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
|
||||
.include "${.CURDIR}/../../Makefile.inc"
|
||||
|
||||
.PATH: ${DIST}/docs/vi.ref
|
||||
|
||||
TEXINFO= vi.texi
|
||||
INFOFLAGS= -I${DIST}/doc
|
||||
|
||||
vi.info: ref.texi vi.cmd.texi ex.cmd.texi set.opt.texi
|
||||
|
||||
.include <bsd.info.mk>
|
|
@ -0,0 +1,88 @@
|
|||
# @(#)autowrite 8.3 (Berkeley) 2/17/95
|
||||
|
||||
Vi autowrite behavior, the fields with *'s are "don't cares".
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Commands that are affected only by autowrite:
|
||||
|
||||
Command File Autowrite? Action:
|
||||
modified?
|
||||
-----------------------------------------------
|
||||
^Z Y Y Write file and suspend.
|
||||
^Z Y N Suspend.
|
||||
^Z N * Suspend.
|
||||
|
||||
# This behavior is NOT identical to :edit.
|
||||
^^ Y Y Write file and jump.
|
||||
^^ Y N Error.
|
||||
^^ N * Jump.
|
||||
|
||||
# The new nvi command ^T (:tagpop) behaves identically to ^].
|
||||
# This behavior is identical to :tag, :tagpop, and :tagpush with
|
||||
# force always set to N.
|
||||
^] Y Y Write file and jump.
|
||||
^] Y N Error.
|
||||
^] N * Jump.
|
||||
|
||||
# There's no way to specify a force flag to the '!' command.
|
||||
:! Y Y Write file and execute.
|
||||
:! Y N Warn (if warn option) and execute.
|
||||
:! N * Execute.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Commands that are affected by both autowrite and force:
|
||||
|
||||
NOTE: the "force" flag is never passed on, i.e. the write
|
||||
to the file caused by the autowrite flag is never forced.
|
||||
|
||||
Command File Autowrite? Force? Action:
|
||||
modified? (!)
|
||||
-------------------------------------------------------
|
||||
# The first rule (YYY) is historic practice, but seems wrong.
|
||||
# In nvi, :next and :prev commands behave identically to :rewind.
|
||||
:next Y Y Y Write changes and jump.
|
||||
:next Y Y N Write changes and jump.
|
||||
:next Y N Y Abandon changes and jump.
|
||||
:next Y N N Error.
|
||||
:next N * * Jump.
|
||||
|
||||
:rewind Y Y Y Abandon changes and jump.
|
||||
:rewind Y Y N Write changes and jump.
|
||||
:rewind Y N Y Abandon changes and jump.
|
||||
:rewind Y N N Error.
|
||||
:rewind N * * Jump.
|
||||
|
||||
# The new nvi commands, :tagpop and :tagtop, behave identically to :tag.
|
||||
# Note, this behavior is the same as :rewind and friends, as well.
|
||||
:tag Y Y Y Abandon changes and jump.
|
||||
:tag Y Y N Write changes and jump.
|
||||
:tag Y N Y Abandon changes and jump.
|
||||
:tag Y N N Error.
|
||||
:tag N * * Jump.
|
||||
|
||||
# The command :suspend behaves identically to :stop.
|
||||
:stop Y Y Y Suspend.
|
||||
:stop Y Y N Write changes and suspend.
|
||||
:stop Y N Y Suspend.
|
||||
:stop Y N N Suspend.
|
||||
:stop N * * Suspend.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Commands that might be affected by autowrite, but aren't:
|
||||
|
||||
Command File Autowrite? Force? Action:
|
||||
modified? (!)
|
||||
-------------------------------------------------------
|
||||
#:ex, and :vi (executed while in vi mode) behave identically to :edit.
|
||||
:edit Y * Y Abandon changes and jump.
|
||||
:edit Y * N Error.
|
||||
:edit N * * Jump.
|
||||
|
||||
:quit Y * Y Quit.
|
||||
:quit Y * N Error.
|
||||
:quit N * * Quit.
|
||||
|
||||
:shell * * * Execute shell.
|
||||
|
||||
:xit Y * * Write changes and exit.
|
||||
:xit N * * Exit.
|
|
@ -0,0 +1,32 @@
|
|||
# @(#)context 8.6 (Berkeley) 10/14/94
|
||||
|
||||
In historic vi, the previous context mark was always set:
|
||||
|
||||
ex address:
|
||||
any number, <question-mark>, <slash>, <dollar-sign>,
|
||||
<single-quote>, <backslash>
|
||||
|
||||
ex commands: undo, "z.", global, v
|
||||
|
||||
vi commands: (, ), {, }, %, [[, ]], ^]
|
||||
|
||||
nvi adds the vi command ^T to this list.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set if the
|
||||
line changed:
|
||||
|
||||
vi commands: '<mark>, G, H, L, M, z
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set if the
|
||||
line or column changed:
|
||||
|
||||
vi commands: `<mark>, /, ?, N, n
|
||||
|
||||
nvi adds the vi command ^A to this list.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set in non-visual
|
||||
mode for ^R and ^L if the line changed, but I have yet to figure
|
||||
out how the line could change.
|
|
@ -0,0 +1,142 @@
|
|||
Cscope Notes:
|
||||
|
||||
The nvi tags structure has been reworked to handle the notion of multiple
|
||||
locations per tag. This supports cscope, which returns multiple locations
|
||||
per query. It will hopefully support ctags programs that create databases
|
||||
with multiple locations per tag as well.
|
||||
|
||||
There is now a list of "tag queues" chained from each screen. Each tag
|
||||
queue has one or more "tag locations".
|
||||
|
||||
+----+ +----+ +----+ +----+
|
||||
| EP | -> | Q1 | <-- | T1 | <-- | T2 |
|
||||
+----+ +----+ --> +----+ --> +----+
|
||||
|
|
||||
+----+ +----+
|
||||
| Q2 | <-- | T1 |
|
||||
+----+ --> +----+
|
||||
|
|
||||
+----+ +----+
|
||||
| Q3 | <-- | T1 |
|
||||
+----+ --> +----+
|
||||
|
||||
In the above diagram, each "Q" is a "tag queue", and each "T" is a
|
||||
tag location. Generally, the commands:
|
||||
|
||||
:tag create a new Q
|
||||
^[ create a new Q
|
||||
:cscope find create a new Q
|
||||
:tagnext move to the next T
|
||||
:tagprev move to the previous T
|
||||
:tagpop discard one or more Q's
|
||||
^T discard the most recent Q
|
||||
:tagtop discard all Q's
|
||||
|
||||
More specifically:
|
||||
|
||||
:cs[cope] a[dd] cscope-dir
|
||||
|
||||
Attach to the cscope database in cscope-dir.
|
||||
|
||||
:cs[cope] f[ind] c|d|e|f|g|i|s|t buffer|pattern
|
||||
|
||||
Query all attached cscopes for the pattern. The pattern is a
|
||||
regular expression. If the pattern is a double-quote character
|
||||
followed by a valid buffer name (e.g., "t), then the contents
|
||||
of the named buffer are used as the pattern.
|
||||
|
||||
c: find callers of name
|
||||
d: find all function calls made from name
|
||||
e: find pattern
|
||||
f: find files with name as substring
|
||||
g: find definition of name
|
||||
i: find files #including name
|
||||
s: find all uses of name
|
||||
t: find assignments to name
|
||||
|
||||
The find command pushes the current location onto the tags stack,
|
||||
and switches to the first location resulting from the query, if
|
||||
the query returned at least one result.
|
||||
|
||||
:cs[cope] h[elp] [command]
|
||||
|
||||
List the cscope commands, or usage help on one command.
|
||||
|
||||
:display c[onnections]
|
||||
|
||||
Display the list of cscope connections
|
||||
|
||||
:display t[ags]
|
||||
|
||||
The tags display has been enhanced to display multiple tag
|
||||
locations per tag query.
|
||||
|
||||
:cs[cope] k[ill] #
|
||||
|
||||
Kill cscope connection number #.
|
||||
|
||||
:cs[cope] r[eset]
|
||||
Kill all attached cscopes. Useful if one got hung but you don't
|
||||
know which one.
|
||||
|
||||
:tagn[ext][!]
|
||||
|
||||
Move to the next tag resulting from a query.
|
||||
|
||||
:tagpr[ev][!]
|
||||
|
||||
Return to the previous tag resulting from a query.
|
||||
|
||||
:tagp[op], ^T
|
||||
|
||||
Return to the previous tag group (no change).
|
||||
|
||||
:tagt[op]
|
||||
|
||||
Discard all tag groups (no change).
|
||||
|
||||
Suggested maps:
|
||||
|
||||
" ^N: move to the next tag
|
||||
map ^N :tagnext^M
|
||||
" ^P: move to the previous tag
|
||||
map ^P :tagprev^M
|
||||
|
||||
" Tab+letter performs a C-Scope query on the current word.
|
||||
" C-Scope 12.9 has a text-string query (type t).
|
||||
" C-Scope 13.3 replaces it with an assignment query; hence a==t.
|
||||
map <tab>a "tye:csc find t"t
|
||||
map <tab>c "tye:csc find c"t
|
||||
map <tab>d "tye:csc find d"t
|
||||
map <tab>e "tye:csc find e"t
|
||||
map <tab>f "tye:csc find f"t
|
||||
map <tab>g "tye:csc find g"t
|
||||
map <tab>i "tye:csc find i"t
|
||||
map <tab>s "tye:csc find s"t
|
||||
map <tab>t "tye:csc find t"t
|
||||
|
||||
To start nvi with an initial set of cscope directories, use the environment
|
||||
variable CSCOPE_DIRS. This variable should contain a <blank>-separated
|
||||
list of directories containing cscope databases. (This MAY be changed to
|
||||
be an edit option, I haven't really decided, yet.)
|
||||
|
||||
Each cscope directory must contain a file named "cscope.out" which is the
|
||||
main cscope database, or nvi will not attempt to connect to a cscope to
|
||||
handle requests for that database.
|
||||
|
||||
The file "cscope.tpath" may contain a colon-separated directory search
|
||||
path which will be used to find the files reported by cscope. If this
|
||||
cscope.tpath does not exist, then the paths are assumed to be relative to
|
||||
the cscope directory itself. This is an extension to the standard cscope,
|
||||
but seems important enough to keep.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Cscope Availability:
|
||||
|
||||
UNIXWare System V Release 4.0 variants such as Sun Solaris 2.x
|
||||
(/opt/SUNWspro/bin) have version 11.5, and UNIXWare System V
|
||||
Release 4.1 has version 12.10 with an option for much faster
|
||||
searching.
|
||||
|
||||
You can buy version 13.3 source with an unrestricted license
|
||||
for $400 from AT&T Software Solutions by calling +1-800-462-8146.
|
|
@ -0,0 +1,76 @@
|
|||
# @(#)gdb.script 8.5 (Berkeley) 5/4/96
|
||||
|
||||
# display the VI screen map
|
||||
# usage dmap(sp)
|
||||
define dmap
|
||||
set $h = ((VI_PRIVATE *)$arg0->vi_private)->h_smap
|
||||
set $t = ((VI_PRIVATE *)$arg0->vi_private)->t_smap
|
||||
while ($h <= $t)
|
||||
printf "lno: %2d; soff %d coff %d ", \
|
||||
(int)$h->lno, (int)$h->soff, (int)$h->coff
|
||||
if ($h->c_ecsize == 0)
|
||||
printf "flushed\n"
|
||||
else
|
||||
printf "\n\tsboff %d; scoff %d\n", \
|
||||
(int)$h->c_sboff, (int)$h->c_scoff
|
||||
printf "\teboff %d; eclen %d; ecsize %d\n", \
|
||||
(int)$h->c_eboff, (int)$h->c_eclen, \
|
||||
(int)$h->c_ecsize
|
||||
end
|
||||
set $h = $h + 1
|
||||
end
|
||||
end
|
||||
|
||||
# display the tail of the VI screen map
|
||||
define tmap
|
||||
set $h = ((VI_PRIVATE *)$arg0->vi_private)->h_smap
|
||||
set $t = ((VI_PRIVATE *)$arg0->vi_private)->t_smap
|
||||
while ($t >= $h)
|
||||
printf "lno: %2d; soff %d coff %d ", \
|
||||
(int)$t->lno, (int)$t->soff, (int)$t->coff
|
||||
if ($t->c_ecsize == 0)
|
||||
printf "flushed\n"
|
||||
else
|
||||
printf "\n\tsboff %d; scoff %d\n", \
|
||||
(int)$t->c_sboff, (int)$t->c_scoff
|
||||
printf "\teboff %d; eclen %d; ecsize %d\n", \
|
||||
(int)$t->c_eboff, (int)$t->c_eclen, \
|
||||
(int)$t->c_ecsize
|
||||
end
|
||||
set $t = $t - 1
|
||||
end
|
||||
end
|
||||
|
||||
# display the private structures
|
||||
define clp
|
||||
print *((CL_PRIVATE *)sp->gp->cl_private)
|
||||
end
|
||||
define vip
|
||||
print *((VI_PRIVATE *)sp->vi_private)
|
||||
end
|
||||
define exp
|
||||
print *((EX_PRIVATE *)sp->ex_private)
|
||||
end
|
||||
|
||||
# display the marks
|
||||
define markp
|
||||
set $h = sp->ep->marks.next
|
||||
set $t = &sp->ep->marks
|
||||
while ($h != 0 && $h != $t)
|
||||
printf "key %c lno: %d cno: %d flags: %x\n", \
|
||||
((MARK *)$h)->name, ((MARK *)$h)->lno, \
|
||||
((MARK *)$h)->cno, ((MARK *)$h)->flags
|
||||
set $h = ((MARK *)$h)->next
|
||||
end
|
||||
end
|
||||
|
||||
# display the tags
|
||||
define tagp
|
||||
set $h = sp->taghdr.next
|
||||
set $t = &sp->taghdr
|
||||
while ($h != 0 && $h != $t)
|
||||
printf "tag: %s lno %d cno %d\n", ((TAG *)$h)->frp->fname, \
|
||||
((TAG *)$h)->lno, ((TAG *)$h)->cno
|
||||
set $h= ((TAG *)$h)->next
|
||||
end
|
||||
end
|
|
@ -0,0 +1,350 @@
|
|||
# @(#)input 5.5 (Berkeley) 7/2/94
|
||||
|
||||
MAPS, EXECUTABLE BUFFERS AND INPUT IN EX/VI:
|
||||
|
||||
The basic rule is that input in ex/vi is a stack. Every time a key which
|
||||
gets expanded is encountered, it is expanded and the expansion is treated
|
||||
as if it were input from the user. So, maps and executable buffers are
|
||||
simply pushed onto the stack from which keys are returned. The exception
|
||||
is that if the "remap" option is turned off, only a single map expansion
|
||||
is done. I intend to be fully backward compatible with this.
|
||||
|
||||
Historically, if the mode of the editor changed (ex to vi or vice versa),
|
||||
any queued input was silently discarded. I don't see any reason to either
|
||||
support or not support this semantic. I intend to retain the queued input,
|
||||
mostly because it's simpler than throwing it away.
|
||||
|
||||
Historically, neither the initial command on the command line (the + flag)
|
||||
or the +cmd associated with the ex and edit commands was subject to mapping.
|
||||
Also, while the +cmd appears to be subject to "@buffer" expansion, once
|
||||
expanded it doesn't appear to work correctly. I don't see any reason to
|
||||
either support or not support these semantics, so, for consistency, I intend
|
||||
to pass both the initial command and the command associated with ex and edit
|
||||
commands through the standard mapping and @ buffer expansion.
|
||||
|
||||
One other difference between the historic ex/vi and nex/nvi is that nex
|
||||
displays the executed buffers as it executes them. This means that if
|
||||
the file is:
|
||||
|
||||
set term=xterm
|
||||
set term=yterm
|
||||
set term=yterm
|
||||
|
||||
the user will see the following during a typical edit session:
|
||||
|
||||
nex testfile
|
||||
testfile: unmodified: line 3
|
||||
:1,$yank a
|
||||
:@a
|
||||
:set term=zterm
|
||||
:set term=yterm
|
||||
:set term=xterm
|
||||
:q!
|
||||
|
||||
This seems like a feature and unlikely to break anything, so I don't
|
||||
intend to match historic practice in this area.
|
||||
|
||||
The rest of this document is a set of conclusions as to how I believe
|
||||
the historic maps and @ buffers work. The summary is as follows:
|
||||
|
||||
1: For buffers that are cut in "line mode", or buffers that are not cut
|
||||
in line mode but which contain portions of more than a single line, a
|
||||
trailing <newline> character appears in the input for each line in the
|
||||
buffer when it is executed. For buffers not cut in line mode and which
|
||||
contain portions of only a single line, no additional characters
|
||||
appear in the input.
|
||||
2: Executable buffers that execute other buffers don't load their
|
||||
contents until they execute them.
|
||||
3: Maps and executable buffers are copied when they are executed --
|
||||
they can be modified by the command but that does not change their
|
||||
actions.
|
||||
4: Historically, executable buffers are discarded if the editor
|
||||
switches between ex and vi modes.
|
||||
5: Executable buffers inside of map commands are expanded normally.
|
||||
Maps inside of executable buffers are expanded normally.
|
||||
6: If an error is encountered while executing a mapped command or buffer,
|
||||
the rest of the mapped command/buffer is discarded. No user input
|
||||
characters are discarded.
|
||||
7: Characters in executable buffers are remapped.
|
||||
8: Characters in executable buffers are not quoted.
|
||||
|
||||
Individual test cases follow. Note, in the test cases, control characters
|
||||
are not literal and will have to be replaced to make the test cases work.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
1: For buffers that are cut in "line mode", or buffers that are not cut
|
||||
in line mode but which contain portions of more than a single line, a
|
||||
trailing <newline> character appears in the input for each line in the
|
||||
buffer when it is executed. For buffers not cut in line mode and which
|
||||
contain portions of only a single line, no additional characters
|
||||
appear in the input.
|
||||
|
||||
=== test file ===
|
||||
3Gw
|
||||
w
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
=== end test file ===
|
||||
|
||||
If the first line is loaded into 'a' and executed:
|
||||
|
||||
1G"ayy@a
|
||||
|
||||
The cursor ends up on the '2', a result of pushing "3Gw^J" onto
|
||||
the stack.
|
||||
|
||||
If the first two lines are loaded into 'a' and executed:
|
||||
|
||||
1G2"ayy@a
|
||||
|
||||
The cursor ends up on the 'f' in "foo" in the fifth line of the
|
||||
file, a result of pushing "3Gw^Jw^J" onto the stack.
|
||||
|
||||
If the first line is loaded into 'a', but not using line mode,
|
||||
and executed:
|
||||
|
||||
1G"ay$@a
|
||||
|
||||
The cursor ends up on the '1', a result of pushing "3Gw" onto
|
||||
the stack
|
||||
|
||||
If the first two lines are loaded into 'a', but not using line mode,
|
||||
and executed:
|
||||
|
||||
1G2"ay$@a
|
||||
|
||||
The cursor ends up on the 'f' in "foo" in the fifth line of the
|
||||
file, a result of pushing "3Gw^Jw^J" onto the stack.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
2: Executable buffers that execute other buffers don't load their
|
||||
contents until they execute them.
|
||||
|
||||
=== test file ===
|
||||
cwLOAD B^[
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
@a@b
|
||||
"byy
|
||||
=== end test file ===
|
||||
|
||||
The command is loaded into 'e', and then executed. 'e' executes
|
||||
'a', which loads 'b', then 'e' executes 'b'.
|
||||
|
||||
5G"eyy6G"ayy1G@e
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
cwLOAD B^[
|
||||
LOAD B 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
@a@b
|
||||
"byy
|
||||
=== end output file ===
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
3: Maps and executable buffers are copied when they are executed --
|
||||
they can be modified by the command but that does not change their
|
||||
actions.
|
||||
|
||||
Executable buffers:
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
@a@b
|
||||
"eyy
|
||||
cwEXECUTE B^[
|
||||
=== end test file ===
|
||||
|
||||
4G"eyy5G"ayy6G"byy1G@eG"ep
|
||||
|
||||
The command is loaded into 'e', and then executed. 'e' executes
|
||||
'a', which loads 'e', then 'e' executes 'b' anyway.
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
line 1 foo bar baz
|
||||
EXECUTE B 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
@a@b
|
||||
"eyy
|
||||
cwEXECUTE B^[
|
||||
line 1 foo bar baz
|
||||
=== end output file ===
|
||||
|
||||
Maps:
|
||||
|
||||
=== test file ===
|
||||
Cine 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
=== end test file ===
|
||||
|
||||
Entering the command ':map = :map = rB^V^MrA^M1G==' shows that
|
||||
the first time the '=' is entered the '=' map is set and the
|
||||
character is changed to 'A', the second time the character is
|
||||
changed to 'B'.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
4: Historically, executable buffers are discarded if the editor
|
||||
switches between ex and vi modes.
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
cwCHANGE^[Q:set
|
||||
set|visual|1Gwww
|
||||
=== end test file ===
|
||||
|
||||
vi testfile
|
||||
4G"ayy@a
|
||||
|
||||
ex testfile
|
||||
$p
|
||||
yank a
|
||||
@a
|
||||
|
||||
In vi, the command is loaded into 'a' and then executed. The command
|
||||
subsequent to the 'Q' is (historically, silently) discarded.
|
||||
|
||||
In ex, the command is loaded into 'a' and then executed. The command
|
||||
subsequent to the 'visual' is (historically, silently) discarded. The
|
||||
first set command is output by ex, although refreshing the screen usually
|
||||
causes it not to be seen.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
5: Executable buffers inside of map commands are expanded normally.
|
||||
Maps inside of executable buffers are expanded normally.
|
||||
|
||||
Buffers inside of map commands:
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
cwREPLACE BY A^[
|
||||
=== end test file ===
|
||||
|
||||
4G"ay$:map x @a
|
||||
1Gx
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
REPLACE BY A 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
cwREPLACE BY A^[
|
||||
=== end output file ===
|
||||
|
||||
Maps commands inside of executable buffers:
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
X
|
||||
=== end test file ===
|
||||
|
||||
:map X cwREPLACE BY XMAP^[
|
||||
4G"ay$1G@a
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
REPLACE BY XMAP 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
X
|
||||
=== end output file ===
|
||||
|
||||
Here's a test that does both, repeatedly.
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
X
|
||||
Y
|
||||
cwREPLACED BY C^[
|
||||
blank line
|
||||
=== end test file ===
|
||||
|
||||
:map x @a
|
||||
4G"ay$
|
||||
:map X @b
|
||||
5G"by$
|
||||
:map Y @c
|
||||
6G"cy$
|
||||
1Gx
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
REPLACED BY C 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
X
|
||||
Y
|
||||
cwREPLACED BY C^[
|
||||
blank line
|
||||
=== end output file ===
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
6: If an error is encountered while executing a mapped command or
|
||||
a buffer, the rest of the mapped command/buffer is discarded. No
|
||||
user input characters are discarded.
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
:map = 10GcwREPLACMENT^V^[^[
|
||||
=== end test file ===
|
||||
|
||||
The above mapping fails, however, if the 10G is changed to 1, 2,
|
||||
or 3G, it will succeed.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
7: Characters in executable buffers are remapped.
|
||||
|
||||
=== test file ===
|
||||
abcdefghijklmnnop
|
||||
ggg
|
||||
=== end test file ===
|
||||
|
||||
:map g x
|
||||
2G"ay$1G@a
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
defghijklmnnop
|
||||
ggg
|
||||
=== end output file ===
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
8: Characters in executable buffers are not quoted.
|
||||
|
||||
=== test file ===
|
||||
iFOO^[
|
||||
|
||||
=== end test file ===
|
||||
|
||||
1G"ay$2G@a
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
iFOO^[
|
||||
FOO
|
||||
=== end output file ===
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
@ -0,0 +1,36 @@
|
|||
@(#)openmode 8.1 (Berkeley) 10/29/94
|
||||
|
||||
Open mode has the following special behaviors:
|
||||
|
||||
z, ^F, ^B:
|
||||
If count is not specified, it shall default to the window
|
||||
edit option - 2.
|
||||
|
||||
Write lines from the edit buffer starting at:
|
||||
|
||||
(the current line) - ((count - 2) / 2)
|
||||
|
||||
until:
|
||||
|
||||
(((count + 1) / 2) * 2) - 1
|
||||
|
||||
lines, or the last line in the edit buffer has been written. A
|
||||
line consisting of the smaller of the number of columns in the
|
||||
display divided by two or 40 ``-'' characters shall be written
|
||||
immediately before and after the specified is written. These two
|
||||
lines shall count against the total number of lines to be written.
|
||||
A blank line shall be written after the last line is written.
|
||||
|
||||
z, ^F and ^B all behave identically.
|
||||
|
||||
^D: Display the next scroll value lines, change the current line.
|
||||
|
||||
^U: Change the current line, do nothing else.
|
||||
|
||||
^E, ^Y: Do nothing.
|
||||
|
||||
^L: Clear the screen and redisplay the current line.
|
||||
|
||||
H, L, M:
|
||||
Move to the first nonblank of the current line and do nothing
|
||||
else.
|
|
@ -0,0 +1,208 @@
|
|||
# @(#)quoting 5.5 (Berkeley) 11/12/94
|
||||
|
||||
QUOTING IN EX/VI:
|
||||
|
||||
There are four escape characters in historic ex/vi:
|
||||
|
||||
\ (backslashes)
|
||||
^V
|
||||
^Q (assuming it wasn't used for IXON/IXOFF)
|
||||
The terminal literal next character.
|
||||
|
||||
Vi did not use the lnext character, it always used ^V (or ^Q).
|
||||
^V and ^Q were equivalent in all cases for vi.
|
||||
|
||||
There are four different areas in ex/vi where escaping characters
|
||||
is interesting:
|
||||
|
||||
1: In vi text input mode.
|
||||
2: In vi command mode.
|
||||
3: In ex command and text input modes.
|
||||
4: In the ex commands themselves.
|
||||
|
||||
1: Vi text input mode (a, i, o, :colon commands, etc.):
|
||||
|
||||
The set of characters that users might want to escape are as follows.
|
||||
As ^L and ^Z were not special in input mode, they are not listed.
|
||||
|
||||
carriage return (^M)
|
||||
escape (^[)
|
||||
autoindents (^D, 0, ^, ^T)
|
||||
erase (^H)
|
||||
word erase (^W)
|
||||
line erase (^U)
|
||||
newline (^J) (not historic practice)
|
||||
|
||||
Historic practice was that ^V was the only way to escape any
|
||||
of these characters, and that whatever character followed
|
||||
the ^V was taken literally, e.g. ^V^V is a single ^V. I
|
||||
don't see any strong reason to make it possible to escape
|
||||
^J, so I'm going to leave that alone.
|
||||
|
||||
One comment regarding the autoindent characters. In historic
|
||||
vi, if you entered "^V0^D" autoindent erasure was still
|
||||
triggered, although it wasn't if you entered "0^V^D". In
|
||||
nvi, if you escape either character, autoindent erasure is
|
||||
not triggered.
|
||||
|
||||
Abbreviations were not performed if the non-word character
|
||||
that triggered the abbreviation was escaped by a ^V. Input
|
||||
maps were not triggered if any part of the map was escaped
|
||||
by a ^V.
|
||||
|
||||
The historic vi implementation for the 'r' command requires
|
||||
two leading ^V's to replace a character with a literal
|
||||
character. This is obviously a bug, and should be fixed.
|
||||
|
||||
2: Vi command mode
|
||||
|
||||
Command maps were not triggered if the second or later
|
||||
character of a map was escaped by a ^V.
|
||||
|
||||
The obvious extension is that ^V should keep the next command
|
||||
character from being mapped, so you can do ":map x xxx" and
|
||||
then enter ^Vx to delete a single character.
|
||||
|
||||
3: Ex command and text input modes.
|
||||
|
||||
As ex ran in canonical mode, there was little work that it
|
||||
needed to do for quoting. The notable differences between
|
||||
ex and vi are that it was possible to escape a <newline> in
|
||||
the ex command and text input modes, and ex used the "literal
|
||||
next" character, not control-V/control-Q.
|
||||
|
||||
4: The ex commands:
|
||||
|
||||
Ex commands are delimited by '|' or newline characters.
|
||||
Within the commands, whitespace characters delimit the
|
||||
arguments. Backslash will generally escape any following
|
||||
character. In the abbreviate, unabbreviate, map and unmap
|
||||
commands, control-V escapes the next character, instead.
|
||||
|
||||
This is historic behavior in vi, although there are special
|
||||
cases where it's impossible to escape a character, generally
|
||||
a whitespace character.
|
||||
|
||||
Escaping characters in file names in ex commands:
|
||||
|
||||
:cd [directory] (directory)
|
||||
:chdir [directory] (directory)
|
||||
:edit [+cmd] [file] (file)
|
||||
:ex [+cmd] [file] (file)
|
||||
:file [file] (file)
|
||||
:next [file ...] (file ...)
|
||||
:read [!cmd | file] (file)
|
||||
:source [file] (file)
|
||||
:write [!cmd | file] (file)
|
||||
:wq [file] (file)
|
||||
:xit [file] (file)
|
||||
|
||||
Since file names are also subject to word expansion, the
|
||||
underlying shell had better be doing the correct backslash
|
||||
escaping. This is NOT historic behavior in vi, making it
|
||||
impossible to insert a whitespace, newline or carriage return
|
||||
character into a file name.
|
||||
|
||||
4: Escaping characters in non-file arguments in ex commands:
|
||||
|
||||
:abbreviate word string (word, string)
|
||||
* :edit [+cmd] [file] (+cmd)
|
||||
* :ex [+cmd] [file] (+cmd)
|
||||
:map word string (word, string)
|
||||
* :set [option ...] (option)
|
||||
* :tag string (string)
|
||||
:unabbreviate word (word)
|
||||
:unmap word (word)
|
||||
|
||||
These commands use whitespace to delimit their arguments, and use
|
||||
^V to escape those characters. The exceptions are starred in the
|
||||
above list, and are discussed below.
|
||||
|
||||
In general, I intend to treat a ^V in any argument, followed by
|
||||
any character, as that literal character. This will permit
|
||||
editing of files name "foo|", for example, by using the string
|
||||
"foo\^V|", where the literal next character protects the pipe
|
||||
from the ex command parser and the backslash protects it from the
|
||||
shell expansion.
|
||||
|
||||
This is backward compatible with historical vi, although there
|
||||
were a number of special cases where vi wasn't consistent.
|
||||
|
||||
4.1: The edit/ex commands:
|
||||
|
||||
The edit/ex commands are a special case because | symbols may
|
||||
occur in the "+cmd" field, for example:
|
||||
|
||||
:edit +10|s/abc/ABC/ file.c
|
||||
|
||||
In addition, the edit and ex commands have historically
|
||||
ignored literal next characters in the +cmd string, so that
|
||||
the following command won't work.
|
||||
|
||||
:edit +10|s/X/^V / file.c
|
||||
|
||||
I intend to handle the literal next character in edit/ex consistently
|
||||
with how it is handled in other commands.
|
||||
|
||||
More fun facts to know and tell:
|
||||
The acid test for the ex/edit commands:
|
||||
|
||||
date > file1; date > file2
|
||||
vi
|
||||
:edit +1|s/./XXX/|w file1| e file2|1 | s/./XXX/|wq
|
||||
|
||||
No version of vi, of which I'm aware, handles it.
|
||||
|
||||
4.2: The set command:
|
||||
|
||||
The set command treats ^V's as literal characters, so the
|
||||
following command won't work. Backslashes do work in this
|
||||
case, though, so the second version of the command does work.
|
||||
|
||||
set tags=tags_file1^V tags_file2
|
||||
set tags=tags_file1\ tags_file2
|
||||
|
||||
I intend to continue permitting backslashes in set commands,
|
||||
but to also permit literal next characters to work as well.
|
||||
This is backward compatible, but will also make set
|
||||
consistent with the other commands. I think it's unlikely
|
||||
to break any historic .exrc's, given that there are probably
|
||||
very few files with ^V's in their name.
|
||||
|
||||
4.3: The tag command:
|
||||
|
||||
The tag command ignores ^V's and backslashes; there's no way to
|
||||
get a space into a tag name.
|
||||
|
||||
I think this is a don't care, and I don't intend to fix it.
|
||||
|
||||
5: Regular expressions:
|
||||
|
||||
:global /pattern/ command
|
||||
:substitute /pattern/replace/
|
||||
:vglobal /pattern/ command
|
||||
|
||||
I intend to treat a backslash in the pattern, followed by the
|
||||
delimiter character or a backslash, as that literal character.
|
||||
|
||||
This is historic behavior in vi. It would get rid of a fairly
|
||||
hard-to-explain special case if we could just use the character
|
||||
immediately following the backslash in all cases, or, if we
|
||||
changed nvi to permit using the literal next character as a
|
||||
pattern escape character, but that would probably break historic
|
||||
scripts.
|
||||
|
||||
There is an additional escaping issue for regular expressions.
|
||||
Within the pattern and replacement, the '|' character did not
|
||||
delimit ex commands. For example, the following is legal.
|
||||
|
||||
:substitute /|/PIPE/|s/P/XXX/
|
||||
|
||||
This is a special case that I will support.
|
||||
|
||||
6: Ending anything with an escape character:
|
||||
|
||||
In all of the above rules, an escape character (either ^V or a
|
||||
backslash) at the end of an argument or file name is not handled
|
||||
specially, but used as a literal character.
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
# @(#)structures 5.4 (Berkeley) 10/4/95
|
||||
|
||||
There are three major data structures in this package, plus a single data
|
||||
structure per screen type. The first is a single global structure (GS)
|
||||
which contains information common to all files and screens. It hold
|
||||
global things like the input key queues, and functions as a single place
|
||||
to hang things. For example, interrupt routines have to be able to find
|
||||
screen structures, and they can only do this if they have a starting
|
||||
point. The number of globals in nvi is dependent on the screen type, but
|
||||
every screen type will have at least one global, __global_list, which
|
||||
references the GS structure.
|
||||
|
||||
The GS structure contains linked lists of screen (SCR) structures.
|
||||
Each SCR structure normally references a file (EXF) structure.
|
||||
|
||||
The GS structure has a set of functions which update the screen and/or
|
||||
return information about the screen from the underlying screen package.
|
||||
The GS structure never goes away. The SCR structure persists over
|
||||
instances of screens, and the EXF structure persists over references to
|
||||
files.
|
||||
|
||||
File names have different properties than files themselves, so the name
|
||||
information for a file is held in an FREF structure which is chained from
|
||||
the SCR structure.
|
||||
|
||||
In general, functions are always passed an SCR structure, which usually
|
||||
references an underlying EXF structure. The SCR structure is necessary
|
||||
for any routine that wishes to talk to the screen, the EXF structure is
|
||||
necessary for any routine that wants to modify the file. The relationship
|
||||
between an SCR structure and its underlying EXF structure is not fixed,
|
||||
and various ex commands will substitute a new EXF in place of the current
|
||||
one, and there's no way to detect this.
|
||||
|
||||
The naming of the structures is consistent across the program. (Macros
|
||||
even depend on it, so don't try and change it!) The global structure is
|
||||
"gp", the screen structure is "sp", and the file structure is "ep".
|
||||
|
||||
A few other data structures:
|
||||
|
||||
TEXT In nvi/cut.h. This structure describes a portion of a line,
|
||||
and is used by the input routines and as the "line" part of a
|
||||
cut buffer.
|
||||
|
||||
CB In nvi/cut.h. A cut buffer. A cut buffer is a place to
|
||||
hang a list of TEXT structures.
|
||||
|
||||
CL The curses screen private data structure. Everything to
|
||||
do standalone curses screens.
|
||||
|
||||
MARK In nvi/mark.h. A cursor position, consisting of a line number
|
||||
and a column number.
|
||||
|
||||
MSG In nvi/msg.h. A chain of messages for the user.
|
||||
|
||||
SEQ In nvi/seq.h. An abbreviation or a map entry.
|
||||
|
||||
TK The Tcl/Tk screen private data structure. Everything to
|
||||
do standalone Tcl/Tk screens.
|
||||
|
||||
EXCMD In nvi/ex/ex.h. The structure that gets passed around to the
|
||||
functions that implement the ex commands. (The main ex command
|
||||
loop (see nvi/ex/ex.c) builds this up and then passes it to the
|
||||
ex functions.)
|
||||
|
||||
VICMD In nvi/vi/vi.h. The structure that gets passed around to the
|
||||
functions that implement the vi commands. (The main vi command
|
||||
loop (see nvi/vi/vi.c) builds this up and then passes it to the
|
||||
vi functions.)
|
|
@ -0,0 +1,112 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# $NetBSD: nvi2netbsd,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
#
|
||||
# Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
# 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.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
#
|
||||
# based on amd2netbsd,
|
||||
# itself based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
|
||||
#
|
||||
# Rough instructions for importing new nvi release:
|
||||
#
|
||||
# $ cd /some/where/temporary
|
||||
# $ tar xpfz /new/nvi/release/tar/file
|
||||
# $ sh /usr/src/external/bsd/nvi/nvi2netbsd nvi-x.y.z `pwd`
|
||||
# $ cd src/external/bsd/nvi/dist
|
||||
# $ cvs import -m "Import nvi x.y.z" src/external/bsd/nvi/dist NVI nvi-x-y-z
|
||||
# $ cd ../../../nvi/build.unix
|
||||
# $ run ../dist/configure --with-db_type=db1 --enable-widechar
|
||||
# ... to be continued
|
||||
#
|
||||
|
||||
if [ $# -ne 2 ]; then echo "nvi2netbsd src dest"; exit 1; fi
|
||||
|
||||
r="$1"
|
||||
d="$2"/src/external/bsd/nvi/dist
|
||||
|
||||
case "$d" in
|
||||
/*)
|
||||
;;
|
||||
*)
|
||||
d="`/bin/pwd`/$d"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$r" in
|
||||
/*)
|
||||
;;
|
||||
*)
|
||||
r="`/bin/pwd`/$r"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo preparing directory "$d"
|
||||
rm -rf "$d"
|
||||
mkdir -p "$d"
|
||||
|
||||
### Copy the files and directories
|
||||
echo copying "$r" to "$d"
|
||||
cd "$r"
|
||||
pax -rw * "$d"
|
||||
|
||||
echo removing unneeded directories and files
|
||||
|
||||
### Remove unneeded files
|
||||
cd "$d"
|
||||
rm -f catalog/english.base # we generate it
|
||||
rm -fr dist/autom4te.cache
|
||||
rm -f dist/tags
|
||||
rm -fr docs/html
|
||||
rm -f docs/*/*.ps docs/*/grohtml* docs/*/*.0 docs/*/*.txt
|
||||
rm -f common/options_def.h # must be removed: we generate it
|
||||
rm -fr include compat db.1.85
|
||||
rm -fr .git
|
||||
|
||||
cd catalog
|
||||
for f in *.base; do
|
||||
f2="`echo "$f" | sed -e 's/\.base$//'`"
|
||||
rm -f "$f2" "$f2".check
|
||||
done
|
||||
|
||||
cleantags "$d"
|
||||
|
||||
### Clean up any CVS directories that might be around.
|
||||
echo "cleaning up CVS residue."
|
||||
(
|
||||
cd "$d"
|
||||
find . -type d -name "CVS" -print | xargs rm -r
|
||||
)
|
||||
echo done
|
||||
|
||||
### Fixing file and directory permissions.
|
||||
echo "Fixing file/directory permissions."
|
||||
(
|
||||
cd "$d"
|
||||
find . -type f -print | xargs chmod u+rw,go+r
|
||||
find . -type d -print | xargs chmod u+rwx,go+rx
|
||||
)
|
||||
echo done
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,3 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
SUBDIR = nvi recover
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,103 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
USE_WIDECHAR?=yes
|
||||
|
||||
CWARNFLAGS.clang+= -Wno-uninitialized -Wno-format-security
|
||||
|
||||
CPPFLAGS+=-I${DIST}/include -I${.CURDIR} -I. -DGTAGS -DUSE_BUNDLED_DB
|
||||
#DBG=-g
|
||||
|
||||
#CWARNFLAGS+=-Wno-parentheses -Wno-unused -Wno-missing-prototypes
|
||||
#.if defined(HAVE_GCC)
|
||||
#CWARNFLAGS+=-Wno-pointer-sign
|
||||
#COPTS+=-fno-strict-aliasing
|
||||
#.endif
|
||||
|
||||
LDADD+= -lcurses -lterminfo
|
||||
DPADD+= ${LIBCURSES} ${LIBTERMINFO}
|
||||
PROG= vi
|
||||
SRCS= api.c cl_bsd.c cl_funcs.c cl_main.c cl_read.c cl_screen.c cl_term.c \
|
||||
conv.c cut.c delete.c ex.c ex_abbrev.c ex_append.c \
|
||||
ex_args.c ex_argv.c ex_at.c ex_bang.c ex_cd.c ex_cmd.c ex_cscope.c \
|
||||
ex_delete.c ex_display.c ex_edit.c ex_equal.c ex_file.c ex_filter.c \
|
||||
ex_global.c ex_init.c ex_join.c ex_map.c ex_mark.c ex_mkexrc.c \
|
||||
ex_move.c ex_open.c ex_perl.c ex_preserve.c ex_print.c ex_put.c \
|
||||
ex_quit.c ex_read.c ex_screen.c ex_script.c ex_set.c ex_shell.c \
|
||||
ex_shift.c ex_source.c ex_stop.c ex_subst.c ex_tag.c ex_tcl.c \
|
||||
ex_txt.c ex_undo.c ex_usage.c ex_util.c ex_version.c ex_visual.c \
|
||||
ex_write.c ex_yank.c ex_z.c exf.c getc.c gs.c \
|
||||
ip_funcs.c ip_read.c ip_screen.c ip_term.c \
|
||||
ip_run.c ip_send.c ip_trans.c ipc_cmd.c ipc_method.c \
|
||||
key.c log1.c \
|
||||
main.c mark.c msg.c nothread.c options.c options_f.c put.c recover.c \
|
||||
screen.c search.c seq.c util.c v_at.c v_ch.c v_cmd.c v_delete.c \
|
||||
v_event.c v_ex.c v_increment.c v_init.c v_itxt.c v_left.c v_mark.c \
|
||||
v_match.c v_paragraph.c v_put.c v_redraw.c v_replace.c v_right.c \
|
||||
v_screen.c v_scroll.c v_search.c v_section.c v_sentence.c v_status.c \
|
||||
v_txt.c v_ulcase.c v_undo.c v_util.c v_word.c v_xchar.c v_yank.c \
|
||||
v_z.c v_zexit.c vi.c vi_db1.c vs_line.c vs_msg.c vs_refresh.c \
|
||||
vs_relative.c vs_smap.c vs_split.c
|
||||
|
||||
# For wide char support
|
||||
.if ${USE_WIDECHAR} == "yes"
|
||||
SRCS+= regcomp.c regerror.c regexec.c regfree.c
|
||||
CPPFLAGS+=-I${DIST}/regex -D__REGEX_PRIVATE -DUSE_WIDECHAR
|
||||
.endif
|
||||
|
||||
LINKS= ${BINDIR}/vi ${BINDIR}/ex ${BINDIR}/vi ${BINDIR}/view
|
||||
MLINKS= vi.1 ex.1 vi.1 view.1
|
||||
|
||||
DPSRCS+=options_def.h ipc_def.h ex_def.h # ipc_gen.c
|
||||
CLEANFILES+=options_def.h ipc_def.h ex_def.h # ipc_gen.c
|
||||
|
||||
options_def.h: options.awk options.c
|
||||
${_MKTARGET_CREATE}
|
||||
${TOOL_AWK} -f ${.ALLSRC} >${.TARGET}
|
||||
|
||||
ex_def.h: ex.awk ex_cmd.c
|
||||
${_MKTARGET_CREATE}
|
||||
${TOOL_AWK} -f ${.ALLSRC} >${.TARGET}
|
||||
|
||||
ipc_def.h: ipc.awk vipc.awk ipc_cmd.c ip_read.c
|
||||
${_MKTARGET_CREATE}
|
||||
(${TOOL_AWK} -f ${.ALLSRC:M*/ipc.awk} ${.ALLSRC:M*/ipc_cmd.c} && \
|
||||
${TOOL_AWK} -f ${.ALLSRC:M*/vipc.awk} ${.ALLSRC:M*/ip_read.c}) > \
|
||||
${.TARGET}
|
||||
|
||||
.for i in cl common ex ip ipc vi
|
||||
DPSRCS+=${i}_extern.h
|
||||
CLEANFILES+=${i}_extern.h
|
||||
_${i}_SRCS != echo ${DIST}/${i}/*.c ${DIST}/${i}/*.xs
|
||||
${i}_extern.h: ${SRCS}
|
||||
${_MKTARGET_CREATE}
|
||||
${TOOL_SED} -n "s/^ \* PUBLIC: \(.*\)/\1/p" ${.ALLSRC:M*/$i/*} > ${.TARGET}
|
||||
.endfor
|
||||
|
||||
DPSRCS+=version.h
|
||||
CLEANFILES+=version.h
|
||||
version.h: ../../Makefile.inc
|
||||
${_MKTARGET_CREATE}
|
||||
echo '#define VI_VERSION "(${VERSION})"' > ${.TARGET}
|
||||
|
||||
#ipc_gen.c: vipc.pl ip_read.c
|
||||
# ${_MKTARGET_CREATE}
|
||||
# ${TOOL_PERL} -n ${.ALLSRC} > ${.TARGET}
|
||||
|
||||
|
||||
.include "${.CURDIR}/../../Makefile.inc"
|
||||
|
||||
WARNS= 4
|
||||
|
||||
.PATH: ${DIST}/vi ${DIST}/ex ${DIST}/cl
|
||||
.PATH: ${DIST}/common
|
||||
.PATH: ${DIST}/ipc
|
||||
.PATH: ${DIST}/ip
|
||||
.PATH: ${DIST}/regex
|
||||
.PATH: ${DIST}/docs/vi.man
|
||||
|
||||
COPTS.exf.c += -Wno-format-nonliteral
|
||||
COPTS.msg.c += -Wno-format-nonliteral
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,199 @@
|
|||
/* $Id: compat.h,v 1.1 2013/11/22 16:00:45 christos Exp $ (Berkeley) $Date: 2013/11/22 16:00:45 $ */
|
||||
|
||||
/*
|
||||
* Declare the basic types, if they aren't already declared. Named and
|
||||
* some system's db.h files protect them with __BIT_TYPES_DEFINED__.
|
||||
*/
|
||||
#ifndef __BIT_TYPES_DEFINED__
|
||||
#define __BIT_TYPES_DEFINED__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Handle function prototypes. This steps on name space that vi doesn't
|
||||
* control, but all of the other solutions are worse.
|
||||
*/
|
||||
#undef __P
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define __P(protos) protos /* ANSI C prototypes */
|
||||
#else
|
||||
#define __P(protos) () /* K&R C preprocessor */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Some versions of System V changed the number of arguments to gettimeofday
|
||||
* without changing the name.
|
||||
*/
|
||||
#ifdef HAVE_BROKEN_GETTIMEOFDAY
|
||||
#define gettimeofday(tv, tz) gettimeofday(tv)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* If we don't have mmap, we fake it with read and write, but we'll
|
||||
* still need the header information.
|
||||
*/
|
||||
#ifndef HAVE_SYS_MMAN_H
|
||||
#define MAP_SHARED 1 /* share changes */
|
||||
#define MAP_PRIVATE 2 /* changes are private */
|
||||
#define PROT_READ 0x1 /* pages can be read */
|
||||
#define PROT_WRITE 0x2 /* pages can be written */
|
||||
#define PROT_EXEC 0x4 /* pages can be executed */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 names for file descriptors.
|
||||
*/
|
||||
#ifndef STDERR_FILENO
|
||||
#define STDIN_FILENO 0 /* ANSI C #defines */
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 names for seek settings.
|
||||
*/
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_SET 0 /* POSIX 1003.1 seek values */
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hack _POSIX_VDISABLE to \377 since Ultrix doesn't honor _POSIX_VDISABLE
|
||||
* (treats it as ^@). The symptom is that the ^@ keystroke immediately
|
||||
* drops core.
|
||||
*/
|
||||
#ifdef HAVE_BROKEN_VDISABLE
|
||||
#undef _POSIX_VDISABLE
|
||||
#define _POSIX_VDISABLE ((unsigned char)'\377')
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 tty disabling character.
|
||||
*/
|
||||
#ifndef _POSIX_VDISABLE
|
||||
#define _POSIX_VDISABLE 0 /* Some systems used 0. */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* 4.4BSD extension to only set the software termios bits.
|
||||
*/
|
||||
#ifndef TCSASOFT /* 4.4BSD extension. */
|
||||
#define TCSASOFT 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 maximum path length.
|
||||
*/
|
||||
#ifndef MAXPATHLEN
|
||||
#ifdef PATH_MAX
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#else
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* MIN, MAX, historically in <sys/param.h>
|
||||
*/
|
||||
#ifndef MAX
|
||||
#define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* "DB" isn't always portable, and we want the private information.
|
||||
*/
|
||||
#define DB L__DB
|
||||
#undef pgno_t /* IRIX has its own version. */
|
||||
#define pgno_t L__db_pgno_t
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* 4.4BSD extension to provide lock values in the open(2) call.
|
||||
*/
|
||||
#ifndef O_EXLOCK
|
||||
#define O_EXLOCK 0
|
||||
#endif
|
||||
|
||||
#ifndef O_SHLOCK
|
||||
#define O_SHLOCK 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 bad file format errno.
|
||||
*/
|
||||
#ifndef EFTYPE
|
||||
#define EFTYPE EINVAL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.2 RE length limit.
|
||||
*/
|
||||
#ifndef _POSIX2_RE_DUP_MAX
|
||||
#define _POSIX2_RE_DUP_MAX 255
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* 4.4BSD extension to determine if a program dropped core from the exit
|
||||
* status.
|
||||
*/
|
||||
#ifndef WCOREDUMP
|
||||
#define WCOREDUMP(a) 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Endian-ness of the machine.
|
||||
*/
|
||||
#if !defined(LITTLE_ENDIAN)
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
#if !defined(BIG_ENDIAN)
|
||||
#define BIG_ENDIAN 4321
|
||||
#endif
|
||||
#if !defined(BYTE_ORDER)
|
||||
#if WORDS_BIGENDIAN == 1
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#else
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MEMCPY
|
||||
#define memcpy memmove
|
||||
#endif
|
||||
|
||||
#ifdef NEED_FPRINTF_PROTO
|
||||
extern int fprintf( FILE *, const char *, ... );
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
#define VI_DB_THREAD DB_THREAD
|
||||
#else
|
||||
#define VI_DB_THREAD 0
|
||||
#endif
|
|
@ -0,0 +1,283 @@
|
|||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
/* #undef AC_APPLE_UNIVERSAL_BUILD */
|
||||
|
||||
/* Define if you want a debugging version. */
|
||||
/* #undef DEBUG */
|
||||
|
||||
/* Define if you have a System V-style (broken) gettimeofday. */
|
||||
/* #undef HAVE_BROKEN_GETTIMEOFDAY */
|
||||
|
||||
/* Define if you have a Ultrix-style (broken) vdisable. */
|
||||
/* #undef HAVE_BROKEN_VDISABLE */
|
||||
|
||||
/* Define if you have a BSD version of curses. */
|
||||
/* #undef HAVE_BSD_CURSES */
|
||||
|
||||
/* Define to 1 if you have the `bsearch' function. */
|
||||
#define HAVE_BSEARCH 1
|
||||
|
||||
/* Define if you have the curses(3) beep function. */
|
||||
#define HAVE_CURSES_BEEP 1
|
||||
|
||||
/* Define if you have the curses(3) flash function. */
|
||||
#define HAVE_CURSES_FLASH 1
|
||||
|
||||
/* Define if you have the curses(3) idlok function. */
|
||||
#define HAVE_CURSES_IDLOK 1
|
||||
|
||||
/* Define if you have the curses(3) keypad function. */
|
||||
#define HAVE_CURSES_KEYPAD 1
|
||||
|
||||
/* Define if you have the curses(3) newterm function. */
|
||||
#define HAVE_CURSES_NEWTERM 1
|
||||
|
||||
/* Define if you have the curses(3) setupterm function. */
|
||||
#define HAVE_CURSES_SETUPTERM 1
|
||||
|
||||
/* Define if you have the curses(3) tigetstr/tigetnum functions. */
|
||||
#define HAVE_CURSES_TIGETSTR 1
|
||||
|
||||
/* Define if you have the curses(3) waddnstr function. */
|
||||
#define HAVE_CURSES_WADDNSTR 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#define HAVE_FORK 1
|
||||
|
||||
/* Define if you have the chsize(2) system call. */
|
||||
/* #undef HAVE_FTRUNCATE_CHSIZE */
|
||||
|
||||
/* Define if you have the ftruncate(2) system call. */
|
||||
#define HAVE_FTRUNCATE_FTRUNCATE 1
|
||||
|
||||
/* Define if you have gcc. */
|
||||
#define HAVE_GCC 1
|
||||
|
||||
/* Define to 1 if you have the `gethostname' function. */
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `iswblank' function. */
|
||||
#define HAVE_ISWBLANK 1
|
||||
|
||||
/* Define if you have fcntl(2) style locking. */
|
||||
/* #undef HAVE_LOCK_FCNTL */
|
||||
|
||||
/* Define if you have flock(2) style locking. */
|
||||
#define HAVE_LOCK_FLOCK 1
|
||||
|
||||
/* Define to 1 if you have the `memchr' function. */
|
||||
#define HAVE_MEMCHR 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#define HAVE_MEMSET 1
|
||||
|
||||
/* Define to 1 if you have the `mkstemp' function. */
|
||||
#define HAVE_MKSTEMP 1
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#define HAVE_MMAP 1
|
||||
|
||||
/* Define to 1 if you have the <ncursesw/ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSESW_NCURSES_H */
|
||||
|
||||
/* Define to 1 if you have the <ncurses.h> header file. */
|
||||
/* #undef HAVE_NCURSES_H */
|
||||
|
||||
/* Define is appropriate pango is available. */
|
||||
/* #undef HAVE_PANGO */
|
||||
|
||||
/* Define if you want to compile in the Perl interpreter. */
|
||||
/* #undef HAVE_PERL_INTERP */
|
||||
|
||||
/* Define if using pthread. */
|
||||
/* #undef HAVE_PTHREAD */
|
||||
|
||||
/* Define if you have the Berkeley style revoke(2) system call. */
|
||||
#define HAVE_REVOKE 1
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define to 1 if you have the `setenv' function. */
|
||||
#define HAVE_SETENV 1
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strpbrk' function. */
|
||||
#define HAVE_STRPBRK 1
|
||||
|
||||
/* Define to 1 if you have the `strsep' function. */
|
||||
#define HAVE_STRSEP 1
|
||||
|
||||
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
|
||||
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
|
||||
|
||||
/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
|
||||
`HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */
|
||||
#define HAVE_ST_BLKSIZE 1
|
||||
|
||||
/* Define if you have the System V style pty calls. */
|
||||
/* #undef HAVE_SYS5_PTY */
|
||||
|
||||
/* Define if you have <sys/mman.h> */
|
||||
#define HAVE_SYS_MMAN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define if you have <sys/select.h */
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you want to compile in the Tcl interpreter. */
|
||||
/* #undef HAVE_TCL_INTERP */
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `unsetenv' function. */
|
||||
#define HAVE_UNSETENV 1
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#define HAVE_VFORK 1
|
||||
|
||||
/* Define to 1 if you have the <vfork.h> header file. */
|
||||
/* #undef HAVE_VFORK_H */
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define to 1 if `fork' works. */
|
||||
#define HAVE_WORKING_FORK 1
|
||||
|
||||
/* Define to 1 if `vfork' works. */
|
||||
#define HAVE_WORKING_VFORK 1
|
||||
|
||||
/* Define is appropriate zvt is available. */
|
||||
/* #undef HAVE_ZVT */
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Define when fprintf prototype not in an obvious place. */
|
||||
/* #undef NEED_FPRINTF_PROTO */
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "vi"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "vi"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "vi 1.81.6"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "vi"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.81.6"
|
||||
|
||||
/* Define if your sprintf returns a pointer, not a length. */
|
||||
/* #undef SPRINTF_RET_CHARPNT */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
/* #undef TM_IN_SYS_TIME */
|
||||
|
||||
/* Define when using bundled db. */
|
||||
#define USE_BUNDLED_DB 1
|
||||
|
||||
/* Define when using db4 logging. */
|
||||
/* #undef USE_DB4_LOGGING */
|
||||
|
||||
/* Define when dynamically loading DB 3. */
|
||||
/* #undef USE_DYNAMIC_LOADING */
|
||||
|
||||
/* Define when iconv can be used. */
|
||||
#define USE_ICONV 1
|
||||
|
||||
/* Define when perl's setenv should be used. */
|
||||
/* #undef USE_PERL_SETENV */
|
||||
|
||||
/* Define when using wide characters. */
|
||||
/* #undef USE_WIDECHAR */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.81.6"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
/* # undef WORDS_BIGENDIAN */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define to `long int' if <sys/types.h> does not define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
/* #undef pid_t */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
/* #undef ssize_t */
|
||||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
/* #undef vfork */
|
|
@ -0,0 +1,230 @@
|
|||
/* Do not edit: automatically built by build/distrib. */
|
||||
static int
|
||||
vi_c_bol(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_C_BOL);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_c_bottom(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_C_BOTTOM);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_c_del(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_C_DEL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
vi_c_down(IPVIWIN *ipvi, u_int32_t val1)
|
||||
{
|
||||
return vi_send_1(ipvi, VI_C_DOWN, val1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
vi_c_eol(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_C_EOL);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_c_insert(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_C_INSERT);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_c_left(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_C_LEFT);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
vi_c_pgdown(IPVIWIN *ipvi, u_int32_t val1)
|
||||
{
|
||||
return vi_send_1(ipvi, VI_C_PGDOWN, val1);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_c_pgup(IPVIWIN *ipvi, u_int32_t val1)
|
||||
{
|
||||
return vi_send_1(ipvi, VI_C_PGUP, val1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
vi_c_right(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_C_RIGHT);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
vi_c_search(IPVIWIN *ipvi, const char *stra, u_int32_t lena, u_int32_t val1)
|
||||
{
|
||||
return vi_send_a1(ipvi, VI_C_SEARCH, stra, lena, val1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
vi_c_settop(IPVIWIN *ipvi, u_int32_t val1)
|
||||
{
|
||||
return vi_send_1(ipvi, VI_C_SETTOP, val1);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_c_top(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_C_TOP);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
vi_c_up(IPVIWIN *ipvi, u_int32_t val1)
|
||||
{
|
||||
return vi_send_1(ipvi, VI_C_UP, val1);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_edit(IPVIWIN *ipvi, const char *stra, u_int32_t lena)
|
||||
{
|
||||
return vi_send_a(ipvi, VI_EDIT, stra, lena);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_editopt(IPVIWIN *ipvi, const char *stra, u_int32_t lena, const char *strb, u_int32_t lenb, u_int32_t val1)
|
||||
{
|
||||
return vi_send_ab1(ipvi, VI_EDITOPT, stra, lena, strb, lenb, val1);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_editsplit(IPVIWIN *ipvi, const char *stra, u_int32_t lena)
|
||||
{
|
||||
return vi_send_a(ipvi, VI_EDITSPLIT, stra, lena);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_eof(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_EOF);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_err(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_ERR);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_flags(IPVIWIN *ipvi, u_int32_t val1)
|
||||
{
|
||||
return vi_send_1(ipvi, VI_FLAGS, val1);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_interrupt(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_INTERRUPT);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_mouse_move(IPVIWIN *ipvi, u_int32_t val1, u_int32_t val2)
|
||||
{
|
||||
return vi_send_12(ipvi, VI_MOUSE_MOVE, val1, val2);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
vi_quit(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_QUIT);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_resize(IPVIWIN *ipvi, u_int32_t val1, u_int32_t val2)
|
||||
{
|
||||
return vi_send_12(ipvi, VI_RESIZE, val1, val2);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
vi_sel_end(IPVIWIN *ipvi, u_int32_t val1, u_int32_t val2)
|
||||
{
|
||||
return vi_send_12(ipvi, VI_SEL_END, val1, val2);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_sel_start(IPVIWIN *ipvi, u_int32_t val1, u_int32_t val2)
|
||||
{
|
||||
return vi_send_12(ipvi, VI_SEL_START, val1, val2);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_sighup(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_SIGHUP);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_sigterm(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_SIGTERM);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
vi_string(IPVIWIN *ipvi, const char *stra, u_int32_t lena)
|
||||
{
|
||||
return vi_send_a(ipvi, VI_STRING, stra, lena);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
vi_tag(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_TAG);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_tagas(IPVIWIN *ipvi, const char *stra, u_int32_t lena)
|
||||
{
|
||||
return vi_send_a(ipvi, VI_TAGAS, stra, lena);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_tagsplit(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_TAGSPLIT);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_undo(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_UNDO);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
vi_wq(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_WQ);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
vi_write(IPVIWIN *ipvi)
|
||||
{
|
||||
return vi_send_(ipvi, VI_WRITE);
|
||||
}
|
||||
|
||||
static int
|
||||
vi_writeas(IPVIWIN *ipvi, const char *stra, u_int32_t lena)
|
||||
{
|
||||
return vi_send_a(ipvi, VI_WRITEAS, stra, lena);
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,49 @@
|
|||
/* $Id: pathnames.h,v 1.1 2013/11/22 16:00:45 christos Exp $ (Berkeley) $Date: 2013/11/22 16:00:45 $ */
|
||||
|
||||
#ifndef _PATH_BSHELL
|
||||
#define _PATH_BSHELL "/bin/sh"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_DB3
|
||||
#define _PATH_DB3 ""
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_EXRC
|
||||
#define _PATH_EXRC ".exrc"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_MSGCAT
|
||||
#define _PATH_MSGCAT "./"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_NEXRC
|
||||
#define _PATH_NEXRC ".nexrc"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_PRESERVE
|
||||
#define _PATH_PRESERVE "/var/tmp/vi.recover"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_SYSV_PTY
|
||||
#define _PATH_SYSV_PTY "/dev/ptmx"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_SENDMAIL
|
||||
#define _PATH_SENDMAIL "/usr/sbin/sendmail"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_SYSEXRC
|
||||
#define _PATH_SYSEXRC "/etc/vi.exrc"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_TAGS
|
||||
#define _PATH_TAGS "tags"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_TMP
|
||||
#define _PATH_TMP "/tmp"
|
||||
#endif
|
||||
|
||||
#ifndef _PATH_TTY
|
||||
#define _PATH_TTY "/dev/tty"
|
||||
#endif
|
|
@ -0,0 +1,199 @@
|
|||
/* $Id: port.h,v 1.1 2013/11/22 16:00:45 christos Exp $ (Berkeley) $Date: 2013/11/22 16:00:45 $ */
|
||||
|
||||
/*
|
||||
* Declare the basic types, if they aren't already declared. Named and
|
||||
* some system's db.h files protect them with __BIT_TYPES_DEFINED__.
|
||||
*/
|
||||
#ifndef __BIT_TYPES_DEFINED__
|
||||
#define __BIT_TYPES_DEFINED__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Handle function prototypes. This steps on name space that vi doesn't
|
||||
* control, but all of the other solutions are worse.
|
||||
*/
|
||||
#undef __P
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define __P(protos) protos /* ANSI C prototypes */
|
||||
#else
|
||||
#define __P(protos) () /* K&R C preprocessor */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Some versions of System V changed the number of arguments to gettimeofday
|
||||
* without changing the name.
|
||||
*/
|
||||
#ifdef HAVE_BROKEN_GETTIMEOFDAY
|
||||
#define gettimeofday(tv, tz) gettimeofday(tv)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* If we don't have mmap, we fake it with read and write, but we'll
|
||||
* still need the header information.
|
||||
*/
|
||||
#ifndef HAVE_SYS_MMAN_H
|
||||
#define MAP_SHARED 1 /* share changes */
|
||||
#define MAP_PRIVATE 2 /* changes are private */
|
||||
#define PROT_READ 0x1 /* pages can be read */
|
||||
#define PROT_WRITE 0x2 /* pages can be written */
|
||||
#define PROT_EXEC 0x4 /* pages can be executed */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 names for file descriptors.
|
||||
*/
|
||||
#ifndef STDERR_FILENO
|
||||
#define STDIN_FILENO 0 /* ANSI C #defines */
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 names for seek settings.
|
||||
*/
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_SET 0 /* POSIX 1003.1 seek values */
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_END 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hack _POSIX_VDISABLE to \377 since Ultrix doesn't honor _POSIX_VDISABLE
|
||||
* (treats it as ^@). The symptom is that the ^@ keystroke immediately
|
||||
* drops core.
|
||||
*/
|
||||
#ifdef HAVE_BROKEN_VDISABLE
|
||||
#undef _POSIX_VDISABLE
|
||||
#define _POSIX_VDISABLE ((unsigned char)'\377')
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 tty disabling character.
|
||||
*/
|
||||
#ifndef _POSIX_VDISABLE
|
||||
#define _POSIX_VDISABLE 0 /* Some systems used 0. */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* 4.4BSD extension to only set the software termios bits.
|
||||
*/
|
||||
#ifndef TCSASOFT /* 4.4BSD extension. */
|
||||
#define TCSASOFT 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 maximum path length.
|
||||
*/
|
||||
#ifndef MAXPATHLEN
|
||||
#ifdef PATH_MAX
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#else
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* MIN, MAX, historically in <sys/param.h>
|
||||
*/
|
||||
#ifndef MAX
|
||||
#define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* "DB" isn't always portable, and we want the private information.
|
||||
*/
|
||||
#define DB L__DB
|
||||
#undef pgno_t /* IRIX has its own version. */
|
||||
#define pgno_t L__db_pgno_t
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* 4.4BSD extension to provide lock values in the open(2) call.
|
||||
*/
|
||||
#ifndef O_EXLOCK
|
||||
#define O_EXLOCK 0
|
||||
#endif
|
||||
|
||||
#ifndef O_SHLOCK
|
||||
#define O_SHLOCK 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.1 bad file format errno.
|
||||
*/
|
||||
#ifndef EFTYPE
|
||||
#define EFTYPE EINVAL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* POSIX 1003.2 RE length limit.
|
||||
*/
|
||||
#ifndef _POSIX2_RE_DUP_MAX
|
||||
#define _POSIX2_RE_DUP_MAX 255
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* 4.4BSD extension to determine if a program dropped core from the exit
|
||||
* status.
|
||||
*/
|
||||
#ifndef WCOREDUMP
|
||||
#define WCOREDUMP(a) 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Endian-ness of the machine.
|
||||
*/
|
||||
#if !defined(LITTLE_ENDIAN)
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
#if !defined(BIG_ENDIAN)
|
||||
#define BIG_ENDIAN 4321
|
||||
#endif
|
||||
#if !defined(BYTE_ORDER)
|
||||
#if WORDS_BIGENDIAN == 1
|
||||
#define BYTE_ORDER BIG_ENDIAN
|
||||
#else
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MEMCPY
|
||||
#define memcpy memmove
|
||||
#endif
|
||||
|
||||
#ifdef NEED_FPRINTF_PROTO
|
||||
extern int fprintf( FILE *, const char *, ... );
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
#define VI_DB_THREAD DB_THREAD
|
||||
#else
|
||||
#define VI_DB_THREAD 0
|
||||
#endif
|
|
@ -0,0 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
|
||||
SCRIPTS = virecover
|
||||
SCRIPTSDIR = /usr/libexec
|
||||
MAN= virecover.8
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh -
|
||||
#
|
||||
# $NetBSD: virecover,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
#
|
||||
# @(#)recover.in 8.8 (Berkeley) 10/10/96
|
||||
#
|
||||
# Script to recover nvi edit sessions.
|
||||
|
||||
RECDIR="/var/tmp/vi.recover"
|
||||
SENDMAIL="/usr/sbin/sendmail"
|
||||
|
||||
# Check editor backup files.
|
||||
vibackup=`echo $RECDIR/vi.*`
|
||||
if [ "$vibackup" != "$RECDIR/vi.*" ]; then
|
||||
for i in $vibackup; do
|
||||
# Only test files that are readable.
|
||||
if test ! -f $i || test ! -r $i; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Unmodified nvi editor backup files either have the
|
||||
# execute bit set or are zero length. Delete them.
|
||||
if test -x $i -o ! -s $i; then
|
||||
rm $i
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# It is possible to get incomplete recovery files, if the editor crashes
|
||||
# at the right time.
|
||||
virecovery=`echo $RECDIR/recover.*`
|
||||
if [ "$virecovery" != "$RECDIR/recover.*" ]; then
|
||||
for i in $virecovery; do
|
||||
# Only test files that are readable.
|
||||
if test ! -r $i; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Delete any recovery files that are zero length, corrupted,
|
||||
# or that have no corresponding backup file. Else send mail
|
||||
# to the user.
|
||||
recfile=`awk '/^X-vi-recover-path:/{print $2}' < $i`
|
||||
if test -n "$recfile" -a -s "$recfile"; then
|
||||
$SENDMAIL -t < $i
|
||||
else
|
||||
rm $i
|
||||
fi
|
||||
done
|
||||
fi
|
|
@ -0,0 +1,90 @@
|
|||
.\" $NetBSD: virecover.8,v 1.1 2013/11/22 16:00:45 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" This code is derived from software contributed to The NetBSD Foundation
|
||||
.\" by Jeremy C. Reed.
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
.\"
|
||||
.Dd October 9, 2006
|
||||
.Dt VIRECOVER 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm virecover
|
||||
.Nd report recovered vi edit sessions
|
||||
.Sh SYNOPSIS
|
||||
.Pa /usr/libexec/virecover
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility sends emails to users who have
|
||||
.Xr vi 1
|
||||
recovery files.
|
||||
.Pp
|
||||
This email gives the name of the file that was
|
||||
saved for recovery and instructions for recovering
|
||||
most, if not all, of the changes to the file.
|
||||
This is done by using the
|
||||
.Fl r
|
||||
option with
|
||||
.Xr vi 1 .
|
||||
See the
|
||||
.Fl r
|
||||
option in
|
||||
.Xr vi 1
|
||||
for details.
|
||||
.Pp
|
||||
If the backup files have the execute bit set or are zero length,
|
||||
then they have not been modified, so
|
||||
.Nm
|
||||
deletes them to clean up.
|
||||
.Nm
|
||||
also removes recovery files that are corrupted, zero length,
|
||||
or do not have a corresponding backup file.
|
||||
.Pp
|
||||
.Nm
|
||||
is normally run automatically at boot time using
|
||||
.Pa /etc/rc.d/virecover .
|
||||
.Sh FILES
|
||||
.Bl -tag -width "/var/tmp/vi.recover/recover.*" -compact
|
||||
.It Pa /var/tmp/vi.recover/recover.*
|
||||
.Xr vi 1
|
||||
recovery files
|
||||
.It Pa /var/tmp/vi.recover/vi.*
|
||||
.Xr vi 1
|
||||
editor backup files
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr vi 1 ,
|
||||
.Xr rc.conf 5
|
||||
.Sh HISTORY
|
||||
This script, previously known as
|
||||
.Nm recover.script ,
|
||||
is from nvi and was added to
|
||||
.Nx
|
||||
in 1996.
|
||||
It was renamed in 2001.
|
||||
.Sh AUTHORS
|
||||
This man page was written by
|
||||
.An Jeremy C. Reed Aq Mt reed@reedmedia.net .
|
Loading…
Reference in New Issue