aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-04-10 13:26:05 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-04-10 13:26:05 +0000
commit5a709d61a37133c04bc540b7c531c49239e71145 (patch)
treec966d82948d199cb6fbe3ebf72b2838dcc15da99
parent1abe484249caf1c5e462ce3110c8db09c059c6e8 (diff)
downloadsrc-5a709d61a37133c04bc540b7c531c49239e71145.tar.gz
src-5a709d61a37133c04bc540b7c531c49239e71145.zip
Import nvi 2.1.3vendor/nvi/2.1.3
Approved by: peter
Notes
Notes: svn path=/vendor/nvi/dist/; revision=281368 svn path=/vendor/nvi/2.1.3/; revision=281370; tag=vendor/nvi/2.1.3
-rw-r--r--README4
-rw-r--r--catalog/dump.c19
-rw-r--r--catalog/spell.ok19
-rw-r--r--cl/cl.h12
-rw-r--r--cl/cl_funcs.c46
-rw-r--r--cl/cl_main.c37
-rw-r--r--cl/cl_read.c11
-rw-r--r--cl/cl_screen.c50
-rw-r--r--cl/cl_term.c27
-rw-r--r--cl/extern.h62
-rw-r--r--common/common.h4
-rw-r--r--common/conv.c538
-rw-r--r--common/cut.c14
-rw-r--r--common/delete.c2
-rw-r--r--common/encoding.c26
-rw-r--r--common/exf.c41
-rw-r--r--common/extern.h262
-rw-r--r--common/gs.h70
-rw-r--r--common/key.c28
-rw-r--r--common/line.c79
-rw-r--r--common/log.c30
-rw-r--r--common/main.c24
-rw-r--r--common/mark.c16
-rw-r--r--common/msg.c28
-rw-r--r--common/options.c42
-rw-r--r--common/options.h2
-rw-r--r--common/options_f.c30
-rw-r--r--common/put.c2
-rw-r--r--common/recover.c29
-rw-r--r--common/screen.c6
-rw-r--r--common/search.c21
-rw-r--r--common/seq.c30
-rw-r--r--common/util.c30
-rw-r--r--docs/TODO147
-rw-r--r--docs/USD.doc/edit/Makefile11
-rw-r--r--docs/USD.doc/edit/edit.vindex115
-rw-r--r--docs/USD.doc/edit/edittut.ms2280
-rw-r--r--docs/USD.doc/exref/Makefile17
-rw-r--r--docs/USD.doc/exref/ex.rm2213
-rw-r--r--docs/USD.doc/exref/ex.summary730
-rw-r--r--docs/USD.doc/vi.man/spell.ok179
-rw-r--r--docs/USD.doc/vi.ref/Makefile32
-rw-r--r--docs/USD.doc/vi.ref/ex.cmd.roff1924
-rw-r--r--docs/USD.doc/vi.ref/index.so260
-rw-r--r--docs/USD.doc/vi.ref/merge.awk16
-rw-r--r--docs/USD.doc/vi.ref/ref.so103
-rw-r--r--docs/USD.doc/vi.ref/set.opt.roff1303
-rw-r--r--docs/USD.doc/vi.ref/spell.ok414
-rw-r--r--docs/USD.doc/vi.ref/vi.cmd.roff3085
-rw-r--r--docs/USD.doc/vi.ref/vi.ref1840
-rw-r--r--docs/USD.doc/vitut/Makefile22
-rw-r--r--docs/USD.doc/vitut/vi.apwh.ms1081
-rw-r--r--docs/USD.doc/vitut/vi.chars645
-rw-r--r--docs/USD.doc/vitut/vi.in2074
-rw-r--r--docs/USD.doc/vitut/vi.summary468
-rw-r--r--docs/changelog1102
-rw-r--r--docs/ev55
-rw-r--r--docs/features83
-rw-r--r--docs/help229
-rw-r--r--docs/internals/autowrite88
-rw-r--r--docs/internals/context32
-rw-r--r--docs/internals/cscope.NOTES142
-rw-r--r--docs/internals/gdb.script76
-rw-r--r--docs/internals/input350
-rw-r--r--docs/internals/openmode36
-rw-r--r--docs/internals/quoting208
-rw-r--r--docs/internals/structures68
-rw-r--r--docs/interp/interp190
-rw-r--r--docs/interp/spell.ok46
-rw-r--r--docs/man/Makefile (renamed from docs/USD.doc/vi.man/Makefile)0
-rw-r--r--docs/man/vi.1 (renamed from docs/USD.doc/vi.man/vi.1)68
-rw-r--r--docs/spell.ok173
-rw-r--r--docs/tutorial/vi.advanced1458
-rw-r--r--docs/tutorial/vi.beginner741
-rwxr-xr-xdocs/tutorial/vi.tut.csh24
-rw-r--r--ex/ex.c30
-rw-r--r--ex/ex.h4
-rw-r--r--ex/ex_abbrev.c4
-rw-r--r--ex/ex_append.c8
-rw-r--r--ex/ex_args.c12
-rw-r--r--ex/ex_argv.c32
-rw-r--r--ex/ex_at.c2
-rw-r--r--ex/ex_bang.c2
-rw-r--r--ex/ex_cd.c2
-rw-r--r--ex/ex_cscope.c44
-rw-r--r--ex/ex_delete.c2
-rw-r--r--ex/ex_display.c8
-rw-r--r--ex/ex_edit.c4
-rw-r--r--ex/ex_equal.c2
-rw-r--r--ex/ex_file.c2
-rw-r--r--ex/ex_filter.c6
-rw-r--r--ex/ex_global.c8
-rw-r--r--ex/ex_init.c14
-rw-r--r--ex/ex_join.c6
-rw-r--r--ex/ex_map.c4
-rw-r--r--ex/ex_mark.c2
-rw-r--r--ex/ex_mkexrc.c2
-rw-r--r--ex/ex_move.c4
-rw-r--r--ex/ex_open.c2
-rw-r--r--ex/ex_preserve.c4
-rw-r--r--ex/ex_print.c22
-rw-r--r--ex/ex_put.c2
-rw-r--r--ex/ex_quit.c2
-rw-r--r--ex/ex_read.c4
-rw-r--r--ex/ex_screen.c8
-rw-r--r--ex/ex_script.c20
-rw-r--r--ex/ex_set.c2
-rw-r--r--ex/ex_shell.c8
-rw-r--r--ex/ex_shift.c6
-rw-r--r--ex/ex_source.c2
-rw-r--r--ex/ex_stop.c2
-rw-r--r--ex/ex_subst.c26
-rw-r--r--ex/ex_tag.c60
-rw-r--r--ex/ex_txt.c6
-rw-r--r--ex/ex_undo.c2
-rw-r--r--ex/ex_usage.c6
-rw-r--r--ex/ex_util.c12
-rw-r--r--ex/ex_version.c2
-rw-r--r--ex/ex_visual.c2
-rw-r--r--ex/ex_write.c57
-rw-r--r--ex/ex_yank.c2
-rw-r--r--ex/ex_z.c6
-rw-r--r--ex/extern.h258
-rw-r--r--ex/version.h2
-rw-r--r--regex/COPYRIGHT6
-rw-r--r--regex/cclass.h6
-rw-r--r--regex/cname.h6
-rw-r--r--regex/engine.c248
-rw-r--r--regex/re_format.76
-rw-r--r--regex/regcomp.c498
-rw-r--r--regex/regerror.c25
-rw-r--r--regex/regex.36
-rw-r--r--regex/regex.h16
-rw-r--r--regex/regex2.h6
-rw-r--r--regex/regexec.c15
-rw-r--r--regex/regfree.c9
-rw-r--r--regex/utils.h6
-rw-r--r--vi/extern.h290
-rw-r--r--vi/getc.c12
-rw-r--r--vi/v_at.c2
-rw-r--r--vi/v_ch.c16
-rw-r--r--vi/v_delete.c2
-rw-r--r--vi/v_ex.c34
-rw-r--r--vi/v_increment.c4
-rw-r--r--vi/v_init.c6
-rw-r--r--vi/v_itxt.c22
-rw-r--r--vi/v_left.c10
-rw-r--r--vi/v_mark.c25
-rw-r--r--vi/v_match.c6
-rw-r--r--vi/v_paragraph.c6
-rw-r--r--vi/v_put.c6
-rw-r--r--vi/v_redraw.c2
-rw-r--r--vi/v_replace.c2
-rw-r--r--vi/v_right.c4
-rw-r--r--vi/v_screen.c2
-rw-r--r--vi/v_scroll.c28
-rw-r--r--vi/v_search.c16
-rw-r--r--vi/v_section.c4
-rw-r--r--vi/v_sentence.c4
-rw-r--r--vi/v_status.c2
-rw-r--r--vi/v_txt.c46
-rw-r--r--vi/v_ulcase.c6
-rw-r--r--vi/v_undo.c4
-rw-r--r--vi/v_util.c14
-rw-r--r--vi/v_word.c18
-rw-r--r--vi/v_xchar.c4
-rw-r--r--vi/v_yank.c2
-rw-r--r--vi/v_z.c4
-rw-r--r--vi/v_zexit.c2
-rw-r--r--vi/vi.c21
-rw-r--r--vi/vi.h14
-rw-r--r--vi/vs_line.c4
-rw-r--r--vi/vs_msg.c22
-rw-r--r--vi/vs_refresh.c12
-rw-r--r--vi/vs_relative.c10
-rw-r--r--vi/vs_smap.c36
-rw-r--r--vi/vs_split.c26
177 files changed, 1844 insertions, 26257 deletions
diff --git a/README b/README
index c129439d38d0..26fcc167fc6f 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
-# $Id: README,v 9.1 2013/11/02 02:50:23 zy Exp $
+# $Id: README,v 9.2 2015/04/08 17:18:56 zy Exp $
-This is version 2.1.2 (2012-11-02) of nex/nvi, a reimplementation of the ex/vi
+This is version 2.1.3 (2015-04-08) of nex/nvi, a reimplementation of the ex/vi
text editors originally distributed as part of the Fourth Berkeley
Software Distribution (4BSD), by the University of California, Berkeley.
diff --git a/catalog/dump.c b/catalog/dump.c
index 13ffb8bb422a..585a6d908e41 100644
--- a/catalog/dump.c
+++ b/catalog/dump.c
@@ -10,11 +10,7 @@
* 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 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.
*
@@ -32,12 +28,6 @@
*/
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1992, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
static char sccsid[] = "$Id: dump.c,v 8.2 2011/07/14 00:05:25 zy Exp $";
#endif /* not lint */
@@ -45,8 +35,7 @@ static char sccsid[] = "$Id: dump.c,v 8.2 2011/07/14 00:05:25 zy Exp $";
#include <stdio.h>
static void
-parse(fp)
- FILE *fp;
+parse(FILE *fp)
{
int ch, s1, s2, s3;
@@ -96,9 +85,7 @@ parse(fp)
}
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
FILE *fp;
diff --git a/catalog/spell.ok b/catalog/spell.ok
deleted file mode 100644
index 00be47141879..000000000000
--- a/catalog/spell.ok
+++ /dev/null
@@ -1,19 +0,0 @@
-ARGMAX
-LC
-NL
-XXXX
-arg1
-arg2
-chys
-english
-english.base
-german.base
-langauge
-msg
-msg.c
-msgcat
-msgq
-nvi
-nvi's
-pathname
-sp
diff --git a/cl/cl.h b/cl/cl.h
index c84ef88428c0..cca0acb8eba7 100644
--- a/cl/cl.h
+++ b/cl/cl.h
@@ -80,16 +80,4 @@ typedef enum { INP_OK=0, INP_EOF, INP_ERR, INP_INTR, INP_TIMEOUT } input_t;
#define RCNO(sp, cno) (cno)
#define RLNO(sp, lno) (lno)
-/*
- * XXX
- * Some implementations of curses.h don't define these for us. Used for
- * compatibility only.
- */
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
#include "extern.h"
diff --git a/cl/cl_funcs.c b/cl/cl_funcs.c
index 8b14e8da747d..4c15458456ad 100644
--- a/cl/cl_funcs.c
+++ b/cl/cl_funcs.c
@@ -33,7 +33,7 @@ static const char sccsid[] = "$Id: cl_funcs.c,v 10.74 2012/10/11 10:30:16 zy Exp
#include "../vi/vi.h"
#include "cl.h"
-static void cl_rdiv __P((SCR *));
+static void cl_rdiv(SCR *);
static int
addstr4(SCR *sp, void *str, size_t len, int wide)
@@ -76,31 +76,31 @@ addstr4(SCR *sp, void *str, size_t len, int wide)
* cl_waddstr --
* Add len bytes from the string at the cursor, advancing the cursor.
*
- * PUBLIC: int cl_waddstr __P((SCR *, const CHAR_T *, size_t));
+ * PUBLIC: int cl_waddstr(SCR *, const CHAR_T *, size_t);
*/
int
cl_waddstr(SCR *sp, const CHAR_T *str, size_t len)
{
- return addstr4(sp, (void *)str, len, 1);
+ return addstr4(sp, (void *)str, len, 1);
}
/*
* cl_addstr --
* Add len bytes from the string at the cursor, advancing the cursor.
*
- * PUBLIC: int cl_addstr __P((SCR *, const char *, size_t));
+ * PUBLIC: int cl_addstr(SCR *, const char *, size_t);
*/
int
cl_addstr(SCR *sp, const char *str, size_t len)
{
- return addstr4(sp, (void *)str, len, 0);
+ return addstr4(sp, (void *)str, len, 0);
}
/*
* cl_attr --
* Toggle a screen attribute on/off.
*
- * PUBLIC: int cl_attr __P((SCR *, scr_attr_t, int));
+ * PUBLIC: int cl_attr(SCR *, scr_attr_t, int);
*/
int
cl_attr(SCR *sp, scr_attr_t attribute, int on)
@@ -187,7 +187,7 @@ cl_attr(SCR *sp, scr_attr_t attribute, int on)
* cl_baud --
* Return the baud rate.
*
- * PUBLIC: int cl_baud __P((SCR *, u_long *));
+ * PUBLIC: int cl_baud(SCR *, u_long *);
*/
int
cl_baud(SCR *sp, u_long *ratep)
@@ -228,7 +228,7 @@ cl_baud(SCR *sp, u_long *ratep)
* cl_bell --
* Ring the bell/flash the screen.
*
- * PUBLIC: int cl_bell __P((SCR *));
+ * PUBLIC: int cl_bell(SCR *);
*/
int
cl_bell(SCR *sp)
@@ -252,7 +252,7 @@ cl_bell(SCR *sp)
* cl_clrtoeol --
* Clear from the current cursor to the end of the line.
*
- * PUBLIC: int cl_clrtoeol __P((SCR *));
+ * PUBLIC: int cl_clrtoeol(SCR *);
*/
int
cl_clrtoeol(SCR *sp)
@@ -281,7 +281,7 @@ cl_clrtoeol(SCR *sp)
* cl_cursor --
* Return the current cursor position.
*
- * PUBLIC: int cl_cursor __P((SCR *, size_t *, size_t *));
+ * PUBLIC: int cl_cursor(SCR *, size_t *, size_t *);
*/
int
cl_cursor(SCR *sp, size_t *yp, size_t *xp)
@@ -307,7 +307,7 @@ cl_cursor(SCR *sp, size_t *yp, size_t *xp)
* cl_deleteln --
* Delete the current line, scrolling all lines below it.
*
- * PUBLIC: int cl_deleteln __P((SCR *));
+ * PUBLIC: int cl_deleteln(SCR *);
*/
int
cl_deleteln(SCR *sp)
@@ -344,7 +344,7 @@ cl_deleteln(SCR *sp)
* cl_discard --
* Discard a screen.
*
- * PUBLIC: int cl_discard __P((SCR *, SCR **));
+ * PUBLIC: int cl_discard(SCR *, SCR **);
*/
int
cl_discard(SCR *discardp, SCR **acquirep)
@@ -385,7 +385,7 @@ cl_discard(SCR *discardp, SCR **acquirep)
* Adjust the screen for ex. This routine is purely for standalone
* ex programs. All special purpose, all special case.
*
- * PUBLIC: int cl_ex_adjust __P((SCR *, exadj_t));
+ * PUBLIC: int cl_ex_adjust(SCR *, exadj_t);
*/
int
cl_ex_adjust(SCR *sp, exadj_t action)
@@ -440,7 +440,7 @@ cl_ex_adjust(SCR *sp, exadj_t action)
* cl_insertln --
* Push down the current line, discarding the bottom line.
*
- * PUBLIC: int cl_insertln __P((SCR *));
+ * PUBLIC: int cl_insertln(SCR *);
*/
int
cl_insertln(SCR *sp)
@@ -458,7 +458,7 @@ cl_insertln(SCR *sp)
* cl_keyval --
* Return the value for a special key.
*
- * PUBLIC: int cl_keyval __P((SCR *, scr_keyval_t, CHAR_T *, int *));
+ * PUBLIC: int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *);
*/
int
cl_keyval(SCR *sp, scr_keyval_t val, CHAR_T *chp, int *dnep)
@@ -496,7 +496,7 @@ cl_keyval(SCR *sp, scr_keyval_t val, CHAR_T *chp, int *dnep)
* cl_move --
* Move the cursor.
*
- * PUBLIC: int cl_move __P((SCR *, size_t, size_t));
+ * PUBLIC: int cl_move(SCR *, size_t, size_t);
*/
int
cl_move(SCR *sp, size_t lno, size_t cno)
@@ -516,7 +516,7 @@ cl_move(SCR *sp, size_t lno, size_t cno)
* cl_refresh --
* Refresh the screen.
*
- * PUBLIC: int cl_refresh __P((SCR *, int));
+ * PUBLIC: int cl_refresh(SCR *, int);
*/
int
cl_refresh(SCR *sp, int repaint)
@@ -599,7 +599,7 @@ cl_rdiv(SCR *sp)
* cl_rename --
* Rename the file.
*
- * PUBLIC: int cl_rename __P((SCR *, char *, int));
+ * PUBLIC: int cl_rename(SCR *, char *, int);
*/
int
cl_rename(SCR *sp, char *name, int on)
@@ -621,7 +621,7 @@ cl_rename(SCR *sp, char *name, int on)
if (on) {
clp->focus = sp;
if (!F_ISSET(clp, CL_RENAME_OK) ||
- strncmp(OG_STR(gp, GO_TERM), "xterm", 5))
+ strncmp(OG_STR(gp, GO_TERM), "xterm", 5))
return (0);
if (clp->oname == NULL && (wid = getenv("WINDOWID"))) {
@@ -654,7 +654,7 @@ rename: cl_setname(gp, name);
* cl_setname --
* Set a X11 icon/window name.
*
- * PUBLIC: void cl_setname __P((GS *, char *));
+ * PUBLIC: void cl_setname(GS *, char *);
*/
void
cl_setname(GS *gp, char *name)
@@ -671,7 +671,7 @@ cl_setname(GS *gp, char *name)
* cl_split --
* Split a screen.
*
- * PUBLIC: int cl_split __P((SCR *, SCR *));
+ * PUBLIC: int cl_split(SCR *, SCR *);
*/
int
cl_split(SCR *origp, SCR *newp)
@@ -697,7 +697,7 @@ cl_split(SCR *origp, SCR *newp)
* cl_suspend --
* Suspend a screen.
*
- * PUBLIC: int cl_suspend __P((SCR *, int *));
+ * PUBLIC: int cl_suspend(SCR *, int *);
*/
int
cl_suspend(SCR *sp, int *allowedp)
@@ -825,7 +825,7 @@ cl_suspend(SCR *sp, int *allowedp)
* cl_usage --
* Print out the curses usage messages.
*
- * PUBLIC: void cl_usage __P((void));
+ * PUBLIC: void cl_usage(void);
*/
void
cl_usage(void)
diff --git a/cl/cl_main.c b/cl/cl_main.c
index 98f13136a061..42c3c82b84f1 100644
--- a/cl/cl_main.c
+++ b/cl/cl_main.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: cl_main.c,v 10.55 2011/08/15 19:52:28 zy Exp $";
+static const char sccsid[] = "$Id: cl_main.c,v 10.56 2015/04/05 06:20:53 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -36,20 +36,20 @@ static const char sccsid[] = "$Id: cl_main.c,v 10.55 2011/08/15 19:52:28 zy Exp
GS *__global_list; /* GLOBAL: List of screens. */
sigset_t __sigblockset; /* GLOBAL: Blocked signals. */
-static void cl_func_std __P((GS *));
-static CL_PRIVATE *cl_init __P((GS *));
-static GS *gs_init __P((char *));
-static void perr __P((char *, char *));
-static int setsig __P((int, struct sigaction *, void (*)(int)));
-static void sig_end __P((GS *));
-static void term_init __P((char *, char *));
+static void cl_func_std(GS *);
+static CL_PRIVATE *cl_init(GS *);
+static GS *gs_init(char *);
+static void perr(char *, char *);
+static int setsig(int, struct sigaction *, void (*)(int));
+static void sig_end(GS *);
+static void term_init(char *, char *);
/*
* main --
* This is the main loop for the standalone curses editor.
*/
int
-main(int argc, char **argv)
+main(int argc, char *argv[])
{
static int reenter;
CL_PRIVATE *clp;
@@ -92,7 +92,7 @@ main(int argc, char **argv)
* have to use termcap/terminfo to find out how big the screen is.
*/
if ((ttype = getenv("TERM")) == NULL)
- ttype = "unknown";
+ ttype = "ansi";
term_init(gp->progname, ttype);
/* Add the terminal type to the global structure. */
@@ -146,7 +146,7 @@ main(int argc, char **argv)
}
/* Free the global and CL private areas. */
-#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
+#if defined(DEBUG) || defined(PURIFY)
if (clp->oname != NULL)
free(clp->oname);
free(clp);
@@ -292,7 +292,7 @@ h_winch(int signo)
* sig_init --
* Initialize signals.
*
- * PUBLIC: int sig_init __P((GS *, SCR *));
+ * PUBLIC: int sig_init(GS *, SCR *);
*/
int
sig_init(GS *gp, SCR *sp)
@@ -337,7 +337,7 @@ sig_init(GS *gp, SCR *sp)
* Set a signal handler.
*/
static int
-setsig(int signo, struct sigaction *oactp, void (*handler) (int))
+setsig(int signo, struct sigaction *oactp, void (*handler)(int))
{
struct sigaction act;
@@ -345,21 +345,12 @@ setsig(int signo, struct sigaction *oactp, void (*handler) (int))
* Use sigaction(2), not signal(3), since we don't always want to
* restart system calls. The example is when waiting for a command
* mode keystroke and SIGWINCH arrives. Besides, you can't portably
- * restart system calls (thanks, POSIX!). On the other hand, you
- * can't portably NOT restart system calls (thanks, Sun!). SunOS
- * used SA_INTERRUPT as their extension to NOT restart read calls.
- * We sure hope nobody else used it for anything else. Mom told me
- * there'd be days like this. She just never told me that there'd
- * be so many.
+ * restart system calls (thanks, POSIX!).
*/
act.sa_handler = handler;
sigemptyset(&act.sa_mask);
-#ifdef SA_INTERRUPT
- act.sa_flags = SA_INTERRUPT;
-#else
act.sa_flags = 0;
-#endif
return (sigaction(signo, &act, oactp));
}
diff --git a/cl/cl_read.c b/cl/cl_read.c
index 410cdd4318cc..3d9064c56002 100644
--- a/cl/cl_read.c
+++ b/cl/cl_read.c
@@ -35,15 +35,15 @@ static const char sccsid[] = "$Id: cl_read.c,v 10.30 2012/07/12 18:28:58 zy Exp
#undef columns
#undef lines
-static input_t cl_read __P((SCR *,
- u_int32_t, char *, size_t, int *, struct timeval *));
-static int cl_resize __P((SCR *, size_t, size_t));
+static input_t cl_read(SCR *,
+ u_int32_t, char *, size_t, int *, struct timeval *);
+static int cl_resize(SCR *, size_t, size_t);
/*
* cl_event --
* Return a single event.
*
- * PUBLIC: int cl_event __P((SCR *, EVENT *, u_int32_t, int));
+ * PUBLIC: int cl_event(SCR *, EVENT *, u_int32_t, int);
*/
int
cl_event(SCR *sp, EVENT *evp, u_int32_t flags, int ms)
@@ -143,7 +143,8 @@ read:
* Read characters from the input.
*/
static input_t
-cl_read(SCR *sp, u_int32_t flags, char *bp, size_t blen, int *nrp, struct timeval *tp)
+cl_read(SCR *sp, u_int32_t flags, char *bp, size_t blen, int *nrp,
+ struct timeval *tp)
{
struct termios term1, term2;
CL_PRIVATE *clp;
diff --git a/cl/cl_screen.c b/cl/cl_screen.c
index 91ff2789961e..16c87725487d 100644
--- a/cl/cl_screen.c
+++ b/cl/cl_screen.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp $";
+static const char sccsid[] = "$Id: cl_screen.c,v 10.58 2015/04/08 02:12:11 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -32,18 +32,18 @@ static const char sccsid[] = "$Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo
#include "../common/common.h"
#include "cl.h"
-static int cl_ex_end __P((GS *));
-static int cl_ex_init __P((SCR *));
-static void cl_freecap __P((CL_PRIVATE *));
-static int cl_vi_end __P((GS *));
-static int cl_vi_init __P((SCR *));
-static int cl_putenv __P((char *, char *, u_long));
+static int cl_ex_end(GS *);
+static int cl_ex_init(SCR *);
+static void cl_freecap(CL_PRIVATE *);
+static int cl_vi_end(GS *);
+static int cl_vi_init(SCR *);
+static int cl_putenv(char *, char *, u_long);
/*
* cl_screen --
* Switch screen types.
*
- * PUBLIC: int cl_screen __P((SCR *, u_int32_t));
+ * PUBLIC: int cl_screen(SCR *, u_int32_t);
*/
int
cl_screen(SCR *sp, u_int32_t flags)
@@ -58,11 +58,9 @@ cl_screen(SCR *sp, u_int32_t flags)
/* See if the current information is incorrect. */
if (F_ISSET(gp, G_SRESTART)) {
- if (CLSP(sp)) {
- delwin(CLSP(sp));
- sp->cl_private = NULL;
- }
- if (cl_quit(gp))
+ if ((!F_ISSET(sp, SC_SCR_EX | SC_SCR_VI) ||
+ resizeterm(O_VAL(sp, O_LINES), O_VAL(sp, O_COLUMNS))) &&
+ cl_quit(gp))
return (1);
F_CLR(gp, G_SRESTART);
}
@@ -131,7 +129,7 @@ cl_screen(SCR *sp, u_int32_t flags)
* cl_quit --
* Shutdown the screens.
*
- * PUBLIC: int cl_quit __P((GS *));
+ * PUBLIC: int cl_quit(GS *);
*/
int
cl_quit(GS *gp)
@@ -234,20 +232,15 @@ cl_vi_init(SCR *sp)
cl_putenv("COLUMNS", NULL, (u_long)O_VAL(sp, O_COLUMNS));
/*
- * We don't care about the SCREEN reference returned by newterm, we
- * never have more than one SCREEN at a time.
- *
- * XXX
- * The SunOS initscr() can't be called twice. Don't even think about
- * using it. It fails in subtle ways (e.g. select(2) on fileno(stdin)
- * stops working). (The SVID notes that applications should only call
- * initscr() once.)
- *
- * XXX
- * The HP/UX newterm doesn't support the NULL first argument, so we
- * have to specify the terminal type.
+ * The terminal is aways initialized, either in `main`, or by a
+ * previous call to newterm(3X).
*/
(void)del_curterm(cur_term);
+
+ /*
+ * We never have more than one SCREEN at a time, so set_term(NULL) will
+ * give us the last SCREEN.
+ */
errno = 0;
if (newterm(ttype, stdout, stdin) == NULL) {
if (errno)
@@ -416,6 +409,9 @@ cl_vi_end(GS *gp)
/* End curses window. */
(void)endwin();
+ /* Free the SCREEN created by newterm(3X). */
+ delscreen(set_term(NULL));
+
/*
* XXX
* The screen TE sequence just got sent. See the comment in
@@ -520,7 +516,7 @@ cl_ex_end(GS *gp)
* cl_getcap --
* Retrieve termcap/terminfo strings.
*
- * PUBLIC: int cl_getcap __P((SCR *, char *, char **));
+ * PUBLIC: int cl_getcap(SCR *, char *, char **);
*/
int
cl_getcap(SCR *sp, char *name, char **elementp)
diff --git a/cl/cl_term.c b/cl/cl_term.c
index 7e8f6c7735a2..d4b1efc8fe84 100644
--- a/cl/cl_term.c
+++ b/cl/cl_term.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: cl_term.c,v 10.34 2013/12/07 16:21:14 wjenkner Exp $";
+static const char sccsid[] = "$Id: cl_term.c,v 10.35 2015/04/08 02:12:11 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -34,7 +34,7 @@ static const char sccsid[] = "$Id: cl_term.c,v 10.34 2013/12/07 16:21:14 wjenkne
#include "../common/common.h"
#include "cl.h"
-static int cl_pfmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
+static int cl_pfmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
/*
* XXX
@@ -81,7 +81,7 @@ static TKLIST const m2_tklist[] = { /* Input mappings (set or delete). */
* cl_term_init --
* Initialize the special keys defined by the termcap/terminfo entry.
*
- * PUBLIC: int cl_term_init __P((SCR *));
+ * PUBLIC: int cl_term_init(SCR *);
*/
int
cl_term_init(SCR *sp)
@@ -182,7 +182,7 @@ cl_term_init(SCR *sp)
* cl_term_end --
* End the special keys defined by the termcap/terminfo entry.
*
- * PUBLIC: int cl_term_end __P((GS *));
+ * PUBLIC: int cl_term_end(GS *);
*/
int
cl_term_end(GS *gp)
@@ -206,7 +206,7 @@ cl_term_end(GS *gp)
* cl_fmap --
* Map a function key.
*
- * PUBLIC: int cl_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
+ * PUBLIC: int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
*/
int
cl_fmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to, size_t tlen)
@@ -258,7 +258,7 @@ cl_pfmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to, size_t tle
* cl_optchange --
* Curses screen specific "option changed" routine.
*
- * PUBLIC: int cl_optchange __P((SCR *, int, char *, u_long *));
+ * PUBLIC: int cl_optchange(SCR *, int, char *, u_long *);
*/
int
cl_optchange(SCR *sp, int opt, char *str, u_long *valp)
@@ -268,15 +268,16 @@ cl_optchange(SCR *sp, int opt, char *str, u_long *valp)
clp = CLP(sp);
switch (opt) {
+ case O_TERM:
+ F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
+ /* FALLTHROUGH */
case O_COLUMNS:
case O_LINES:
- case O_TERM:
/*
- * Changing the columns, lines or terminal require that
- * we restart the screen.
+ * Changing the terminal type requires that we reinitialize
+ * curses, while resizing does not.
*/
F_SET(sp->gp, G_SRESTART);
- F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
break;
case O_MESG:
(void)cl_omesg(sp, clp, *valp);
@@ -305,7 +306,7 @@ cl_optchange(SCR *sp, int opt, char *str, u_long *valp)
* cl_omesg --
* Turn the tty write permission on or off.
*
- * PUBLIC: int cl_omesg __P((SCR *, CL_PRIVATE *, int));
+ * PUBLIC: int cl_omesg(SCR *, CL_PRIVATE *, int);
*/
int
cl_omesg(SCR *sp, CL_PRIVATE *clp, int on)
@@ -351,7 +352,7 @@ cl_omesg(SCR *sp, CL_PRIVATE *clp, int on)
* cl_ssize --
* Return the terminal size.
*
- * PUBLIC: int cl_ssize __P((SCR *, int, size_t *, size_t *, int *));
+ * PUBLIC: int cl_ssize(SCR *, int, size_t *, size_t *, int *);
*/
int
cl_ssize(SCR *sp, int sigwinch, size_t *rowp, size_t *colp, int *changedp)
@@ -467,7 +468,7 @@ noterm: if (row == 0)
* cl_putchar --
* Function version of putchar, for tputs.
*
- * PUBLIC: int cl_putchar __P((int));
+ * PUBLIC: int cl_putchar(int);
*/
int
cl_putchar(int ch)
diff --git a/cl/extern.h b/cl/extern.h
index 626f4fbea167..7b01ccd3f8cf 100644
--- a/cl/extern.h
+++ b/cl/extern.h
@@ -1,31 +1,31 @@
-int cl_waddstr __P((SCR *, const CHAR_T *, size_t));
-int cl_addstr __P((SCR *, const char *, size_t));
-int cl_attr __P((SCR *, scr_attr_t, int));
-int cl_baud __P((SCR *, u_long *));
-int cl_bell __P((SCR *));
-int cl_clrtoeol __P((SCR *));
-int cl_cursor __P((SCR *, size_t *, size_t *));
-int cl_deleteln __P((SCR *));
-int cl_discard __P((SCR *, SCR **));
-int cl_ex_adjust __P((SCR *, exadj_t));
-int cl_insertln __P((SCR *));
-int cl_keyval __P((SCR *, scr_keyval_t, CHAR_T *, int *));
-int cl_move __P((SCR *, size_t, size_t));
-int cl_refresh __P((SCR *, int));
-int cl_rename __P((SCR *, char *, int));
-void cl_setname __P((GS *, char *));
-int cl_split __P((SCR *, SCR *));
-int cl_suspend __P((SCR *, int *));
-void cl_usage __P((void));
-int sig_init __P((GS *, SCR *));
-int cl_event __P((SCR *, EVENT *, u_int32_t, int));
-int cl_screen __P((SCR *, u_int32_t));
-int cl_quit __P((GS *));
-int cl_getcap __P((SCR *, char *, char **));
-int cl_term_init __P((SCR *));
-int cl_term_end __P((GS *));
-int cl_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
-int cl_optchange __P((SCR *, int, char *, u_long *));
-int cl_omesg __P((SCR *, CL_PRIVATE *, int));
-int cl_ssize __P((SCR *, int, size_t *, size_t *, int *));
-int cl_putchar __P((int));
+int cl_waddstr(SCR *, const CHAR_T *, size_t);
+int cl_addstr(SCR *, const char *, size_t);
+int cl_attr(SCR *, scr_attr_t, int);
+int cl_baud(SCR *, u_long *);
+int cl_bell(SCR *);
+int cl_clrtoeol(SCR *);
+int cl_cursor(SCR *, size_t *, size_t *);
+int cl_deleteln(SCR *);
+int cl_discard(SCR *, SCR **);
+int cl_ex_adjust(SCR *, exadj_t);
+int cl_insertln(SCR *);
+int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *);
+int cl_move(SCR *, size_t, size_t);
+int cl_refresh(SCR *, int);
+int cl_rename(SCR *, char *, int);
+void cl_setname(GS *, char *);
+int cl_split(SCR *, SCR *);
+int cl_suspend(SCR *, int *);
+void cl_usage(void);
+int sig_init(GS *, SCR *);
+int cl_event(SCR *, EVENT *, u_int32_t, int);
+int cl_screen(SCR *, u_int32_t);
+int cl_quit(GS *);
+int cl_getcap(SCR *, char *, char **);
+int cl_term_init(SCR *);
+int cl_term_end(GS *);
+int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
+int cl_optchange(SCR *, int, char *, u_long *);
+int cl_omesg(SCR *, CL_PRIVATE *, int);
+int cl_ssize(SCR *, int, size_t *, size_t *, int *);
+int cl_putchar(int);
diff --git a/common/common.h b/common/common.h
index 71f4c7fb69cb..c64adb51d6b4 100644
--- a/common/common.h
+++ b/common/common.h
@@ -23,8 +23,8 @@
*/
typedef struct _cb CB;
typedef struct _csc CSC;
-typedef struct _conv CONV;
-typedef struct _conv_win CONVWIN;
+typedef struct _conv CONV;
+typedef struct _conv_win CONVWIN;
typedef struct _event EVENT;
typedef struct _excmd EXCMD;
typedef struct _exf EXF;
diff --git a/common/conv.c b/common/conv.c
index 7803cec9922e..aaa7af37e548 100644
--- a/common/conv.c
+++ b/common/conv.c
@@ -12,7 +12,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: conv.c,v 2.39 2013/07/01 23:28:13 zy Exp $";
+static const char sccsid[] = "$Id: conv.c,v 2.40 2014/02/27 16:25:29 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -36,35 +36,37 @@ static const char sccsid[] = "$Id: conv.c,v 2.39 2013/07/01 23:28:13 zy Exp $";
* codeset --
* Get the locale encoding.
*
- * PUBLIC: char * codeset __P((void));
+ * PUBLIC: char * codeset(void);
*/
char *
-codeset(void) {
- static char *cs;
+codeset(void)
+{
+ static char *cs;
+
+ if (cs == NULL)
+ cs = nl_langinfo(CODESET);
- if (cs == NULL)
- cs = nl_langinfo(CODESET);
- return cs;
+ return cs;
}
#ifdef USE_WIDECHAR
static int
-raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst)
+raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ CHAR_T **dst)
{
- int i;
- CHAR_T **tostr = &cw->bp1.wc;
- size_t *blen = &cw->blen1;
+ int i;
+ CHAR_T **tostr = &cw->bp1.wc;
+ size_t *blen = &cw->blen1;
- BINC_RETW(NULL, *tostr, *blen, len);
+ BINC_RETW(NULL, *tostr, *blen, len);
- *tolen = len;
- for (i = 0; i < len; ++i)
- (*tostr)[i] = (u_char) str[i];
+ *tolen = len;
+ for (i = 0; i < len; ++i)
+ (*tostr)[i] = (u_char) str[i];
- *dst = cw->bp1.wc;
+ *dst = cw->bp1.wc;
- return 0;
+ return 0;
}
#define CONV_BUFFER_SIZE 512
@@ -73,27 +75,27 @@ raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
* len contains the number of bytes put in the buffer
*/
#ifdef USE_ICONV
-#define CONVERT(str, left, src, len) \
- do { \
- size_t outleft; \
- char *bp = buffer; \
- outleft = CONV_BUFFER_SIZE; \
- errno = 0; \
- if (iconv(id, (iconv_src_t)&str, &left, &bp, &outleft) == -1 && \
- errno != E2BIG) \
- goto err; \
- if ((len = CONV_BUFFER_SIZE - outleft) == 0) { \
- error = -left; \
- goto err; \
- } \
- src = buffer; \
- } while (0)
+#define CONVERT(str, left, src, len) \
+ do { \
+ size_t outleft; \
+ char *bp = buffer; \
+ outleft = CONV_BUFFER_SIZE; \
+ errno = 0; \
+ if (iconv(id, (iconv_src_t)&str, &left, &bp, &outleft) \
+ == -1 && errno != E2BIG) \
+ goto err; \
+ if ((len = CONV_BUFFER_SIZE - outleft) == 0) { \
+ error = -left; \
+ goto err; \
+ } \
+ src = buffer; \
+ } while (0)
#define IC_RESET() \
- do { \
- if (id != (iconv_t)-1) \
- iconv(id, NULL, NULL, NULL, NULL); \
- } while(0)
+ do { \
+ if (id != (iconv_t)-1) \
+ iconv(id, NULL, NULL, NULL, NULL); \
+ } while(0)
#else
#define CONVERT(str, left, src, len)
#define IC_RESET()
@@ -101,114 +103,116 @@ raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
static int
default_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst, iconv_t id)
+ size_t *tolen, CHAR_T **dst, iconv_t id)
{
- size_t i = 0, j;
- CHAR_T **tostr = &cw->bp1.wc;
- size_t *blen = &cw->blen1;
- mbstate_t mbs;
- size_t n;
- ssize_t nlen = len;
- char *src = (char *)str;
+ size_t i = 0, j;
+ CHAR_T **tostr = &cw->bp1.wc;
+ size_t *blen = &cw->blen1;
+ mbstate_t mbs;
+ size_t n;
+ ssize_t nlen = len;
+ char *src = (char *)str;
#ifdef USE_ICONV
- char buffer[CONV_BUFFER_SIZE];
+ char buffer[CONV_BUFFER_SIZE];
#endif
- size_t left = len;
- int error = 1;
+ size_t left = len;
+ int error = 1;
- BZERO(&mbs, 1);
- BINC_RETW(NULL, *tostr, *blen, nlen);
+ BZERO(&mbs, 1);
+ BINC_RETW(NULL, *tostr, *blen, nlen);
#ifdef USE_ICONV
- if (id != (iconv_t)-1)
- CONVERT(str, left, src, len);
+ if (id != (iconv_t)-1)
+ CONVERT(str, left, src, len);
#endif
- for (i = 0, j = 0; j < len; ) {
- n = mbrtowc((*tostr)+i, src+j, len-j, &mbs);
- /* NULL character converted */
- if (n == -2) error = -(len-j);
- if (n == -1 || n == -2) goto err;
- if (n == 0) n = 1;
- j += n;
- if (++i >= *blen) {
- nlen += 256;
- BINC_RETW(NULL, *tostr, *blen, nlen);
- }
- if (id != (iconv_t)-1 && j == len && left) {
- CONVERT(str, left, src, len);
- j = 0;
+ for (i = 0, j = 0; j < len; ) {
+ n = mbrtowc((*tostr)+i, src+j, len-j, &mbs);
+ /* NULL character converted */
+ if (n == -2)
+ error = -(len-j);
+ if (n == -1 || n == -2)
+ goto err;
+ if (n == 0)
+ n = 1;
+ j += n;
+ if (++i >= *blen) {
+ nlen += 256;
+ BINC_RETW(NULL, *tostr, *blen, nlen);
+ }
+ if (id != (iconv_t)-1 && j == len && left) {
+ CONVERT(str, left, src, len);
+ j = 0;
+ }
}
- }
- error = 0;
+ error = 0;
err:
- *tolen = i;
- *dst = cw->bp1.wc;
- IC_RESET();
+ *tolen = i;
+ *dst = cw->bp1.wc;
+ IC_RESET();
- return error;
+ return error;
}
static int
-fe_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst)
+fe_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ CHAR_T **dst)
{
- return default_char2int(sp, str, len, cw, tolen, dst,
- sp->conv.id[IC_FE_CHAR2INT]);
+ return default_char2int(sp, str, len, cw, tolen, dst,
+ sp->conv.id[IC_FE_CHAR2INT]);
}
static int
-ie_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst)
+ie_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ CHAR_T **dst)
{
- return default_char2int(sp, str, len, cw, tolen, dst,
- sp->conv.id[IC_IE_CHAR2INT]);
+ return default_char2int(sp, str, len, cw, tolen, dst,
+ sp->conv.id[IC_IE_CHAR2INT]);
}
static int
-cs_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, CHAR_T **dst)
+cs_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ CHAR_T **dst)
{
- return default_char2int(sp, str, len, cw, tolen, dst,
- (iconv_t)-1);
+ return default_char2int(sp, str, len, cw, tolen, dst, (iconv_t)-1);
}
static int
-int2raw(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, char **dst)
+int2raw(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw, size_t *tolen,
+ char **dst)
{
- int i;
- char **tostr = &cw->bp1.c;
- size_t *blen = &cw->blen1;
+ int i;
+ char **tostr = &cw->bp1.c;
+ size_t *blen = &cw->blen1;
- BINC_RETC(NULL, *tostr, *blen, len);
+ BINC_RETC(NULL, *tostr, *blen, len);
- *tolen = len;
- for (i = 0; i < len; ++i)
- (*tostr)[i] = str[i];
+ *tolen = len;
+ for (i = 0; i < len; ++i)
+ (*tostr)[i] = str[i];
- *dst = cw->bp1.c;
+ *dst = cw->bp1.c;
- return 0;
+ return 0;
}
static int
default_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, char **pdst, iconv_t id)
+ size_t *tolen, char **pdst, iconv_t id)
{
- size_t i, j, offset = 0;
- char **tostr = &cw->bp1.c;
- size_t *blen = &cw->blen1;
- mbstate_t mbs;
- size_t n;
- ssize_t nlen = len + MB_CUR_MAX;
- char *dst;
- size_t buflen;
+ size_t i, j, offset = 0;
+ char **tostr = &cw->bp1.c;
+ size_t *blen = &cw->blen1;
+ mbstate_t mbs;
+ size_t n;
+ ssize_t nlen = len + MB_CUR_MAX;
+ char *dst;
+ size_t buflen;
#ifdef USE_ICONV
- char buffer[CONV_BUFFER_SIZE];
+ char buffer[CONV_BUFFER_SIZE];
#endif
- int error = 1;
+ int error = 1;
/* convert first len bytes of buffer and append it to cw->bp
* len is adjusted => 0
@@ -217,87 +221,90 @@ default_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
*/
#ifdef USE_ICONV
#define CONVERT2(_buffer, lenp, cw, offset) \
- do { \
- char *bp = _buffer; \
- int ret; \
do { \
- size_t outleft = cw->blen1 - offset; \
- char *obp = cw->bp1.c + offset; \
- if (cw->blen1 < offset + MB_CUR_MAX) { \
- nlen += 256; \
- BINC_RETC(NULL, cw->bp1.c, cw->blen1, nlen); \
- } \
- errno = 0; \
- ret = iconv(id, (iconv_src_t)&bp, lenp, &obp, &outleft); \
- if (ret == -1 && errno != E2BIG) \
- goto err; \
- offset = cw->blen1 - outleft; \
- } while (ret != 0); \
- } while (0)
+ char *bp = _buffer; \
+ int ret; \
+ do { \
+ size_t outleft = cw->blen1 - offset; \
+ char *obp = cw->bp1.c + offset; \
+ if (cw->blen1 < offset + MB_CUR_MAX) { \
+ nlen += 256; \
+ BINC_RETC(NULL, cw->bp1.c, cw->blen1, \
+ nlen); \
+ } \
+ errno = 0; \
+ ret = iconv(id, (iconv_src_t)&bp, lenp, &obp, \
+ &outleft); \
+ if (ret == -1 && errno != E2BIG) \
+ goto err; \
+ offset = cw->blen1 - outleft; \
+ } while (ret != 0); \
+ } while (0)
#else
#define CONVERT2(_buffer, lenp, cw, offset)
#endif
- BZERO(&mbs, 1);
- BINC_RETC(NULL, *tostr, *blen, nlen);
- dst = *tostr; buflen = *blen;
+ BZERO(&mbs, 1);
+ BINC_RETC(NULL, *tostr, *blen, nlen);
+ dst = *tostr; buflen = *blen;
#ifdef USE_ICONV
- if (id != (iconv_t)-1) {
- dst = buffer; buflen = CONV_BUFFER_SIZE;
- }
+ if (id != (iconv_t)-1) {
+ dst = buffer; buflen = CONV_BUFFER_SIZE;
+ }
#endif
- for (i = 0, j = 0; i < len; ++i) {
- n = wcrtomb(dst+j, str[i], &mbs);
- if (n == -1) goto err;
- j += n;
- if (buflen < j + MB_CUR_MAX) {
- if (id != (iconv_t)-1) {
- CONVERT2(buffer, &j, cw, offset);
- } else {
- nlen += 256;
- BINC_RETC(NULL, *tostr, *blen, nlen);
- dst = *tostr; buflen = *blen;
- }
+ for (i = 0, j = 0; i < len; ++i) {
+ n = wcrtomb(dst+j, str[i], &mbs);
+ if (n == -1)
+ goto err;
+ j += n;
+ if (buflen < j + MB_CUR_MAX) {
+ if (id != (iconv_t)-1) {
+ CONVERT2(buffer, &j, cw, offset);
+ } else {
+ nlen += 256;
+ BINC_RETC(NULL, *tostr, *blen, nlen);
+ dst = *tostr; buflen = *blen;
+ }
+ }
}
- }
- n = wcrtomb(dst+j, L'\0', &mbs);
- j += n - 1; /* don't count NUL at the end */
- *tolen = j;
+ n = wcrtomb(dst+j, L'\0', &mbs);
+ j += n - 1; /* don't count NUL at the end */
+ *tolen = j;
- if (id != (iconv_t)-1) {
- CONVERT2(buffer, &j, cw, offset);
- CONVERT2(NULL, NULL, cw, offset); /* back to the initial state */
- *tolen = offset;
- }
+ if (id != (iconv_t)-1) {
+ CONVERT2(buffer, &j, cw, offset);
+ /* back to the initial state */
+ CONVERT2(NULL, NULL, cw, offset);
+ *tolen = offset;
+ }
- error = 0;
+ error = 0;
err:
- if (error)
- *tolen = j;
- *pdst = cw->bp1.c;
- IC_RESET();
+ if (error)
+ *tolen = j;
+ *pdst = cw->bp1.c;
+ IC_RESET();
- return error;
+ return error;
}
static int
fe_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, char **dst)
+ size_t *tolen, char **dst)
{
- return default_int2char(sp, str, len, cw, tolen, dst,
- sp->conv.id[IC_FE_INT2CHAR]);
+ return default_int2char(sp, str, len, cw, tolen, dst,
+ sp->conv.id[IC_FE_INT2CHAR]);
}
static int
cs_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
- size_t *tolen, char **dst)
+ size_t *tolen, char **dst)
{
- return default_int2char(sp, str, len, cw, tolen, dst,
- (iconv_t)-1);
+ return default_int2char(sp, str, len, cw, tolen, dst, (iconv_t)-1);
}
#endif
@@ -306,58 +313,58 @@ cs_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
* conv_init --
* Initialize the iconv environment.
*
- * PUBLIC: void conv_init __P((SCR *, SCR *));
+ * PUBLIC: void conv_init(SCR *, SCR *);
*/
void
conv_init(SCR *orig, SCR *sp)
{
- int i;
+ int i;
- if (orig == NULL)
- setlocale(LC_ALL, "");
- if (orig != NULL)
- BCOPY(&orig->conv, &sp->conv, 1);
+ if (orig == NULL)
+ setlocale(LC_ALL, "");
+ if (orig != NULL)
+ BCOPY(&orig->conv, &sp->conv, 1);
#ifdef USE_WIDECHAR
- else {
- char *ctype = setlocale(LC_CTYPE, NULL);
-
- /*
- * XXX
- * This hack fixes the libncursesw issue on FreeBSD.
- */
- if (!strcmp(ctype, "ko_KR.CP949"))
- setlocale(LC_CTYPE, "ko_KR.eucKR");
- else if (!strcmp(ctype, "zh_CN.GB2312"))
- setlocale(LC_CTYPE, "zh_CN.eucCN");
- else if (!strcmp(ctype, "zh_CN.GBK"))
- setlocale(LC_CTYPE, "zh_CN.GB18030");
-
- /*
- * Switch to 8bit mode if locale is C;
- * LC_CTYPE should be reseted to C if unmatched.
- */
- if (!strcmp(ctype, "C") || !strcmp(ctype, "POSIX")) {
- sp->conv.sys2int = sp->conv.file2int = raw2int;
- sp->conv.int2sys = sp->conv.int2file = int2raw;
- sp->conv.input2int = raw2int;
- } else {
- sp->conv.sys2int = cs_char2int;
- sp->conv.int2sys = cs_int2char;
- sp->conv.file2int = fe_char2int;
- sp->conv.int2file = fe_int2char;
- sp->conv.input2int = ie_char2int;
- }
+ else {
+ char *ctype = setlocale(LC_CTYPE, NULL);
+
+ /*
+ * XXX
+ * This hack fixes the libncursesw issue on FreeBSD.
+ */
+ if (!strcmp(ctype, "ko_KR.CP949"))
+ setlocale(LC_CTYPE, "ko_KR.eucKR");
+ else if (!strcmp(ctype, "zh_CN.GB2312"))
+ setlocale(LC_CTYPE, "zh_CN.eucCN");
+ else if (!strcmp(ctype, "zh_CN.GBK"))
+ setlocale(LC_CTYPE, "zh_CN.GB18030");
+
+ /*
+ * Switch to 8bit mode if locale is C;
+ * LC_CTYPE should be reseted to C if unmatched.
+ */
+ if (!strcmp(ctype, "C") || !strcmp(ctype, "POSIX")) {
+ sp->conv.sys2int = sp->conv.file2int = raw2int;
+ sp->conv.int2sys = sp->conv.int2file = int2raw;
+ sp->conv.input2int = raw2int;
+ } else {
+ sp->conv.sys2int = cs_char2int;
+ sp->conv.int2sys = cs_int2char;
+ sp->conv.file2int = fe_char2int;
+ sp->conv.int2file = fe_int2char;
+ sp->conv.input2int = ie_char2int;
+ }
#ifdef USE_ICONV
- o_set(sp, O_INPUTENCODING, OS_STRDUP, codeset(), 0);
+ o_set(sp, O_INPUTENCODING, OS_STRDUP, codeset(), 0);
#endif
- }
+ }
#endif
- /* iconv descriptors must be distinct to screens. */
- for (i = 0; i <= IC_IE_TO_UTF16; ++i)
- sp->conv.id[i] = (iconv_t)-1;
+ /* iconv descriptors must be distinct to screens. */
+ for (i = 0; i <= IC_IE_TO_UTF16; ++i)
+ sp->conv.id[i] = (iconv_t)-1;
#ifdef USE_ICONV
- conv_enc(sp, O_INPUTENCODING, 0);
+ conv_enc(sp, O_INPUTENCODING, 0);
#endif
}
@@ -365,82 +372,99 @@ conv_init(SCR *orig, SCR *sp)
* conv_enc --
* Convert file/input encoding.
*
- * PUBLIC: int conv_enc __P((SCR *, int, char *));
+ * PUBLIC: int conv_enc(SCR *, int, char *);
*/
int
conv_enc(SCR *sp, int option, char *enc)
{
#if defined(USE_WIDECHAR) && defined(USE_ICONV)
- iconv_t *c2w, *w2c;
+ iconv_t *c2w, *w2c;
+ iconv_t id_c2w, id_w2c;
+
+ switch (option) {
+ case O_FILEENCODING:
+ c2w = sp->conv.id + IC_FE_CHAR2INT;
+ w2c = sp->conv.id + IC_FE_INT2CHAR;
+ if (!enc)
+ enc = O_STR(sp, O_FILEENCODING);
+
+ if (strcasecmp(codeset(), enc)) {
+ if ((id_c2w = iconv_open(codeset(), enc)) ==
+ (iconv_t)-1)
+ goto err;
+ if ((id_w2c = iconv_open(enc, codeset())) ==
+ (iconv_t)-1)
+ goto err;
+ } else {
+ id_c2w = (iconv_t)-1;
+ id_w2c = (iconv_t)-1;
+ }
+
+ break;
+
+ case O_INPUTENCODING:
+ c2w = sp->conv.id + IC_IE_CHAR2INT;
+ w2c = sp->conv.id + IC_IE_TO_UTF16;
+ if (!enc)
+ enc = O_STR(sp, O_INPUTENCODING);
+
+ if (strcasecmp(codeset(), enc)) {
+ if ((id_c2w = iconv_open(codeset(), enc)) ==
+ (iconv_t)-1)
+ goto err;
+ } else
+ id_c2w = (iconv_t)-1;
+
+ /* UTF-16 can not be locale and can not be inputed. */
+ if ((id_w2c = iconv_open("utf-16be", enc)) == (iconv_t)-1)
+ goto err;
+
+ break;
+
+ default:
+ abort();
+ }
- switch (option) {
- case O_FILEENCODING:
- c2w = sp->conv.id + IC_FE_CHAR2INT;
- w2c = sp->conv.id + IC_FE_INT2CHAR;
- if (!enc) enc = O_STR(sp, O_FILEENCODING);
- if (*c2w != (iconv_t)-1)
- iconv_close(*c2w);
- if (*w2c != (iconv_t)-1)
- iconv_close(*w2c);
- if (strcasecmp(codeset(), enc)) {
- if ((*c2w = iconv_open(codeset(), enc)) == (iconv_t)-1)
- goto err;
- if ((*w2c = iconv_open(enc, codeset())) == (iconv_t)-1)
- goto err;
- } else *c2w = *w2c = (iconv_t)-1;
- break;
- case O_INPUTENCODING:
- c2w = sp->conv.id + IC_IE_CHAR2INT;
- w2c = sp->conv.id + IC_IE_TO_UTF16;
- if (!enc) enc = O_STR(sp, O_INPUTENCODING);
if (*c2w != (iconv_t)-1)
- iconv_close(*c2w);
+ iconv_close(*c2w);
if (*w2c != (iconv_t)-1)
- iconv_close(*w2c);
- if (strcasecmp(codeset(), enc)) {
- if ((*c2w = iconv_open(codeset(), enc)) == (iconv_t)-1)
- goto err;
- } else *c2w = (iconv_t)-1;
- /* UTF-16 can not be locale and can not be inputed. */
- if ((*w2c = iconv_open("utf-16be", enc)) == (iconv_t)-1)
- goto err;
- break;
- }
-
- F_CLR(sp, SC_CONV_ERROR);
- F_SET(sp, SC_SCR_REFORMAT);
-
- return 0;
+ iconv_close(*w2c);
+
+ *c2w = id_c2w;
+ *w2c = id_w2c;
+
+ F_CLR(sp, SC_CONV_ERROR);
+ F_SET(sp, SC_SCR_REFORMAT);
+
+ return 0;
err:
#endif
- switch (option) {
- case O_FILEENCODING:
- msgq(sp, M_ERR,
- "321|File encoding conversion not supported");
- break;
- case O_INPUTENCODING:
- msgq(sp, M_ERR,
- "322|Input encoding conversion not supported");
- break;
- }
- return 1;
+ switch (option) {
+ case O_FILEENCODING:
+ msgq(sp, M_ERR, "321|File encoding conversion not supported");
+ break;
+ case O_INPUTENCODING:
+ msgq(sp, M_ERR, "322|Input encoding conversion not supported");
+ break;
+ }
+ return 1;
}
/*
* conv_end --
* Close the iconv descriptors, release the buffer.
*
- * PUBLIC: void conv_end __P((SCR *));
+ * PUBLIC: void conv_end(SCR *);
*/
void
conv_end(SCR *sp)
{
#if defined(USE_WIDECHAR) && defined(USE_ICONV)
- int i;
- for (i = 0; i <= IC_IE_TO_UTF16; ++i)
- if (sp->conv.id[i] != (iconv_t)-1)
- iconv_close(sp->conv.id[i]);
+ int i;
+ for (i = 0; i <= IC_IE_TO_UTF16; ++i)
+ if (sp->conv.id[i] != (iconv_t)-1)
+ iconv_close(sp->conv.id[i]);
if (sp->cw.bp1.c != NULL)
- free(sp->cw.bp1.c);
+ free(sp->cw.bp1.c);
#endif
}
diff --git a/common/cut.c b/common/cut.c
index 11db42fb8158..810aef6ac89c 100644
--- a/common/cut.c
+++ b/common/cut.c
@@ -27,7 +27,7 @@ static const char sccsid[] = "$Id: cut.c,v 10.12 2012/02/11 15:52:33 zy Exp $";
#include "common.h"
-static void cb_rotate __P((SCR *));
+static void cb_rotate(SCR *);
/*
* cut --
@@ -61,7 +61,7 @@ static void cb_rotate __P((SCR *));
* replacing the contents. Hopefully it's not worth getting right, and here
* we just treat the numeric buffers like any other named buffer.
*
- * PUBLIC: int cut __P((SCR *, CHAR_T *, MARK *, MARK *, int));
+ * PUBLIC: int cut(SCR *, CHAR_T *, MARK *, MARK *, int);
*/
int
cut(
@@ -222,7 +222,7 @@ cb_rotate(SCR *sp)
* cut_line --
* Cut a portion of a single line.
*
- * PUBLIC: int cut_line __P((SCR *, recno_t, size_t, size_t, CB *));
+ * PUBLIC: int cut_line(SCR *, recno_t, size_t, size_t, CB *);
*/
int
cut_line(
@@ -266,7 +266,7 @@ cut_line(
* cut_close --
* Discard all cut buffers.
*
- * PUBLIC: void cut_close __P((GS *));
+ * PUBLIC: void cut_close(GS *);
*/
void
cut_close(GS *gp)
@@ -291,7 +291,7 @@ cut_close(GS *gp)
* text_init --
* Allocate a new TEXT structure.
*
- * PUBLIC: TEXT *text_init __P((SCR *, const CHAR_T *, size_t, size_t));
+ * PUBLIC: TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t);
*/
TEXT *
text_init(
@@ -323,7 +323,7 @@ text_init(
* text_lfree --
* Free a chain of text structures.
*
- * PUBLIC: void text_lfree __P((TEXTH *));
+ * PUBLIC: void text_lfree(TEXTH *);
*/
void
text_lfree(TEXTH *headp)
@@ -340,7 +340,7 @@ text_lfree(TEXTH *headp)
* text_free --
* Free a text structure.
*
- * PUBLIC: void text_free __P((TEXT *));
+ * PUBLIC: void text_free(TEXT *);
*/
void
text_free(TEXT *tp)
diff --git a/common/delete.c b/common/delete.c
index bb476c0c8a7c..b9bd0388946f 100644
--- a/common/delete.c
+++ b/common/delete.c
@@ -30,7 +30,7 @@ static const char sccsid[] = "$Id: delete.c,v 10.18 2012/02/11 15:52:33 zy Exp $
* del --
* Delete a range of text.
*
- * PUBLIC: int del __P((SCR *, MARK *, MARK *, int));
+ * PUBLIC: int del(SCR *, MARK *, MARK *, int);
*/
int
del(
diff --git a/common/encoding.c b/common/encoding.c
index 6de509e5b8ec..7bdcf7069238 100644
--- a/common/encoding.c
+++ b/common/encoding.c
@@ -11,10 +11,10 @@ static const char sccsid[] = "$Id: encoding.c,v 1.4 2011/12/13 19:40:52 zy Exp $
#include <sys/types.h>
-int looks_utf8 __P((const char *, size_t));
-int looks_utf16 __P((const char *, size_t));
-int decode_utf8 __P((const char *));
-int decode_utf16 __P((const char *, int));
+int looks_utf8(const char *, size_t);
+int looks_utf16(const char *, size_t);
+int decode_utf8(const char *);
+int decode_utf16(const char *, int);
#define F 0 /* character never appears in text */
#define T 1 /* character appears in plain ASCII text */
@@ -54,7 +54,7 @@ static char text_chars[256] = {
*
* Based on RFC 3629. UTF-8 with BOM is not accepted.
*
- * PUBLIC: int looks_utf8 __P((const char *, size_t));
+ * PUBLIC: int looks_utf8(const char *, size_t);
*/
int
looks_utf8(const char *ibuf, size_t nbytes)
@@ -115,7 +115,7 @@ done:
* 1: Little-endian UTF-16
* 2: Big-endian UTF-16
*
- * PUBLIC: int looks_utf16 __P((const char *, size_t));
+ * PUBLIC: int looks_utf16(const char *, size_t);
*/
int
looks_utf16(const char *ibuf, size_t nbytes)
@@ -175,9 +175,11 @@ looks_utf16(const char *ibuf, size_t nbytes)
*
* Based on RFC 3629, but without error detection.
*
- * PUBLIC: int decode_utf8 __P((const char *));
+ * PUBLIC: int decode_utf8(const char *);
*/
-int decode_utf8(const char *ibuf) {
+int
+decode_utf8(const char *ibuf)
+{
const u_char *buf = (u_char *)ibuf;
int u = -1;
@@ -194,6 +196,7 @@ int decode_utf8(const char *ibuf) {
u = (buf[0] ^ 0xF0) << 18 ^ (buf[1] ^ 0x80) << 12
^ (buf[2] ^ 0x80) << 6 ^ (buf[3] ^ 0x80);
}
+
return u;
}
@@ -204,9 +207,11 @@ int decode_utf8(const char *ibuf) {
*
* No error detection on supplementary bytes.
*
- * PUBLIC: int decode_utf16 __P((const char *, int));
+ * PUBLIC: int decode_utf16(const char *, int);
*/
-int decode_utf16(const char* ibuf, int bigend) {
+int
+decode_utf16(const char* ibuf, int bigend)
+{
const u_char *buf = (u_char *)ibuf;
int u = -1;
unsigned int w1, w2;
@@ -226,5 +231,6 @@ int decode_utf16(const char* ibuf, int bigend) {
w2 = buf[2] ^ buf[3] << 8;
u = ((w1 ^ 0xD800) << 10 ^ (w2 ^ 0xDC00)) + 0x10000;
}
+
return u;
}
diff --git a/common/exf.c b/common/exf.c
index 6579ab2118d3..1fcf7f6da498 100644
--- a/common/exf.c
+++ b/common/exf.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: exf.c,v 10.62 2013/07/01 23:28:13 zy Exp $";
+static const char sccsid[] = "$Id: exf.c,v 10.64 2015/04/05 15:21:55 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -37,11 +37,11 @@ static const char sccsid[] = "$Id: exf.c,v 10.62 2013/07/01 23:28:13 zy Exp $";
#include "common.h"
-static int file_backup __P((SCR *, char *, char *));
-static void file_cinit __P((SCR *));
-static void file_encinit __P((SCR *));
-static void file_comment __P((SCR *));
-static int file_spath __P((SCR *, FREF *, struct stat *, int *));
+static int file_backup(SCR *, char *, char *);
+static void file_cinit(SCR *);
+static void file_encinit(SCR *);
+static void file_comment(SCR *);
+static int file_spath(SCR *, FREF *, struct stat *, int *);
/*
* file_add --
@@ -56,7 +56,7 @@ static int file_spath __P((SCR *, FREF *, struct stat *, int *));
* vi now remembers the last location in any file that it has ever edited,
* not just the previously edited file.
*
- * PUBLIC: FREF *file_add __P((SCR *, char *));
+ * PUBLIC: FREF *file_add(SCR *, char *);
*/
FREF *
file_add(
@@ -118,7 +118,7 @@ file_add(
* let go of any previous file. Don't release the previous file until
* absolutely sure we have the new one.
*
- * PUBLIC: int file_init __P((SCR *, FREF *, char *, int));
+ * PUBLIC: int file_init(SCR *, FREF *, char *, int);
*/
int
file_init(
@@ -259,6 +259,8 @@ file_init(
DB_RECNO, &oinfo)) == NULL) {
msgq_str(sp,
M_SYSERR, rcv_name == NULL ? oname : rcv_name, "%s");
+ if (F_ISSET(frp, FR_NEWFILE))
+ goto err;
/*
* !!!
* Historically, vi permitted users to edit files that couldn't
@@ -340,6 +342,8 @@ file_init(
break;
case LOCK_UNAVAIL:
readonly = 1;
+ if (F_ISSET(sp, SC_READONLY))
+ break;
msgq_str(sp, M_INFO, oname,
"239|%s already locked, session is read-only");
break;
@@ -625,7 +629,7 @@ file_cinit(SCR *sp)
* file_end --
* Stop editing a file.
*
- * PUBLIC: int file_end __P((SCR *, EXF *, int));
+ * PUBLIC: int file_end(SCR *, EXF *, int);
*/
int
file_end(
@@ -737,7 +741,7 @@ file_end(
* semantics for whether or not writes would happen. That's
* why all the flags.
*
- * PUBLIC: int file_write __P((SCR *, MARK *, MARK *, char *, int));
+ * PUBLIC: int file_write(SCR *, MARK *, MARK *, char *, int);
*/
int
file_write(
@@ -841,7 +845,6 @@ file_write(
return (1);
/* Open the file. */
- SIGBLOCK;
if ((fd = open(name, oflags,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) < 0) {
if (errno == EACCES && LF_ISSET(FS_FORCE)) {
@@ -873,11 +876,9 @@ file_write(
errno = EACCES;
}
msgq_str(sp, M_SYSERR, name, "%s");
- SIGUNBLOCK;
return (1);
}
success_open:
- SIGUNBLOCK;
/* Try and get a lock. */
if (!noname && file_lock(sp, NULL, fd, 0) == LOCK_UNAVAIL)
@@ -1246,7 +1247,7 @@ file_encinit(SCR *sp)
if (looks_utf8(buf, blen) > 1)
o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
else if (!O_ISSET(sp, O_FILEENCODING) ||
- !strncasecmp(O_STR(sp, O_FILEENCODING), "utf-8", 5))
+ !strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
conv_enc(sp, O_FILEENCODING, 0);
@@ -1302,7 +1303,7 @@ file_comment(SCR *sp)
* First modification check routine. The :next, :prev, :rewind, :tag,
* :tagpush, :tagpop, ^^ modifications check.
*
- * PUBLIC: int file_m1 __P((SCR *, int, int));
+ * PUBLIC: int file_m1(SCR *, int, int);
*/
int
file_m1(
@@ -1343,7 +1344,7 @@ file_m1(
* Second modification check routine. The :edit, :quit, :recover
* modifications check.
*
- * PUBLIC: int file_m2 __P((SCR *, int));
+ * PUBLIC: int file_m2(SCR *, int);
*/
int
file_m2(
@@ -1375,7 +1376,7 @@ file_m2(
* file_m3 --
* Third modification check routine.
*
- * PUBLIC: int file_m3 __P((SCR *, int));
+ * PUBLIC: int file_m3(SCR *, int);
*/
int
file_m3(
@@ -1411,7 +1412,7 @@ file_m3(
* is not set, write the file. A routine so there's a place to put the
* comment.
*
- * PUBLIC: int file_aw __P((SCR *, int));
+ * PUBLIC: int file_aw(SCR *, int);
*/
int
file_aw(
@@ -1472,7 +1473,7 @@ file_aw(
* If the user edits a temporary file, there may be times when there is no
* alternative file name. A name argument of NULL turns it off.
*
- * PUBLIC: void set_alt_name __P((SCR *, char *));
+ * PUBLIC: void set_alt_name(SCR *, char *);
*/
void
set_alt_name(
@@ -1491,7 +1492,7 @@ set_alt_name(
* file_lock --
* Get an exclusive lock on a file.
*
- * PUBLIC: lockr_t file_lock __P((SCR *, char *, int, int));
+ * PUBLIC: lockr_t file_lock(SCR *, char *, int, int);
*/
lockr_t
file_lock(
diff --git a/common/extern.h b/common/extern.h
index 20672e380b14..f8acf8eacd83 100644
--- a/common/extern.h
+++ b/common/extern.h
@@ -1,132 +1,132 @@
-char * codeset __P((void));
-void conv_init __P((SCR *, SCR *));
-int conv_enc __P((SCR *, int, char *));
-void conv_end __P((SCR *));
-int cut __P((SCR *, CHAR_T *, MARK *, MARK *, int));
-int cut_line __P((SCR *, recno_t, size_t, size_t, CB *));
-void cut_close __P((GS *));
-TEXT *text_init __P((SCR *, const CHAR_T *, size_t, size_t));
-void text_lfree __P((TEXTH *));
-void text_free __P((TEXT *));
-int del __P((SCR *, MARK *, MARK *, int));
-int looks_utf8 __P((const char *, size_t));
-int looks_utf16 __P((const char *, size_t));
-int decode_utf8 __P((const char *));
-int decode_utf16 __P((const char *, int));
-FREF *file_add __P((SCR *, char *));
-int file_init __P((SCR *, FREF *, char *, int));
-int file_end __P((SCR *, EXF *, int));
-int file_write __P((SCR *, MARK *, MARK *, char *, int));
-int file_m1 __P((SCR *, int, int));
-int file_m2 __P((SCR *, int));
-int file_m3 __P((SCR *, int));
-int file_aw __P((SCR *, int));
-void set_alt_name __P((SCR *, char *));
-lockr_t file_lock __P((SCR *, char *, int, int));
-int v_key_init __P((SCR *));
-void v_key_ilookup __P((SCR *));
-size_t v_key_len __P((SCR *, ARG_CHAR_T));
-char *v_key_name __P((SCR *, ARG_CHAR_T));
-e_key_t v_key_val __P((SCR *, ARG_CHAR_T));
-int v_event_push __P((SCR *, EVENT *, CHAR_T *, size_t, u_int));
-int v_event_get __P((SCR *, EVENT *, int, u_int32_t));
-void v_event_err __P((SCR *, EVENT *));
-int v_event_flush __P((SCR *, u_int));
-int db_eget __P((SCR *, recno_t, CHAR_T **, size_t *, int *));
-int db_get __P((SCR *, recno_t, u_int32_t, CHAR_T **, size_t *));
-int db_delete __P((SCR *, recno_t));
-int db_append __P((SCR *, int, recno_t, CHAR_T *, size_t));
-int db_insert __P((SCR *, recno_t, CHAR_T *, size_t));
-int db_set __P((SCR *, recno_t, CHAR_T *, size_t));
-int db_exist __P((SCR *, recno_t));
-int db_last __P((SCR *, recno_t *));
-int db_rget __P((SCR *, recno_t, char **, size_t *));
-int db_rset __P((SCR *, recno_t, char *, size_t));
-void db_err __P((SCR *, recno_t));
-int log_init __P((SCR *, EXF *));
-int log_end __P((SCR *, EXF *));
-int log_cursor __P((SCR *));
-int log_line __P((SCR *, recno_t, u_int));
-int log_mark __P((SCR *, LMARK *));
-int log_backward __P((SCR *, MARK *));
-int log_setline __P((SCR *));
-int log_forward __P((SCR *, MARK *));
-int editor __P((GS *, int, char *[]));
-void v_end __P((GS *));
-int mark_init __P((SCR *, EXF *));
-int mark_end __P((SCR *, EXF *));
-int mark_get __P((SCR *, ARG_CHAR_T, MARK *, mtype_t));
-int mark_set __P((SCR *, ARG_CHAR_T, MARK *, int));
-int mark_insdel __P((SCR *, lnop_t, recno_t));
-void msgq __P((SCR *, mtype_t, const char *, ...));
-void msgq_wstr __P((SCR *, mtype_t, const CHAR_T *, const char *));
-void msgq_str __P((SCR *, mtype_t, const char *, const char *));
-void mod_rpt __P((SCR *));
-void msgq_status __P((SCR *, recno_t, u_int));
-int msg_open __P((SCR *, char *));
-void msg_close __P((GS *));
-const char *msg_cmsg __P((SCR *, cmsg_t, size_t *));
-const char *msg_cat __P((SCR *, const char *, size_t *));
-char *msg_print __P((SCR *, const char *, int *));
-int opts_init __P((SCR *, int *));
-int opts_set __P((SCR *, ARGS *[], char *));
-int o_set __P((SCR *, int, u_int, char *, u_long));
-int opts_empty __P((SCR *, int, int));
-void opts_dump __P((SCR *, enum optdisp));
-int opts_save __P((SCR *, FILE *));
-OPTLIST const *opts_search __P((CHAR_T *));
-void opts_nomatch __P((SCR *, CHAR_T *));
-int opts_copy __P((SCR *, SCR *));
-void opts_free __P((SCR *));
-int f_altwerase __P((SCR *, OPTION *, char *, u_long *));
-int f_columns __P((SCR *, OPTION *, char *, u_long *));
-int f_lines __P((SCR *, OPTION *, char *, u_long *));
-int f_lisp __P((SCR *, OPTION *, char *, u_long *));
-int f_msgcat __P((SCR *, OPTION *, char *, u_long *));
-int f_print __P((SCR *, OPTION *, char *, u_long *));
-int f_readonly __P((SCR *, OPTION *, char *, u_long *));
-int f_recompile __P((SCR *, OPTION *, char *, u_long *));
-int f_reformat __P((SCR *, OPTION *, char *, u_long *));
-int f_ttywerase __P((SCR *, OPTION *, char *, u_long *));
-int f_w300 __P((SCR *, OPTION *, char *, u_long *));
-int f_w1200 __P((SCR *, OPTION *, char *, u_long *));
-int f_w9600 __P((SCR *, OPTION *, char *, u_long *));
-int f_window __P((SCR *, OPTION *, char *, u_long *));
-int f_encoding __P((SCR *, OPTION *, char *, u_long *));
-int put __P((SCR *, CB *, CHAR_T *, MARK *, MARK *, int));
-int rcv_tmp __P((SCR *, EXF *, char *));
-int rcv_init __P((SCR *));
-int rcv_sync __P((SCR *, u_int));
-int rcv_list __P((SCR *));
-int rcv_read __P((SCR *, FREF *));
-int screen_init __P((GS *, SCR *, SCR **));
-int screen_end __P((SCR *));
-SCR *screen_next __P((SCR *));
-int f_search __P((SCR *,
- MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
-int b_search __P((SCR *,
- MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
-void search_busy __P((SCR *, busy_t));
-int seq_set __P((SCR *, CHAR_T *,
- size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int));
-int seq_delete __P((SCR *, CHAR_T *, size_t, seq_t));
-int seq_free __P((SEQ *));
+char * codeset(void);
+void conv_init(SCR *, SCR *);
+int conv_enc(SCR *, int, char *);
+void conv_end(SCR *);
+int cut(SCR *, CHAR_T *, MARK *, MARK *, int);
+int cut_line(SCR *, recno_t, size_t, size_t, CB *);
+void cut_close(GS *);
+TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t);
+void text_lfree(TEXTH *);
+void text_free(TEXT *);
+int del(SCR *, MARK *, MARK *, int);
+int looks_utf8(const char *, size_t);
+int looks_utf16(const char *, size_t);
+int decode_utf8(const char *);
+int decode_utf16(const char *, int);
+FREF *file_add(SCR *, char *);
+int file_init(SCR *, FREF *, char *, int);
+int file_end(SCR *, EXF *, int);
+int file_write(SCR *, MARK *, MARK *, char *, int);
+int file_m1(SCR *, int, int);
+int file_m2(SCR *, int);
+int file_m3(SCR *, int);
+int file_aw(SCR *, int);
+void set_alt_name(SCR *, char *);
+lockr_t file_lock(SCR *, char *, int, int);
+int v_key_init(SCR *);
+void v_key_ilookup(SCR *);
+size_t v_key_len(SCR *, ARG_CHAR_T);
+char *v_key_name(SCR *, ARG_CHAR_T);
+e_key_t v_key_val(SCR *, ARG_CHAR_T);
+int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int);
+int v_event_get(SCR *, EVENT *, int, u_int32_t);
+void v_event_err(SCR *, EVENT *);
+int v_event_flush(SCR *, u_int);
+int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *);
+int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *);
+int db_delete(SCR *, recno_t);
+int db_append(SCR *, int, recno_t, CHAR_T *, size_t);
+int db_insert(SCR *, recno_t, CHAR_T *, size_t);
+int db_set(SCR *, recno_t, CHAR_T *, size_t);
+int db_exist(SCR *, recno_t);
+int db_last(SCR *, recno_t *);
+int db_rget(SCR *, recno_t, char **, size_t *);
+int db_rset(SCR *, recno_t, char *, size_t);
+void db_err(SCR *, recno_t);
+int log_init(SCR *, EXF *);
+int log_end(SCR *, EXF *);
+int log_cursor(SCR *);
+int log_line(SCR *, recno_t, u_int);
+int log_mark(SCR *, LMARK *);
+int log_backward(SCR *, MARK *);
+int log_setline(SCR *);
+int log_forward(SCR *, MARK *);
+int editor(GS *, int, char *[]);
+void v_end(GS *);
+int mark_init(SCR *, EXF *);
+int mark_end(SCR *, EXF *);
+int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t);
+int mark_set(SCR *, ARG_CHAR_T, MARK *, int);
+int mark_insdel(SCR *, lnop_t, recno_t);
+void msgq(SCR *, mtype_t, const char *, ...);
+void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *);
+void msgq_str(SCR *, mtype_t, const char *, const char *);
+void mod_rpt(SCR *);
+void msgq_status(SCR *, recno_t, u_int);
+int msg_open(SCR *, char *);
+void msg_close(GS *);
+const char *msg_cmsg(SCR *, cmsg_t, size_t *);
+const char *msg_cat(SCR *, const char *, size_t *);
+char *msg_print(SCR *, const char *, int *);
+int opts_init(SCR *, int *);
+int opts_set(SCR *, ARGS *[], char *);
+int o_set(SCR *, int, u_int, char *, u_long);
+int opts_empty(SCR *, int, int);
+void opts_dump(SCR *, enum optdisp);
+int opts_save(SCR *, FILE *);
+OPTLIST const *opts_search(CHAR_T *);
+void opts_nomatch(SCR *, CHAR_T *);
+int opts_copy(SCR *, SCR *);
+void opts_free(SCR *);
+int f_altwerase(SCR *, OPTION *, char *, u_long *);
+int f_columns(SCR *, OPTION *, char *, u_long *);
+int f_lines(SCR *, OPTION *, char *, u_long *);
+int f_lisp(SCR *, OPTION *, char *, u_long *);
+int f_msgcat(SCR *, OPTION *, char *, u_long *);
+int f_print(SCR *, OPTION *, char *, u_long *);
+int f_readonly(SCR *, OPTION *, char *, u_long *);
+int f_recompile(SCR *, OPTION *, char *, u_long *);
+int f_reformat(SCR *, OPTION *, char *, u_long *);
+int f_ttywerase(SCR *, OPTION *, char *, u_long *);
+int f_w300(SCR *, OPTION *, char *, u_long *);
+int f_w1200(SCR *, OPTION *, char *, u_long *);
+int f_w9600(SCR *, OPTION *, char *, u_long *);
+int f_window(SCR *, OPTION *, char *, u_long *);
+int f_encoding(SCR *, OPTION *, char *, u_long *);
+int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int);
+int rcv_tmp(SCR *, EXF *, char *);
+int rcv_init(SCR *);
+int rcv_sync(SCR *, u_int);
+int rcv_list(SCR *);
+int rcv_read(SCR *, FREF *);
+int screen_init(GS *, SCR *, SCR **);
+int screen_end(SCR *);
+SCR *screen_next(SCR *);
+int f_search(SCR *,
+ MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
+int b_search(SCR *,
+ MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
+void search_busy(SCR *, busy_t);
+int seq_set(SCR *, CHAR_T *,
+ size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int);
+int seq_delete(SCR *, CHAR_T *, size_t, seq_t);
+int seq_free(SEQ *);
SEQ *seq_find
- __P((SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *));
-void seq_close __P((GS *));
-int seq_dump __P((SCR *, seq_t, int));
-int seq_save __P((SCR *, FILE *, char *, seq_t));
-int e_memcmp __P((CHAR_T *, EVENT *, size_t));
-void *binc __P((SCR *, void *, size_t *, size_t));
-int nonblank __P((SCR *, recno_t, size_t *));
-char *tail __P((char *));
-char *join __P((char *, char *));
-char *expanduser __P((char *));
-char *quote __P((char *));
-char *v_strdup __P((SCR *, const char *, size_t));
-CHAR_T *v_wstrdup __P((SCR *, const CHAR_T *, size_t));
-enum nresult nget_uslong __P((u_long *, const CHAR_T *, CHAR_T **, int));
-enum nresult nget_slong __P((long *, const CHAR_T *, CHAR_T **, int));
-void timepoint_steady __P((struct timespec *));
-void timepoint_system __P((struct timespec *));
-void TRACE __P((SCR *, const char *, ...));
+ (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *);
+void seq_close(GS *);
+int seq_dump(SCR *, seq_t, int);
+int seq_save(SCR *, FILE *, char *, seq_t);
+int e_memcmp(CHAR_T *, EVENT *, size_t);
+void *binc(SCR *, void *, size_t *, size_t);
+int nonblank(SCR *, recno_t, size_t *);
+char *tail(char *);
+char *join(char *, char *);
+char *expanduser(char *);
+char *quote(char *);
+char *v_strdup(SCR *, const char *, size_t);
+CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t);
+enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int);
+enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int);
+void timepoint_steady(struct timespec *);
+void timepoint_system(struct timespec *);
+void TRACE(SCR *, const char *, ...);
diff --git a/common/gs.h b/common/gs.h
index 33a02458b0f9..4d0dc6fe5bf8 100644
--- a/common/gs.h
+++ b/common/gs.h
@@ -144,73 +144,55 @@ struct _gs {
/* Screen interface functions. */
/* Add a string to the screen. */
- int (*scr_addstr) __P((SCR *, const char *, size_t));
+ int (*scr_addstr)(SCR *, const char *, size_t);
/* Add a string to the screen. */
- int (*scr_waddstr) __P((SCR *, const CHAR_T *, size_t));
+ int (*scr_waddstr)(SCR *, const CHAR_T *, size_t);
/* Toggle a screen attribute. */
- int (*scr_attr) __P((SCR *, scr_attr_t, int));
+ int (*scr_attr)(SCR *, scr_attr_t, int);
/* Terminal baud rate. */
- int (*scr_baud) __P((SCR *, u_long *));
+ int (*scr_baud)(SCR *, u_long *);
/* Beep/bell/flash the terminal. */
- int (*scr_bell) __P((SCR *));
+ int (*scr_bell)(SCR *);
/* Display a busy message. */
- void (*scr_busy) __P((SCR *, const char *, busy_t));
+ void (*scr_busy)(SCR *, const char *, busy_t);
/* Prepare child. */
- int (*scr_child) __P((SCR *));
+ int (*scr_child)(SCR *);
/* Clear to the end of the line. */
- int (*scr_clrtoeol) __P((SCR *));
+ int (*scr_clrtoeol)(SCR *);
/* Return the cursor location. */
- int (*scr_cursor) __P((SCR *, size_t *, size_t *));
+ int (*scr_cursor)(SCR *, size_t *, size_t *);
/* Delete a line. */
- int (*scr_deleteln) __P((SCR *));
+ int (*scr_deleteln)(SCR *);
/* Discard a screen. */
- int (*scr_discard) __P((SCR *, SCR **));
+ int (*scr_discard)(SCR *, SCR **);
/* Get a keyboard event. */
- int (*scr_event) __P((SCR *, EVENT *, u_int32_t, int));
+ int (*scr_event)(SCR *, EVENT *, u_int32_t, int);
/* Ex: screen adjustment routine. */
- int (*scr_ex_adjust) __P((SCR *, exadj_t));
+ int (*scr_ex_adjust)(SCR *, exadj_t);
int (*scr_fmap) /* Set a function key. */
- __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
+ (SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
/* Get terminal key value. */
- int (*scr_keyval) __P((SCR *, scr_keyval_t, CHAR_T *, int *));
+ int (*scr_keyval)(SCR *, scr_keyval_t, CHAR_T *, int *);
/* Insert a line. */
- int (*scr_insertln) __P((SCR *));
+ int (*scr_insertln)(SCR *);
/* Handle an option change. */
- int (*scr_optchange) __P((SCR *, int, char *, u_long *));
+ int (*scr_optchange)(SCR *, int, char *, u_long *);
/* Move the cursor. */
- int (*scr_move) __P((SCR *, size_t, size_t));
+ int (*scr_move)(SCR *, size_t, size_t);
/* Message or ex output. */
- void (*scr_msg) __P((SCR *, mtype_t, char *, size_t));
+ void (*scr_msg)(SCR *, mtype_t, char *, size_t);
/* Refresh the screen. */
- int (*scr_refresh) __P((SCR *, int));
+ int (*scr_refresh)(SCR *, int);
/* Rename the file. */
- int (*scr_rename) __P((SCR *, char *, int));
+ int (*scr_rename)(SCR *, char *, int);
/* Reply to an event. */
- int (*scr_reply) __P((SCR *, int, char *));
+ int (*scr_reply)(SCR *, int, char *);
/* Set the screen type. */
- int (*scr_screen) __P((SCR *, u_int32_t));
+ int (*scr_screen)(SCR *, u_int32_t);
/* Split the screen. */
- int (*scr_split) __P((SCR *, SCR *));
+ int (*scr_split)(SCR *, SCR *);
/* Suspend the editor. */
- int (*scr_suspend) __P((SCR *, int *));
+ int (*scr_suspend)(SCR *, int *);
/* Print usage message. */
- void (*scr_usage) __P((void));
+ void (*scr_usage)(void);
};
-
-/*
- * XXX
- * Block signals if there are asynchronous events. Used to keep DB system calls
- * from being interrupted and not restarted, as that will result in consistency
- * problems. This should be handled by DB.
- */
-#ifdef BLOCK_SIGNALS
-#include <signal.h>
-extern sigset_t __sigblockset;
-#define SIGBLOCK \
- (void)sigprocmask(SIG_BLOCK, &__sigblockset, NULL)
-#define SIGUNBLOCK \
- (void)sigprocmask(SIG_UNBLOCK, &__sigblockset, NULL);
-#else
-#define SIGBLOCK
-#define SIGUNBLOCK
-#endif
diff --git a/common/key.c b/common/key.c
index 9fc20b73d940..790c3719e9b6 100644
--- a/common/key.c
+++ b/common/key.c
@@ -30,11 +30,11 @@ static const char sccsid[] = "$Id: key.c,v 10.54 2013/11/13 12:15:27 zy Exp $";
#include "common.h"
#include "../vi/vi.h"
-static int v_event_append __P((SCR *, EVENT *));
-static int v_event_grow __P((SCR *, int));
-static int v_key_cmp __P((const void *, const void *));
-static void v_keyval __P((SCR *, int, scr_keyval_t));
-static void v_sync __P((SCR *, int));
+static int v_event_append(SCR *, EVENT *);
+static int v_event_grow(SCR *, int);
+static int v_key_cmp(const void *, const void *);
+static void v_keyval(SCR *, int, scr_keyval_t);
+static void v_sync(SCR *, int);
/*
* !!!
@@ -97,7 +97,7 @@ static int nkeylist =
* v_key_init --
* Initialize the special key lookup table.
*
- * PUBLIC: int v_key_init __P((SCR *));
+ * PUBLIC: int v_key_init(SCR *);
*/
int
v_key_init(SCR *sp)
@@ -179,7 +179,7 @@ v_keyval(
* v_key_ilookup --
* Build the fast-lookup key display array.
*
- * PUBLIC: void v_key_ilookup __P((SCR *));
+ * PUBLIC: void v_key_ilookup(SCR *);
*/
void
v_key_ilookup(SCR *sp)
@@ -203,7 +203,7 @@ v_key_ilookup(SCR *sp)
* Return the length of the string that will display the key.
* This routine is the backup for the KEY_LEN() macro.
*
- * PUBLIC: size_t v_key_len __P((SCR *, ARG_CHAR_T));
+ * PUBLIC: size_t v_key_len(SCR *, ARG_CHAR_T);
*/
size_t
v_key_len(
@@ -219,7 +219,7 @@ v_key_len(
* Return the string that will display the key. This routine
* is the backup for the KEY_NAME() macro.
*
- * PUBLIC: char *v_key_name __P((SCR *, ARG_CHAR_T));
+ * PUBLIC: char *v_key_name(SCR *, ARG_CHAR_T);
*/
char *
v_key_name(
@@ -327,7 +327,7 @@ done: sp->cname[sp->clen = len] = '\0';
* Fill in the value for a key. This routine is the backup
* for the KEY_VAL() macro.
*
- * PUBLIC: e_key_t v_key_val __P((SCR *, ARG_CHAR_T));
+ * PUBLIC: e_key_t v_key_val(SCR *, ARG_CHAR_T);
*/
e_key_t
v_key_val(
@@ -351,7 +351,7 @@ v_key_val(
* an associated flag value, which indicates if it has already been quoted,
* and if it is the result of a mapping or an abbreviation.
*
- * PUBLIC: int v_event_push __P((SCR *, EVENT *, CHAR_T *, size_t, u_int));
+ * PUBLIC: int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int);
*/
int
v_event_push(
@@ -532,7 +532,7 @@ v_event_append(
* point. Given that this might make the log grow unacceptably (consider that
* cursor keys are done with maps), for now we leave any changes made in place.
*
- * PUBLIC: int v_event_get __P((SCR *, EVENT *, int, u_int32_t));
+ * PUBLIC: int v_event_get(SCR *, EVENT *, int, u_int32_t);
*/
int
v_event_get(
@@ -771,7 +771,7 @@ v_sync(
* v_event_err --
* Unexpected event.
*
- * PUBLIC: void v_event_err __P((SCR *, EVENT *));
+ * PUBLIC: void v_event_err(SCR *, EVENT *);
*/
void
v_event_err(
@@ -821,7 +821,7 @@ v_event_err(
* v_event_flush --
* Flush any flagged keys, returning if any keys were flushed.
*
- * PUBLIC: int v_event_flush __P((SCR *, u_int));
+ * PUBLIC: int v_event_flush(SCR *, u_int);
*/
int
v_event_flush(
diff --git a/common/line.c b/common/line.c
index 0bceccfa5bcc..5549ad93cb66 100644
--- a/common/line.c
+++ b/common/line.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: line.c,v 10.26 2011/08/12 12:36:41 zy Exp $";
+static const char sccsid[] = "$Id: line.c,v 10.27 2015/04/03 14:17:21 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -26,13 +26,13 @@ static const char sccsid[] = "$Id: line.c,v 10.26 2011/08/12 12:36:41 zy Exp $";
#include "common.h"
#include "../vi/vi.h"
-static int scr_update __P((SCR *, recno_t, lnop_t, int));
+static int scr_update(SCR *, recno_t, lnop_t, int);
/*
* db_eget --
* Front-end to db_get, special case handling for empty files.
*
- * PUBLIC: int db_eget __P((SCR *, recno_t, CHAR_T **, size_t *, int *));
+ * PUBLIC: int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *);
*/
int
db_eget(
@@ -76,7 +76,7 @@ db_eget(
* Look in the text buffers for a line, followed by the cache, followed
* by the database.
*
- * PUBLIC: int db_get __P((SCR *, recno_t, u_int32_t, CHAR_T **, size_t *));
+ * PUBLIC: int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *);
*/
int
db_get(
@@ -92,7 +92,6 @@ db_get(
recno_t l1, l2;
CHAR_T *wp;
size_t wlen;
- size_t nlen;
/*
* The underlying recno stuff handles zero by returning NULL, but
@@ -152,8 +151,6 @@ db_get(
ep->c_lno = OOBLNO;
nocache:
- nlen = 1024;
-retry:
/* Get the line from the underlying database. */
key.data = &lno;
key.size = sizeof(lno);
@@ -169,11 +166,6 @@ err3: if (lenp != NULL)
if (pp != NULL)
*pp = NULL;
return (1);
- case 0:
- if (data.size > nlen) {
- nlen = data.size;
- goto retry;
- }
}
if (FILE2INT(sp, data.data, data.size, wp, wlen)) {
@@ -207,7 +199,7 @@ err3: if (lenp != NULL)
* db_delete --
* Delete a line from the file.
*
- * PUBLIC: int db_delete __P((SCR *, recno_t));
+ * PUBLIC: int db_delete(SCR *, recno_t);
*/
int
db_delete(
@@ -238,13 +230,11 @@ db_delete(
/* Update file. */
key.data = &lno;
key.size = sizeof(lno);
- SIGBLOCK;
if (ep->db->del(ep->db, &key, 0) == 1) {
msgq(sp, M_SYSERR,
"003|unable to delete line %lu", (u_long)lno);
return (1);
}
- SIGUNBLOCK;
/* Flush the cache, update line count, before screen update. */
if (lno <= ep->c_lno)
@@ -265,7 +255,7 @@ db_delete(
* db_append --
* Append a line into the file.
*
- * PUBLIC: int db_append __P((SCR *, int, recno_t, CHAR_T *, size_t));
+ * PUBLIC: int db_append(SCR *, int, recno_t, CHAR_T *, size_t);
*/
int
db_append(
@@ -297,13 +287,11 @@ db_append(
key.size = sizeof(lno);
data.data = fp;
data.size = flen;
- SIGBLOCK;
if (ep->db->put(ep->db, &key, &data, R_IAFTER) == -1) {
msgq(sp, M_SYSERR,
"004|unable to append to line %lu", (u_long)lno);
return (1);
}
- SIGUNBLOCK;
/* Flush the cache, update line count, before screen update. */
if (lno < ep->c_lno)
@@ -343,7 +331,7 @@ db_append(
* db_insert --
* Insert a line into the file.
*
- * PUBLIC: int db_insert __P((SCR *, recno_t, CHAR_T *, size_t));
+ * PUBLIC: int db_insert(SCR *, recno_t, CHAR_T *, size_t);
*/
int
db_insert(
@@ -375,13 +363,11 @@ db_insert(
key.size = sizeof(lno);
data.data = fp;
data.size = flen;
- SIGBLOCK;
if (ep->db->put(ep->db, &key, &data, R_IBEFORE) == -1) {
msgq(sp, M_SYSERR,
"005|unable to insert at line %lu", (u_long)lno);
return (1);
}
- SIGUNBLOCK;
/* Flush the cache, update line count, before screen update. */
if (lno >= ep->c_lno)
@@ -412,7 +398,7 @@ db_insert(
* db_set --
* Store a line in the file.
*
- * PUBLIC: int db_set __P((SCR *, recno_t, CHAR_T *, size_t));
+ * PUBLIC: int db_set(SCR *, recno_t, CHAR_T *, size_t);
*/
int
db_set(
@@ -446,13 +432,11 @@ db_set(
key.size = sizeof(lno);
data.data = fp;
data.size = flen;
- SIGBLOCK;
if (ep->db->put(ep->db, &key, &data, 0) == -1) {
msgq(sp, M_SYSERR,
"006|unable to store line %lu", (u_long)lno);
return (1);
}
- SIGUNBLOCK;
/* Flush the cache, before logging or screen update. */
if (lno == ep->c_lno)
@@ -474,7 +458,7 @@ db_set(
* db_exist --
* Return if a line exists.
*
- * PUBLIC: int db_exist __P((SCR *, recno_t));
+ * PUBLIC: int db_exist(SCR *, recno_t);
*/
int
db_exist(
@@ -509,7 +493,7 @@ db_exist(
* db_last --
* Return the number of lines in the file.
*
- * PUBLIC: int db_last __P((SCR *, recno_t *));
+ * PUBLIC: int db_last(SCR *, recno_t *);
*/
int
db_last(
@@ -552,8 +536,6 @@ alloc_err:
case 1:
*lnop = 0;
return (0);
- case 0:
- ;
}
memcpy(&lno, key.data, sizeof(lno));
@@ -581,9 +563,9 @@ alloc_err:
/*
* db_rget --
- * Retrieve a raw line from database. No cache, no conversion.
+ * Retrieve a raw line from the database.
*
- * PUBLIC: int db_rget __P((SCR *, recno_t, char **, size_t *));
+ * PUBLIC: int db_rget(SCR *, recno_t, char **, size_t *);
*/
int
db_rget(
@@ -593,31 +575,26 @@ db_rget(
size_t *lenp) /* Length store. */
{
DBT data, key;
- EXF *ep;
-
- /* Check for no underlying file. */
- if ((ep = sp->ep) == NULL)
- return (1);
+ EXF *ep = sp->ep;
+ int rval;
/* Get the line from the underlying database. */
key.data = &lno;
key.size = sizeof(lno);
- if (ep->db->get(ep->db, &key, &data, 0))
- /* We do not report error, and do not ensure the size! */
- return (1);
-
- if (lenp != NULL)
+ if ((rval = ep->db->get(ep->db, &key, &data, 0)) == 0)
+ {
*lenp = data.size;
- if (pp != NULL)
*pp = data.data;
- return (0);
+ }
+
+ return (rval);
}
/*
* db_rset --
- * Store a line in the file. No log, no conversion.
+ * Store a raw line into the database.
*
- * PUBLIC: int db_rset __P((SCR *, recno_t, char *, size_t));
+ * PUBLIC: int db_rset(SCR *, recno_t, char *, size_t);
*/
int
db_rset(
@@ -627,29 +604,21 @@ db_rset(
size_t len)
{
DBT data, key;
- EXF *ep;
+ EXF *ep = sp->ep;
- /* Check for no underlying file. */
- if ((ep = sp->ep) == NULL)
- return (1);
-
/* Update file. */
key.data = &lno;
key.size = sizeof(lno);
data.data = p;
data.size = len;
- if (ep->db->put(ep->db, &key, &data, 0) == -1)
- /* We do not report error, and do not ensure the size! */
- return (1);
-
- return (0);
+ return ep->db->put(ep->db, &key, &data, 0);
}
/*
* db_err --
* Report a line error.
*
- * PUBLIC: void db_err __P((SCR *, recno_t));
+ * PUBLIC: void db_err(SCR *, recno_t);
*/
void
db_err(
diff --git a/common/log.c b/common/log.c
index eb8d85bc84cf..5adfeaf0fc58 100644
--- a/common/log.c
+++ b/common/log.c
@@ -63,13 +63,13 @@ static const char sccsid[] = "$Id: log.c,v 10.27 2011/07/13 06:25:50 zy Exp $";
* behaved that way.
*/
-static int log_cursor1 __P((SCR *, int));
-static void log_err __P((SCR *, char *, int));
+static int log_cursor1(SCR *, int);
+static void log_err(SCR *, char *, int);
#if defined(DEBUG) && 0
-static void log_trace __P((SCR *, char *, recno_t, u_char *));
+static void log_trace(SCR *, char *, recno_t, u_char *);
#endif
-static int apply_with __P((int (*)(SCR *, recno_t, CHAR_T *, size_t),
- SCR *, recno_t, u_char *, size_t));
+static int apply_with(int (*)(SCR *, recno_t, CHAR_T *, size_t),
+ SCR *, recno_t, u_char *, size_t);
/* Try and restart the log on failure, i.e. if we run out of memory. */
#define LOG_ERR { \
@@ -81,8 +81,8 @@ static int apply_with __P((int (*)(SCR *, recno_t, CHAR_T *, size_t),
* because it is passed to db_set as a string
*/
typedef struct {
- char data[sizeof(u_char) /* type */ + sizeof(recno_t)];
- CHAR_T str[1];
+ char data[sizeof(u_char) /* type */ + sizeof(recno_t)];
+ CHAR_T str[1];
} log_t;
#define CHAR_T_OFFSET ((char *)(((log_t*)0)->str) - (char *)0)
@@ -90,7 +90,7 @@ typedef struct {
* log_init --
* Initialize the logging subsystem.
*
- * PUBLIC: int log_init __P((SCR *, EXF *));
+ * PUBLIC: int log_init(SCR *, EXF *);
*/
int
log_init(
@@ -126,7 +126,7 @@ log_init(
* log_end --
* Close the logging subsystem.
*
- * PUBLIC: int log_end __P((SCR *, EXF *));
+ * PUBLIC: int log_end(SCR *, EXF *);
*/
int
log_end(
@@ -156,7 +156,7 @@ log_end(
* log_cursor --
* Log the current cursor position, starting an event.
*
- * PUBLIC: int log_cursor __P((SCR *));
+ * PUBLIC: int log_cursor(SCR *);
*/
int
log_cursor(SCR *sp)
@@ -221,7 +221,7 @@ log_cursor1(
* log_line --
* Log a line change.
*
- * PUBLIC: int log_line __P((SCR *, recno_t, u_int));
+ * PUBLIC: int log_line(SCR *, recno_t, u_int);
*/
int
log_line(
@@ -324,7 +324,7 @@ log_line(
* would mean that undo operations would only reset marks, and not
* cause any other change.
*
- * PUBLIC: int log_mark __P((SCR *, LMARK *));
+ * PUBLIC: int log_mark(SCR *, LMARK *);
*/
int
log_mark(
@@ -370,7 +370,7 @@ log_mark(
* Log_backward --
* Roll the log backward one operation.
*
- * PUBLIC: int log_backward __P((SCR *, MARK *));
+ * PUBLIC: int log_backward(SCR *, MARK *);
*/
int
log_backward(
@@ -474,7 +474,7 @@ err: F_CLR(ep, F_NOLOG);
* then move back on and do a 'U', the line will be restored to the way
* it was before the original change.
*
- * PUBLIC: int log_setline __P((SCR *));
+ * PUBLIC: int log_setline(SCR *);
*/
int
log_setline(SCR *sp)
@@ -558,7 +558,7 @@ err: F_CLR(ep, F_NOLOG);
* Log_forward --
* Roll the log forward one operation.
*
- * PUBLIC: int log_forward __P((SCR *, MARK *));
+ * PUBLIC: int log_forward(SCR *, MARK *);
*/
int
log_forward(
diff --git a/common/main.c b/common/main.c
index 6ff418173007..d9ae96f9e7dd 100644
--- a/common/main.c
+++ b/common/main.c
@@ -10,14 +10,6 @@
#include "config.h"
#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1992, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n\
-@(#) Copyright (c) 1992, 1993, 1994, 1995, 1996\n\
- Keith Bostic. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
static const char sccsid[] = "$Id: main.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
#endif /* not lint */
@@ -38,15 +30,15 @@ static const char sccsid[] = "$Id: main.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
#include "../vi/vi.h"
#include "pathnames.h"
-static void attach __P((GS *));
-static void v_estr __P((char *, int, char *));
-static int v_obsolete __P((char *, char *[]));
+static void attach(GS *);
+static void v_estr(char *, int, char *);
+static int v_obsolete(char *, char *[]);
/*
* editor --
* Main editor routine.
*
- * PUBLIC: int editor __P((GS *, int, char *[]));
+ * PUBLIC: int editor(GS *, int, char *[]);
*/
int
editor(
@@ -436,7 +428,7 @@ err: rval = 1;
* v_end --
* End the program, discarding screens and most of the global area.
*
- * PUBLIC: void v_end __P((GS *));
+ * PUBLIC: void v_end(GS *);
*/
void
v_end(gp)
@@ -455,7 +447,7 @@ v_end(gp)
while ((sp = TAILQ_FIRST(gp->hq)) != NULL)
(void)screen_end(sp);
-#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
+#if defined(DEBUG) || defined(PURIFY)
{ FREF *frp;
/* Free FREF's. */
while ((frp = TAILQ_FIRST(gp->frefq)) != NULL) {
@@ -499,13 +491,13 @@ v_end(gp)
(void)fprintf(stderr, "%s%.*s",
mp->mtype == M_ERR ? "ex/vi: " : "", (int)mp->len, mp->buf);
SLIST_REMOVE_HEAD(gp->msgq, q);
-#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
+#if defined(DEBUG) || defined(PURIFY)
free(mp->buf);
free(mp);
#endif
}
-#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
+#if defined(DEBUG) || defined(PURIFY)
/* Free any temporary space. */
if (gp->tmp_bp != NULL)
free(gp->tmp_bp);
diff --git a/common/mark.c b/common/mark.c
index 7a954392278c..a3158e4560b6 100644
--- a/common/mark.c
+++ b/common/mark.c
@@ -26,7 +26,7 @@ static const char sccsid[] = "$Id: mark.c,v 10.14 2011/07/04 14:42:58 zy Exp $";
#include "common.h"
-static LMARK *mark_find __P((SCR *, ARG_CHAR_T));
+static LMARK *mark_find(SCR *, ARG_CHAR_T);
/*
* Marks are maintained in a key sorted singly linked list. We can't
@@ -63,7 +63,7 @@ static LMARK *mark_find __P((SCR *, ARG_CHAR_T));
* mark_init --
* Set up the marks.
*
- * PUBLIC: int mark_init __P((SCR *, EXF *));
+ * PUBLIC: int mark_init(SCR *, EXF *);
*/
int
mark_init(
@@ -84,7 +84,7 @@ mark_init(
* mark_end --
* Free up the marks.
*
- * PUBLIC: int mark_end __P((SCR *, EXF *));
+ * PUBLIC: int mark_end(SCR *, EXF *);
*/
int
mark_end(
@@ -108,7 +108,7 @@ mark_end(
* mark_get --
* Get the location referenced by a mark.
*
- * PUBLIC: int mark_get __P((SCR *, ARG_CHAR_T, MARK *, mtype_t));
+ * PUBLIC: int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t);
*/
int
mark_get(
@@ -125,12 +125,12 @@ mark_get(
lmp = mark_find(sp, key);
if (lmp == NULL || lmp->name != key) {
msgq(sp, mtype, "017|Mark %s: not set", KEY_NAME(sp, key));
- return (1);
+ return (1);
}
if (F_ISSET(lmp, MARK_DELETED)) {
msgq(sp, mtype,
"018|Mark %s: the line was deleted", KEY_NAME(sp, key));
- return (1);
+ return (1);
}
/*
@@ -153,7 +153,7 @@ mark_get(
* mark_set --
* Set the location referenced by a mark.
*
- * PUBLIC: int mark_set __P((SCR *, ARG_CHAR_T, MARK *, int));
+ * PUBLIC: int mark_set(SCR *, ARG_CHAR_T, MARK *, int);
*/
int
mark_set(
@@ -220,7 +220,7 @@ mark_find(
* mark_insdel --
* Update the marks based on an insertion or deletion.
*
- * PUBLIC: int mark_insdel __P((SCR *, lnop_t, recno_t));
+ * PUBLIC: int mark_insdel(SCR *, lnop_t, recno_t);
*/
int
mark_insdel(
diff --git a/common/msg.c b/common/msg.c
index c0930b88afcd..3099b1e98b3c 100644
--- a/common/msg.c
+++ b/common/msg.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: msg.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
+static const char sccsid[] = "$Id: msg.c,v 11.1 2015/02/09 11:12:44 marc Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -36,7 +36,7 @@ static const char sccsid[] = "$Id: msg.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
* msgq --
* Display a message.
*
- * PUBLIC: void msgq __P((SCR *, mtype_t, const char *, ...));
+ * PUBLIC: void msgq(SCR *, mtype_t, const char *, ...);
*/
void
msgq(
@@ -60,7 +60,7 @@ msgq(
size_t blen, len, mlen, nlen;
const char *p;
char *bp, *mp;
- va_list ap;
+ va_list ap;
#ifndef NL_ARGMAX
int ch;
char *rbp, *s_rbp;
@@ -274,7 +274,7 @@ retry: FREE_SPACE(sp, bp, blen);
#ifndef NL_ARGMAX
format: /* Format the arguments into the string. */
#endif
- va_start(ap, fmt);
+ va_start(ap, fmt);
len = vsnprintf(mp, REM, fmt, ap);
va_end(ap);
if (len >= nlen)
@@ -356,7 +356,7 @@ alloc_err:
* msgq_wstr --
* Display a message with an embedded string.
*
- * PUBLIC: void msgq_wstr __P((SCR *, mtype_t, const CHAR_T *, const char *));
+ * PUBLIC: void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *);
*/
void
msgq_wstr(
@@ -380,7 +380,7 @@ msgq_wstr(
* msgq_str --
* Display a message with an embedded string.
*
- * PUBLIC: void msgq_str __P((SCR *, mtype_t, const char *, const char *));
+ * PUBLIC: void msgq_str(SCR *, mtype_t, const char *, const char *);
*/
void
msgq_str(
@@ -423,7 +423,7 @@ msgq_str(
* the command 2d}, from the 'b' would report that two lines were deleted,
* not one.
*
- * PUBLIC: void mod_rpt __P((SCR *));
+ * PUBLIC: void mod_rpt(SCR *);
*/
void
mod_rpt(SCR *sp)
@@ -533,7 +533,7 @@ alloc_err:
* msgq_status --
* Report on the file's status.
*
- * PUBLIC: void msgq_status __P((SCR *, recno_t, u_int));
+ * PUBLIC: void msgq_status(SCR *, recno_t, u_int);
*/
void
msgq_status(
@@ -647,7 +647,7 @@ msgq_status(
p += len;
} else {
t = msg_cat(sp, "027|line %lu of %lu [%ld%%]", &len);
- (void)snprintf(p, ep - p, t, lno, last,
+ (void)snprintf(p, ep - p, t, (u_long)lno, (u_long)last,
((u_long)lno * 100) / last);
p += strlen(p);
}
@@ -705,7 +705,7 @@ alloc_err:
* msg_open --
* Open the message catalogs.
*
- * PUBLIC: int msg_open __P((SCR *, char *));
+ * PUBLIC: int msg_open(SCR *, char *);
*/
int
msg_open(
@@ -772,7 +772,7 @@ ret: free(p);
* msg_close --
* Close the message catalogs.
*
- * PUBLIC: void msg_close __P((GS *));
+ * PUBLIC: void msg_close(GS *);
*/
void
msg_close(GS *gp)
@@ -785,7 +785,7 @@ msg_close(GS *gp)
* msg_cont --
* Return common continuation messages.
*
- * PUBLIC: const char *msg_cmsg __P((SCR *, cmsg_t, size_t *));
+ * PUBLIC: const char *msg_cmsg(SCR *, cmsg_t, size_t *);
*/
const char *
msg_cmsg(
@@ -823,7 +823,7 @@ msg_cmsg(
* Only a single catalog message can be accessed at a time, if multiple
* ones are needed, they must be copied into local memory.
*
- * PUBLIC: const char *msg_cat __P((SCR *, const char *, size_t *));
+ * PUBLIC: const char *msg_cat(SCR *, const char *, size_t *);
*/
const char *
msg_cat(
@@ -861,7 +861,7 @@ msg_cat(
* msg_print --
* Return a printable version of a string, in allocated memory.
*
- * PUBLIC: char *msg_print __P((SCR *, const char *, int *));
+ * PUBLIC: char *msg_print(SCR *, const char *, int *);
*/
char *
msg_print(
diff --git a/common/options.c b/common/options.c
index 71a5e43e58cb..e619d8f08eb7 100644
--- a/common/options.c
+++ b/common/options.c
@@ -30,9 +30,9 @@ static const char sccsid[] = "$Id: options.c,v 10.73 2012/10/09 06:14:07 zy Exp
#include "../vi/vi.h"
#include "pathnames.h"
-static int opts_abbcmp __P((const void *, const void *));
-static int opts_cmp __P((const void *, const void *));
-static int opts_print __P((SCR *, OPTLIST const *));
+static int opts_abbcmp(const void *, const void *);
+static int opts_cmp(const void *, const void *);
+static int opts_print(SCR *, OPTLIST const *);
#ifdef USE_WIDECHAR
#define OPT_WC 0
@@ -243,8 +243,8 @@ OPTLIST const optlist[] = {
};
typedef struct abbrev {
- CHAR_T *name;
- int offset;
+ CHAR_T *name;
+ int offset;
} OABBREV;
static OABBREV const abbrev[] = {
@@ -294,7 +294,7 @@ static OABBREV const abbrev[] = {
* opts_init --
* Initialize some of the options.
*
- * PUBLIC: int opts_init __P((SCR *, int *));
+ * PUBLIC: int opts_init(SCR *, int *);
*/
int
opts_init(
@@ -460,7 +460,7 @@ err: msgq_wstr(sp, M_ERR, optlist[optindx].name,
* opts_set --
* Change the values of one or more options.
*
- * PUBLIC: int opts_set __P((SCR *, ARGS *[], char *));
+ * PUBLIC: int opts_set(SCR *, ARGS *[], char *);
*/
int
opts_set(
@@ -754,7 +754,7 @@ badnum: INT2CHAR(sp, name, STRLEN(name) + 1,
* o_set --
* Set an option's value.
*
- * PUBLIC: int o_set __P((SCR *, int, u_int, char *, u_long));
+ * PUBLIC: int o_set(SCR *, int, u_int, char *, u_long);
*/
int
o_set(
@@ -798,7 +798,7 @@ o_set(
* opts_empty --
* Return 1 if the string option is invalid, 0 if it's OK.
*
- * PUBLIC: int opts_empty __P((SCR *, int, int));
+ * PUBLIC: int opts_empty(SCR *, int, int);
*/
int
opts_empty(
@@ -821,7 +821,7 @@ opts_empty(
* opts_dump --
* List the current values of selected options.
*
- * PUBLIC: void opts_dump __P((SCR *, enum optdisp));
+ * PUBLIC: void opts_dump(SCR *, enum optdisp);
*/
void
opts_dump(
@@ -987,7 +987,7 @@ opts_print(
* opts_save --
* Write the current configuration to a file.
*
- * PUBLIC: int opts_save __P((SCR *, FILE *));
+ * PUBLIC: int opts_save(SCR *, FILE *);
*/
int
opts_save(
@@ -1045,7 +1045,7 @@ opts_save(
* opts_search --
* Search for an option.
*
- * PUBLIC: OPTLIST const *opts_search __P((CHAR_T *));
+ * PUBLIC: OPTLIST const *opts_search(CHAR_T *);
*/
OPTLIST const *
opts_search(CHAR_T *name)
@@ -1090,7 +1090,7 @@ opts_search(CHAR_T *name)
* opts_nomatch --
* Standard nomatch error message for options.
*
- * PUBLIC: void opts_nomatch __P((SCR *, CHAR_T *));
+ * PUBLIC: void opts_nomatch(SCR *, CHAR_T *);
*/
void
opts_nomatch(
@@ -1103,25 +1103,25 @@ opts_nomatch(
static int
opts_abbcmp(
- const void *a,
- const void *b)
+ const void *a,
+ const void *b)
{
- return(STRCMP(((OABBREV *)a)->name, ((OABBREV *)b)->name));
+ return(STRCMP(((OABBREV *)a)->name, ((OABBREV *)b)->name));
}
static int
opts_cmp(
- const void *a,
- const void *b)
+ const void *a,
+ const void *b)
{
- return(STRCMP(((OPTLIST *)a)->name, ((OPTLIST *)b)->name));
+ return(STRCMP(((OPTLIST *)a)->name, ((OPTLIST *)b)->name));
}
/*
* opts_copy --
* Copy a screen's OPTION array.
*
- * PUBLIC: int opts_copy __P((SCR *, SCR *));
+ * PUBLIC: int opts_copy(SCR *, SCR *);
*/
int
opts_copy(
@@ -1169,7 +1169,7 @@ nomem: msgq(orig, M_SYSERR, NULL);
* opts_free --
* Free all option strings
*
- * PUBLIC: void opts_free __P((SCR *));
+ * PUBLIC: void opts_free(SCR *);
*/
void
opts_free(SCR *sp)
diff --git a/common/options.h b/common/options.h
index fe1f80f5f16d..aaeece144d89 100644
--- a/common/options.h
+++ b/common/options.h
@@ -78,7 +78,7 @@ struct _option {
struct _optlist {
CHAR_T *name; /* Name. */
/* Change function. */
- int (*func) __P((SCR *, OPTION *, char *, u_long *));
+ int (*func)(SCR *, OPTION *, char *, u_long *);
/* Type of object. */
enum { OPT_0BOOL, OPT_1BOOL, OPT_NUM, OPT_STR } type;
diff --git a/common/options_f.c b/common/options_f.c
index 482a37e39d39..850bfc2eca5c 100644
--- a/common/options_f.c
+++ b/common/options_f.c
@@ -29,7 +29,7 @@ static const char sccsid[] = "$Id: options_f.c,v 10.34 04/07/11 16:06:29 zy Exp
#include "common.h"
/*
- * PUBLIC: int f_altwerase __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_altwerase(SCR *, OPTION *, char *, u_long *);
*/
int
f_altwerase(
@@ -44,7 +44,7 @@ f_altwerase(
}
/*
- * PUBLIC: int f_columns __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_columns(SCR *, OPTION *, char *, u_long *);
*/
int
f_columns(
@@ -78,7 +78,7 @@ f_columns(
}
/*
- * PUBLIC: int f_lines __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_lines(SCR *, OPTION *, char *, u_long *);
*/
int
f_lines(
@@ -135,7 +135,7 @@ f_lines(
}
/*
- * PUBLIC: int f_lisp __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_lisp(SCR *, OPTION *, char *, u_long *);
*/
int
f_lisp(
@@ -149,7 +149,7 @@ f_lisp(
}
/*
- * PUBLIC: int f_msgcat __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_msgcat(SCR *, OPTION *, char *, u_long *);
*/
int
f_msgcat(
@@ -163,7 +163,7 @@ f_msgcat(
}
/*
- * PUBLIC: int f_print __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_print(SCR *, OPTION *, char *, u_long *);
*/
int
f_print(
@@ -192,7 +192,7 @@ f_print(
}
/*
- * PUBLIC: int f_readonly __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_readonly(SCR *, OPTION *, char *, u_long *);
*/
int
f_readonly(
@@ -213,7 +213,7 @@ f_readonly(
}
/*
- * PUBLIC: int f_recompile __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_recompile(SCR *, OPTION *, char *, u_long *);
*/
int
f_recompile(
@@ -234,7 +234,7 @@ f_recompile(
}
/*
- * PUBLIC: int f_reformat __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_reformat(SCR *, OPTION *, char *, u_long *);
*/
int
f_reformat(
@@ -248,7 +248,7 @@ f_reformat(
}
/*
- * PUBLIC: int f_ttywerase __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_ttywerase(SCR *, OPTION *, char *, u_long *);
*/
int
f_ttywerase(
@@ -263,7 +263,7 @@ f_ttywerase(
}
/*
- * PUBLIC: int f_w300 __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_w300(SCR *, OPTION *, char *, u_long *);
*/
int
f_w300(
@@ -284,7 +284,7 @@ f_w300(
}
/*
- * PUBLIC: int f_w1200 __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_w1200(SCR *, OPTION *, char *, u_long *);
*/
int
f_w1200(
@@ -305,7 +305,7 @@ f_w1200(
}
/*
- * PUBLIC: int f_w9600 __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_w9600(SCR *, OPTION *, char *, u_long *);
*/
int
f_w9600(
@@ -326,7 +326,7 @@ f_w9600(
}
/*
- * PUBLIC: int f_window __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_window(SCR *, OPTION *, char *, u_long *);
*/
int
f_window(
@@ -342,7 +342,7 @@ f_window(
}
/*
- * PUBLIC: int f_encoding __P((SCR *, OPTION *, char *, u_long *));
+ * PUBLIC: int f_encoding(SCR *, OPTION *, char *, u_long *);
*/
int
f_encoding(
diff --git a/common/put.c b/common/put.c
index 6e9dc09902de..d3adf5c08607 100644
--- a/common/put.c
+++ b/common/put.c
@@ -30,7 +30,7 @@ static const char sccsid[] = "$Id: put.c,v 10.19 04/07/11 17:00:24 zy Exp $";
* put --
* Put text buffer contents into the file.
*
- * PUBLIC: int put __P((SCR *, CB *, CHAR_T *, MARK *, MARK *, int));
+ * PUBLIC: int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int);
*/
int
put(
diff --git a/common/recover.c b/common/recover.c
index b20471f111b2..d0a927bd4301 100644
--- a/common/recover.c
+++ b/common/recover.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: recover.c,v 11.2 2012/10/09 08:06:58 zy Exp $";
+static const char sccsid[] = "$Id: recover.c,v 11.3 2015/04/04 03:50:42 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -102,18 +102,18 @@ static const char sccsid[] = "$Id: recover.c,v 11.2 2012/10/09 08:06:58 zy Exp $
#define VI_DHEADER "X-vi-data:"
-static int rcv_copy __P((SCR *, int, char *));
-static void rcv_email __P((SCR *, char *));
-static int rcv_mailfile __P((SCR *, int, char *));
-static int rcv_mktemp __P((SCR *, char *, char *));
-static int rcv_dlnwrite __P((SCR *, const char *, const char *, FILE *));
-static int rcv_dlnread __P((SCR *, char **, char **, FILE *));
+static int rcv_copy(SCR *, int, char *);
+static void rcv_email(SCR *, char *);
+static int rcv_mailfile(SCR *, int, char *);
+static int rcv_mktemp(SCR *, char *, char *);
+static int rcv_dlnwrite(SCR *, const char *, const char *, FILE *);
+static int rcv_dlnread(SCR *, char **, char **, FILE *);
/*
* rcv_tmp --
* Build a file name that will be used as the recovery file.
*
- * PUBLIC: int rcv_tmp __P((SCR *, EXF *, char *));
+ * PUBLIC: int rcv_tmp(SCR *, EXF *, char *);
*/
int
rcv_tmp(
@@ -172,7 +172,7 @@ err: msgq(sp, M_ERR,
* rcv_init --
* Force the file to be snapshotted for recovery.
*
- * PUBLIC: int rcv_init __P((SCR *));
+ * PUBLIC: int rcv_init(SCR *);
*/
int
rcv_init(SCR *sp)
@@ -234,7 +234,7 @@ err: msgq(sp, M_ERR,
* sending email to the user if the file was modified
* ending the file session
*
- * PUBLIC: int rcv_sync __P((SCR *, u_int));
+ * PUBLIC: int rcv_sync(SCR *, u_int);
*/
int
rcv_sync(
@@ -252,15 +252,12 @@ rcv_sync(
/* Sync the file if it's been modified. */
if (F_ISSET(ep, F_MODIFIED)) {
- SIGBLOCK;
if (ep->db->sync(ep->db, R_RECNOSYNC)) {
F_CLR(ep, F_RCV_ON | F_RCV_NORM);
msgq_str(sp, M_SYSERR,
ep->rcv_path, "060|File backup failed: %s");
- SIGUNBLOCK;
return (1);
}
- SIGUNBLOCK;
/* REQUEST: don't remove backing file on exit. */
if (LF_ISSET(RCV_PRESERVE))
@@ -505,7 +502,7 @@ err: if (!issync)
* rcv_list --
* List the files that can be recovered by this user.
*
- * PUBLIC: int rcv_list __P((SCR *));
+ * PUBLIC: int rcv_list(SCR *);
*/
int
rcv_list(SCR *sp)
@@ -612,7 +609,7 @@ next: (void)fclose(fp);
* rcv_read --
* Start a recovered file as the file to edit.
*
- * PUBLIC: int rcv_read __P((SCR *, FREF *));
+ * PUBLIC: int rcv_read(SCR *, FREF *);
*/
int
rcv_read(
@@ -635,7 +632,7 @@ rcv_read(
return (1);
rp = O_STR(sp, O_RECDIR);
if ((dirp = opendir(rp)) == NULL) {
- msgq_str(sp, M_ERR, rp, "%s");
+ msgq_str(sp, M_SYSERR, rp, "%s");
return (1);
}
diff --git a/common/screen.c b/common/screen.c
index 9ff684509d94..ae6fb207567f 100644
--- a/common/screen.c
+++ b/common/screen.c
@@ -32,7 +32,7 @@ static const char sccsid[] = "$Id: screen.c,v 10.25 2011/12/04 04:06:45 zy Exp $
* screen_init --
* Do the default initialization of an SCR structure.
*
- * PUBLIC: int screen_init __P((GS *, SCR *, SCR **));
+ * PUBLIC: int screen_init(GS *, SCR *, SCR **);
*/
int
screen_init(
@@ -129,7 +129,7 @@ err: screen_end(sp);
* Release a screen, no matter what had (and had not) been
* initialized.
*
- * PUBLIC: int screen_end __P((SCR *));
+ * PUBLIC: int screen_end(SCR *);
*/
int
screen_end(SCR *sp)
@@ -205,7 +205,7 @@ screen_end(SCR *sp)
* screen_next --
* Return the next screen in the queue.
*
- * PUBLIC: SCR *screen_next __P((SCR *));
+ * PUBLIC: SCR *screen_next(SCR *);
*/
SCR *
screen_next(SCR *sp)
diff --git a/common/search.c b/common/search.c
index 22f020315070..4831a0874aae 100644
--- a/common/search.c
+++ b/common/search.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "$Id: search.c,v 10.26 2011/07/04 20:16:26 zy Exp $";
+static const char sccsid[] = "$Id: search.c,v 10.27 2015/03/13 18:41:35 zy Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -30,8 +30,8 @@ static const char sccsid[] = "$Id: search.c,v 10.26 2011/07/04 20:16:26 zy Exp $
typedef enum { S_EMPTY, S_EOF, S_NOPREV, S_NOTFOUND, S_SOF, S_WRAP } smsg_t;
-static void search_msg __P((SCR *, smsg_t));
-static int search_init __P((SCR *, dir_t, CHAR_T *, size_t, CHAR_T **, u_int));
+static void search_msg(SCR *, smsg_t);
+static int search_init(SCR *, dir_t, CHAR_T *, size_t, CHAR_T **, u_int);
/*
* search_init --
@@ -142,8 +142,8 @@ prev: if (sp->re == NULL) {
* f_search --
* Do a forward search.
*
- * PUBLIC: int f_search __P((SCR *,
- * PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
+ * PUBLIC: int f_search(SCR *,
+ * PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
*/
int
f_search(
@@ -159,7 +159,7 @@ f_search(
recno_t lno;
regmatch_t match[1];
size_t coff, len;
- int cnt, eval, rval, wrapped;
+ int cnt, eval, rval, wrapped = 0;
CHAR_T *l;
if (search_init(sp, FORWARD, ptrn, plen, eptrn, flags))
@@ -198,13 +198,14 @@ f_search(
return (1);
}
lno = 1;
+ wrapped = 1;
}
} else
coff = fm->cno + 1;
}
btype = BUSY_ON;
- for (cnt = INTERRUPT_CHECK, rval = 1, wrapped = 0;; ++lno, coff = 0) {
+ for (cnt = INTERRUPT_CHECK, rval = 1;; ++lno, coff = 0) {
if (cnt-- == 0) {
if (INTERRUPTED(sp))
break;
@@ -288,8 +289,8 @@ f_search(
* b_search --
* Do a backward search.
*
- * PUBLIC: int b_search __P((SCR *,
- * PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
+ * PUBLIC: int b_search(SCR *,
+ * PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
*/
int
b_search(
@@ -487,7 +488,7 @@ search_msg(
* search_busy --
* Put up the busy searching message.
*
- * PUBLIC: void search_busy __P((SCR *, busy_t));
+ * PUBLIC: void search_busy(SCR *, busy_t);
*/
void
search_busy(
diff --git a/common/seq.c b/common/seq.c
index 45c6c1111083..61c7fcd0b285 100644
--- a/common/seq.c
+++ b/common/seq.c
@@ -31,8 +31,8 @@ static const char sccsid[] = "$Id: seq.c,v 10.18 2011/12/11 23:13:00 zy Exp $";
* seq_set --
* Internal version to enter a sequence.
*
- * PUBLIC: int seq_set __P((SCR *, CHAR_T *,
- * PUBLIC: size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int));
+ * PUBLIC: int seq_set(SCR *, CHAR_T *,
+ * PUBLIC: size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int);
*/
int
seq_set(
@@ -136,7 +136,7 @@ mem1: errno = sv_errno;
* seq_delete --
* Delete a sequence.
*
- * PUBLIC: int seq_delete __P((SCR *, CHAR_T *, size_t, seq_t));
+ * PUBLIC: int seq_delete(SCR *, CHAR_T *, size_t, seq_t);
*/
int
seq_delete(
@@ -172,7 +172,7 @@ seq_delete(
* seq_free --
* Free a map entry.
*
- * PUBLIC: int seq_free __P((SEQ *));
+ * PUBLIC: int seq_free(SEQ *);
*/
int
seq_free(SEQ *qp)
@@ -193,7 +193,7 @@ seq_free(SEQ *qp)
* isn't NULL, partial matches count.
*
* PUBLIC: SEQ *seq_find
- * PUBLIC: __P((SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *));
+ * PUBLIC: (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *);
*/
SEQ *
seq_find(
@@ -278,7 +278,7 @@ seq_find(
* seq_close --
* Discard all sequences.
*
- * PUBLIC: void seq_close __P((GS *));
+ * PUBLIC: void seq_close(GS *);
*/
void
seq_close(GS *gp)
@@ -295,7 +295,7 @@ seq_close(GS *gp)
* seq_dump --
* Display the sequence entries of a specified type.
*
- * PUBLIC: int seq_dump __P((SCR *, seq_t, int));
+ * PUBLIC: int seq_dump(SCR *, seq_t, int);
*/
int
seq_dump(
@@ -343,7 +343,7 @@ seq_dump(
* seq_save --
* Save the sequence entries to a file.
*
- * PUBLIC: int seq_save __P((SCR *, FILE *, char *, seq_t));
+ * PUBLIC: int seq_save(SCR *, FILE *, char *, seq_t);
*/
int
seq_save(
@@ -389,7 +389,7 @@ seq_save(
* e_memcmp --
* Compare a string of EVENT's to a string of CHAR_T's.
*
- * PUBLIC: int e_memcmp __P((CHAR_T *, EVENT *, size_t));
+ * PUBLIC: int e_memcmp(CHAR_T *, EVENT *, size_t);
*/
int
e_memcmp(
@@ -398,11 +398,11 @@ e_memcmp(
size_t n)
{
if (n != 0) {
- do {
- if (*p1++ != ep->e_c)
- return (*--p1 - ep->e_c);
+ do {
+ if (*p1++ != ep->e_c)
+ return (*--p1 - ep->e_c);
++ep;
- } while (--n != 0);
- }
- return (0);
+ } while (--n != 0);
+ }
+ return (0);
}
diff --git a/common/util.c b/common/util.c
index 43fa9d1e9f20..44c8e29482e6 100644
--- a/common/util.c
+++ b/common/util.c
@@ -39,7 +39,7 @@ static const char sccsid[] = "$Id: util.c,v 10.30 2013/03/19 10:00:27 yamt Exp $
* binc --
* Increase the size of a buffer.
*
- * PUBLIC: void *binc __P((SCR *, void *, size_t *, size_t));
+ * PUBLIC: void *binc(SCR *, void *, size_t *, size_t);
*/
void *
binc(
@@ -76,7 +76,7 @@ binc(
* including or after the starting column. On error, set
* the column to 0, it's safest.
*
- * PUBLIC: int nonblank __P((SCR *, recno_t, size_t *));
+ * PUBLIC: int nonblank(SCR *, recno_t, size_t *);
*/
int
nonblank(
@@ -112,7 +112,7 @@ nonblank(
* tail --
* Return tail of a path.
*
- * PUBLIC: char *tail __P((char *));
+ * PUBLIC: char *tail(char *);
*/
char *
tail(char *path)
@@ -128,12 +128,12 @@ tail(char *path)
* join --
* Join two paths; need free.
*
- * PUBLIC: char *join __P((char *, char *));
+ * PUBLIC: char *join(char *, char *);
*/
char *
join(
- char *path1,
- char *path2)
+ char *path1,
+ char *path2)
{
char *p;
@@ -148,7 +148,7 @@ join(
* expanduser --
* Return a "~" or "~user" expanded path; need free.
*
- * PUBLIC: char *expanduser __P((char *));
+ * PUBLIC: char *expanduser(char *);
*/
char *
expanduser(char *str)
@@ -198,7 +198,7 @@ expanduser(char *str)
* quote --
* Return a escaped string for /bin/sh; need free.
*
- * PUBLIC: char *quote __P((char *));
+ * PUBLIC: char *quote(char *);
*/
char *
quote(char *str)
@@ -245,7 +245,7 @@ quote(char *str)
* v_strdup --
* Strdup for 8-bit character strings with an associated length.
*
- * PUBLIC: char *v_strdup __P((SCR *, const char *, size_t));
+ * PUBLIC: char *v_strdup(SCR *, const char *, size_t);
*/
char *
v_strdup(
@@ -267,7 +267,7 @@ v_strdup(
* v_wstrdup --
* Strdup for wide character strings with an associated length.
*
- * PUBLIC: CHAR_T *v_wstrdup __P((SCR *, const CHAR_T *, size_t));
+ * PUBLIC: CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t);
*/
CHAR_T *
v_wstrdup(SCR *sp,
@@ -288,7 +288,7 @@ v_wstrdup(SCR *sp,
* nget_uslong --
* Get an unsigned long, checking for overflow.
*
- * PUBLIC: enum nresult nget_uslong __P((u_long *, const CHAR_T *, CHAR_T **, int));
+ * PUBLIC: enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int);
*/
enum nresult
nget_uslong(
@@ -310,7 +310,7 @@ nget_uslong(
* nget_slong --
* Convert a signed long, checking for overflow and underflow.
*
- * PUBLIC: enum nresult nget_slong __P((long *, const CHAR_T *, CHAR_T **, int));
+ * PUBLIC: enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int);
*/
enum nresult
nget_slong(
@@ -336,7 +336,7 @@ nget_slong(
* timepoint_steady --
* Get a timestamp from a monotonic clock.
*
- * PUBLIC: void timepoint_steady __P((struct timespec *));
+ * PUBLIC: void timepoint_steady(struct timespec *);
*/
void
timepoint_steady(
@@ -367,7 +367,7 @@ timepoint_steady(
* timepoint_system --
* Get the current calendar time.
*
- * PUBLIC: void timepoint_system __P((struct timespec *));
+ * PUBLIC: void timepoint_system(struct timespec *);
*/
void
timepoint_system(
@@ -401,7 +401,7 @@ timepoint_system(
* TRACE --
* debugging trace routine.
*
- * PUBLIC: void TRACE __P((SCR *, const char *, ...));
+ * PUBLIC: void TRACE(SCR *, const char *, ...);
*/
void
TRACE(
diff --git a/docs/TODO b/docs/TODO
deleted file mode 100644
index 6fe88295d5ff..000000000000
--- a/docs/TODO
+++ /dev/null
@@ -1,147 +0,0 @@
-CL: In single-line screens, have to press 'q' twice when quitting out
- of a ":set all" display.
-
-COMMON: There's a serious problem with error returns -- we need to separate
- command failure from fatal error, consistently, over the entire source
- tree.
-
- We need to rework all of vi to have three return values:
-
- 0: success
- 1: vi error, continue
- 2: fatal error, die
-
- Right now we don't recognize fatal errors for what they are.
-
-VI: Change the screen scrolling to not eat user characters... i.e.
- g/pattern/foo should not eat already entered chars.
-
-COMMON: It's known that it's possible to sync the backing files in the
- wrong manner, leaving backup files that aren't recoverable. This
- is going to be left alone until we have a logging version of DB,
- which will hopefully fix this (or at least make it possible to
- easily do so).
-
-COMMON: The complete list of POSIX.1 calls that can return EINTR are:
-
- wait, waitpid, sleep, dup2, close, read, write,
- fcntl(SETLCKW) tcsetattr, tcdrain
-
- The problem is that technically, any system/library call can
- return EINTR, so, while nvi blocks (most of?) the obvious ones,
- someone may have to do a complete pass and block signals
- everywhere.
-
-COMMON: The vi main command loop should use the general-purpose overflow
- and underflow routines. In addition, the vi command loop uses
- unsigned longs -- should probably be fixed as a 32-bit unsigned
- type, and then check to make sure it's never used as as variable
- type again.
-
-DB: When nvi edits files that don't have trailing newlines, it appends
- one, regardless. This is required, by default, from POSIX.2.
-
-COMMON: Open mode is not yet implemented.
-
-COMMON: ^C isn't passed to the shell in the script windows as an interrupt
- character.
-
-COMMON: The options:
-
- hardtabs, lisp, optimize, redraw, slowopen
-
- are recognized, but not implemented. These options are unlikely
- to be implemented, so if you want them you might want to say
- something! I will implement lisp if anyone ever documents how it
- worked.
-
-COMMON: If you run out of space in the recovery directory, the recovery
- file is left in place.
-
-COMMON: Should "view" set a lock on the file?
-
-COMMON: Field editing shouldn't be hard to add to nvi:
-
- Field editing file template:
-
- version #
- field # row/column start row/column stop
- label field # Label string
- re field # Matching re string.
- field # row/column start row/column stop
- label field # Label string
- re field # Matching re string.
-
- <tab> moves to the next field
- <bs> in column 0 moves to the previous field
-
-COMMON: Let's rethink using an IPC mechanism:
-
- Two way channel, with events passing in both directions.
-
- Load into the same address space (else, how do file permissions) forks
- in v_init -- screens get events from vi, vi gets events queued up from
- screens.
-
- Vi:
- E_CHARACTER, /* Input character: e_c set. */
- E_EOF, /* End of input (NOT ^D). */
- E_ERR, /* Input error. */
- E_INTERRUPT, /* Interrupt. */
- E_REPAINT, /* Repaint: e_flno, e_tlno set. */
- E_RESIZE, /* SIGWINCH: e_lno, e_cno set. */
- E_SIGCONT, /* SIGCONT arrived. */
- E_SIGFATAL, /* fatal signal arrived.
- E_START, /* Start ex/vi. */
- E_STOP, /* Stop ex/vi. */
- E_STRING, /* Input string: e_csp, e_len set. */
-
- Screen:
- E_ADDSTR /* Add a string to the screen. */
- E_ATTRIBUTE /* Screen attribute. */
- E_BELL /* Beep/bell/flash the terminal. */
- E_BUSY /* Display a busy message. */
- E_CANONICAL /* Enter tty canonical mode. */
- E_CLRTOEOL /* Clear to the end of the line. */
- E_CURSOR /* Return the cursor location. */
- E_DELETELN /* Delete a line. */
- E_DISCARD /* Discard a screen. */
- E_EXADJUST /* Ex: screen adjustment routine. */
- E_FMAP /* Set a function key. */
- E_GETKEY /* Get a key event. */
- E_INSERTLN /* Insert a line. */
- E_MOVE /* Move the cursor. */
- E_MESSAGE /* Message or ex output. */
- E_REFRESH /* Refresh the screen. */
- E_RESIZE /* Resize two screens. */
- E_SPLIT /* Split the screen. */
- E_SUSPEND /* Suspend the editor. */
-
-EX: It would be nice to inverse video the replaced text during
- interactive substitute.
-
-EX: The :args command should put the current file name out in reverse
- video. This isn't going to be easy, currently only full lines can
- be in reverse video, not just parts.
-
-TK: We currently permit the user to change the lines, columns and term
- edit options. Shouldn't that be illegal in tknvi?
-
-VI: The strings found by searches should be highlighted until the next
- character is entered.
-
-VI: Display a split vi screen for the :help command.
-
-VI: When getting a key for a continue screen, we should always read from
- the terminal, not from a mapped key.
-
-VI: The sentence, paragraph and section movement commands don't match
- historic practice in some boundary cases. This should be left
- alone until POSIX 1003.2 makes up its mind.
-
-VI: The vs_sm_fill routine should scroll if possible, not always redraw.
-
-VI: Think about setting a dirty/inuse bits on the lines of the SMAP
- structure. That way the message routines could steal lines and
- refresh would continue to work, because it would know not to touch
- the lines that were in use.
diff --git a/docs/USD.doc/edit/Makefile b/docs/USD.doc/edit/Makefile
deleted file mode 100644
index 0c59f6d0816e..000000000000
--- a/docs/USD.doc/edit/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# @(#)Makefile 8.4 (Berkeley) 8/18/96
-
-ROFF= groff
-TBL= tbl
-
-edittut.ps: edittut.ms
- ${TBL} edittut.ms | ${ROFF} -ms > $@
- chmod 444 $@
-
-clean:
- rm -f edittut.ps
diff --git a/docs/USD.doc/edit/edit.vindex b/docs/USD.doc/edit/edit.vindex
deleted file mode 100644
index 2098f14ea190..000000000000
--- a/docs/USD.doc/edit/edit.vindex
+++ /dev/null
@@ -1,115 +0,0 @@
-.\" 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. 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
diff --git a/docs/USD.doc/edit/edittut.ms b/docs/USD.doc/edit/edittut.ms
deleted file mode 100644
index 8a9d66ede2e6..000000000000
--- a/docs/USD.doc/edit/edittut.ms
+++ /dev/null
@@ -1,2280 +0,0 @@
-.\" 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. 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.
-.\"
-.\" @(#)edittut.ms 8.3 (Berkeley) 8/18/96
-.\"
-.ll 6.5i
-.nr LL 6.5i
-.EH 'USD:11-%''Edit: A Tutorial'
-.OH 'Edit: A Tutorial''USD:11-%'
-.LP
-.ds u \s-2UNIX\s0
-.ND
-.sp 4
-.ce
-\f3\s+2Edit: A Tutorial\s0\f1
-.sp
-.ce 3
-.I
-Ricki Blau
-.sp
-James Joyce
-.R
-.sp
-.ce 3
-Computing Services
-University of California
-Berkeley, California 94720
-.sp 3
-.ce
-.I
-ABSTRACT
-.R
-.sp
-.LP
-This narrative introduction to the use of the text editor
-.I edit
-assumes no prior familiarity with computers or with text editing.
-Its aim is to lead the beginning \s-2UNIX\(dg\s+2 user through the
-.FS
-\(dgUNIX is a trademark of Bell Laboratories.
-.FE
-fundamental steps of writing and revising a file of text.
-Edit,
-a version of the text editor
-.I ex,
-was designed to provide an informative environment
-for new and casual users.
-.PP
-We welcome comments and suggestions about this tutorial
-and the \s-2UNIX\s+2 documentation in general.
-.sp .5v
-September 1981
-.bp
-.ll 6.5i
-.nr LL 6.5i
-.nr LT 6.5i
-.ds u \s-2UNIX\s0
-.ce
-\s+2\f3Contents\f1\s0
-.LP
-.nf
-Introduction\ \ \ 3
-.sp
-Session 1\ \ 4
-.in +.5i
-Making contact with \s-2UNIX\s+2\ \ \ 4
-Logging in\ \ 4
-Asking for \fIedit\fR\ \ \ 4
-The ``Command not found'' message\ \ \ 5
-A summary\ \ 5
-Entering text\ \ \ 5
-Messages from \fIedit\fR\ \ \ 5
-Text input mode\ \ \ 6
-Making corrections\ \ \ 6
-Writing text to disk\ \ \ 7
-Signing off\ \ 7
-.in -.5i
-.sp
-Session 2\ \ \ 8
-.in +.5i
-Adding more text to the file\ \ \ 8
-Interrupt\ \ \ 8
-Making corrections\ \ \ 8
-Listing what's in the buffer (p)\ \ \ 9
-Finding things in the buffer\ \ \ 9
-The current line\ \ \ 10
-Numbering lines (nu)\ \ \ 10
-Substitute command (s)\ \ \ 10
-Another way to list what's in the buffer (z)\ \ \ 11
-Saving the modified text\ \ \ 12
-.in -.5i
-.sp
-Session 3\ \ \ 13
-.in +.5i
-Bringing text into the buffer (e)\ \ \ 13
-Moving text in the buffer (m)\ \ \ 13
-Copying lines (copy)\ \ \ 14
-Deleting lines (d)\ \ \ 14
-A word or two of caution\ \ \ 15
-Undo (u) to the rescue\ \ \ 15
-More about the dot (.) and buffer end ($)\ \ \ 16
-Moving around in the buffer (+ and \-)\ \ \ 16
-Changing lines (c)\ \ \ 17
-.in -.5i
-.sp
-Session 4\ \ \ 18
-.in +.5i
-Making commands global (g)\ \ \ 18
-More about searching and substituting\ \ \ 19
-Special characters\ \ \ 19
-Issuing \s-2UNIX\s+2 commands from the editor\ \ \ 20
-Filenames and file manipulation\ \ \ 20
-The file (f) command\ \ \ 20
-Reading additional files (r)\ \ \ 21
-Writing parts of the buffer\ \ \ 21
-Recovering files\ \ \ 21
-Other recovery techniques\ \ \ 21
-Further reading and other information\ \ \ 22
-Using \fIex\fR\ \ \ 22
-.in -.5i
-.sp
-Index\ \ \ 23
-.bp
-.SH
-.ce
-\s+2Introduction\s0
-.PP
-Text editing using a terminal connected to a computer
-allows you to create, modify, and print text
-easily.
-A
-.I
-text editor
-.R
-is a program
-that assists you
-as you create and modify text.
-The text editor you will learn here is named
-.I edit.
-Creating text using edit is as easy as typing it
-on an electric typewriter.
-Modifying text involves telling the text editor
-what you want to add, change, or delete.
-You can review your text
-by typing a command
-to print the file contents
-as they are currently.
-Another program (which we do not discuss in this
-document), a text formatter,
-rearranges your text
-for you into ``finished form.''
-.PP
-These lessons assume no prior familiarity with computers
-or with text editing.
-They consist of a series of text editing sessions
-which lead you through the fundamental steps
-of creating and revising text.
-After scanning each lesson and before beginning the next,
-you should try the examples at a terminal to get a feeling
-for the actual process of text editing.
-If you set aside some time for experimentation,
-you will soon become familiar with using the
-computer to write and modify text.
-In addition to the actual use of the text editor,
-other features of \s-2UNIX\s0 will be very important to your work.
-You can begin to
-learn about these other features by
-reading one of the other tutorials
-that provide a general introduction to the system.
-You will be ready to proceed with this lesson as soon as
-you are familiar with (1) your terminal and its special keys,
-(2) how to login,
-(3) and the ways of correcting typing errors.
-Let's first define some terms:
-.sp .5
-.IP program 12
-A set of instructions, given to the computer,
-describing the sequence of steps the computer performs
-in order to accomplish a specific task.
-The task must be specific,
-such as balancing your checkbook
-or editing your text.
-A general task,
-such as working for world peace,
-is something we can all do,
-but not something we can currently write programs to do.
-.IP UNIX
-\s-2UNIX\s0 is a special type of program,
-called an operating system, that supervises the machinery
-and all other programs comprising the total
-computer system.
-.IP edit
-.I edit
-is the name of the \s-2UNIX\s0 text editor you will be learning to use,
-and is a program that aids you in writing or revising text.
-Edit was designed for beginning users,
-and is a simplified version of an editor named
-.I ex.
-.IP file
-Each \s-2UNIX\s0 account is allotted
-space for the permanent storage of information,
-such as programs, data or text.
-A file is a logical unit of data,
-for example, an essay, a program,
-or a chapter from a book,
-which is stored on a computer system.
-Once you create a file,
-it is kept until you instruct the system to remove it.
-You may create a file during one \s-2UNIX\s0 session,
-end the session,
-and return to use it at a later time.
-Files contain anything you choose to write and store in them.
-The sizes of files vary to suit your needs;
-one file might hold only a single number,
-yet another might contain
-a very long document or program.
-The only way to save
-information from one session to the next is to store it in a file,
-which you will learn in Session 1.
-.IP filename
-Filenames are used to distinguish one file from another,
-serving the same purpose as the labels of manila
-folders in a file cabinet.
-In order to write or access information in a file,
-you use the name of that file in a \s-2UNIX\s0 command,
-and the system will automatically locate the file.
-.IP disk
-Files are stored on an input/output device called a disk,
-which looks something like a stack of phonograph records.
-Each surface is coated with a material similar to that
-on magnetic recording tape,
-and information is recorded on it.
-.IP buffer
-A temporary work space, made available to the user
-for the duration of a session of text editing
-and used for creating and modifying
-the text file.
-We can think of the buffer as a blackboard that is
-erased after each class, where each session with the editor
-is a class.
-.bp
-.SH
-.ce 1
-\s+2Session 1\s0
-.sp 1
-.SH
-Making contact with \s-1UNIX\s0
-.PP
-To use the editor you must first make contact with the computer
-by logging in to \s-2UNIX\s0.
-We'll quickly review the standard \s-2UNIX\s0 login procedure
-for the two ways you can make contact:
-on a terminal that is directly linked to the computer,
-or over a telephone line where the computer answers your call.
-.SH
-Directly-linked terminals
-.PP
-Turn on your terminal and press the \s-1RETURN\s0 key.
-You are now ready to login.
-.SH
-Dial-up terminals
-.PP
-If your terminal connects with the computer over a telephone line,
-turn on the terminal, dial the system access number,
-and, when you hear a high-pitched tone, place the
-telephone handset in the acoustic coupler, if you are using one.
-You are now ready to login.
-.SH
-Logging in
-.PP
-The message inviting you to login is:
-.DS I 1i
-login:
-.DE
-.LP
-Type your login name, which identifies you to \s-2UNIX\s0,
-on the same line as the login message,
-and press \s-2RETURN\s+2.
-If the terminal you are using
-has both upper and lower case,
-.B
-be sure you enter your login name in lower case;
-.R
-otherwise \s-2UNIX\s0 assumes your terminal
-has only upper case and will not recognize lower case
-letters you may type.
-\s-2UNIX\s0 types ``login:'' and you reply
-with your login name, for example ``susan'':
-.DS I 1i
-login: \fBsusan\fR \fI(and press the \s-2RETURN\s0 key)\fR
-.DE
-(In the examples, input you would type appears in
-.B "bold face"
-to distinguish it from the responses from \s-2UNIX\s0.)
-.PP
-\s-2UNIX\s0 will next respond with a request for a password
-as an additional precaution to prevent
-unauthorized people from using your account.
-The password will not appear when you type it,
-to prevent others from seeing it.
-The message is:
-.DS I 1i
-Password: \fI(type your password and press \s-2RETURN\s+2)\fR
-.DE
-If any of the information you gave during the login
-sequence was mistyped or incorrect,
-\s-2UNIX\s0 will respond with
-.DS I 1i
-Login incorrect.
-.if t .sp .2v
-.if n .sp 1
-login:
-.DE
-in which case you should start the login process anew.
-Assuming that you have successfully
-logged in, \s-2UNIX\s0
-will print the message of the day and eventually will present
-you with a % at the beginning of a fresh line.
-The % is the \s-2UNIX\s0 prompt symbol
-which tells you that \s-2UNIX\s0 is ready to accept a command.
-.bd I 3
-.SH
-Asking for \fIedit\fP
-.fl
-.bd I
-.PP
-You are ready to tell \s-2UNIX\s0 that you
-want to work with edit, the text editor.
-Now is a convenient time to choose
-a name for the file of text you are about to create.
-To begin your editing session,
-type
-.B edit
-followed by a space and then the filename
-you have selected; for example, ``text''.
-After that,
-press the \s-2RETURN\s0 key and wait for edit's response:
-.DS I 1i
-% \fBedit text\fP \fI(followed by a \s-2RETURN\s+2)\fR
-"text" No such file or directory
-:
-.DE
-If you typed the command correctly,
-you will now be in communication with edit.
-Edit has set aside a buffer for use as
-a temporary working space during your current editing session.
-Since ``text'' is a new file we are about to create
-the editor was unable to find that file, which it
-confirms by saying:
-.DS I 1i
-"text" No such file or directory
-.DE
-On the next line appears edit's prompt ``:'',
-announcing that you are in \f2command mode\f1 and
-edit expects a command from you.
-You may now begin to create the new file.
-.SH
-The ``Command not found'' message
-.PP
-If you misspelled edit by typing, say, ``editor'',
-this might appear:
-.DS I 1i
-% \fBeditor\fP
-editor: Command not found
-%
-.DE
-Your mistake in calling edit ``editor'' was
-treated by \s-2UNIX\s0 as a request
-for a program named ``editor''.
-Since there is no program
-named ``editor'',
-\s-2UNIX\s0 reported that the program was ``not found''.
-A new % indicates that \s-2UNIX\s0 is ready for another command,
-and you may then enter the correct command.
-.SH
-A summary
-.PP
-Your exchange with \s-2UNIX\s0 as you logged in and made contact with edit
-should look something like this:
-.DS I 1i
-login: \fBsusan\fP
-Password:
-\&... A Message of General Interest ...
-% \fBedit text\fP
-"text" No such file or directory
-:
-.DE
-.SH
-Entering text
-.PP
-You may now begin entering text into the buffer.
-This is done by \fIappending\fP (or adding) text to whatever
-is currently in the buffer.
-Since there is nothing in the buffer at the moment,
-you are appending text to nothing;
-in effect,
-since you are adding text to nothing
-you are creating text.
-Most edit commands have two equivalent forms:
-a word that suggests what the command does,
-and a shorter abbreviation of that word.
-Many beginners find the full command names
-easier to remember at first,
-but once you are familiar with editing you may
-prefer to type the shorter abbreviations.
-The command to input text is ``append''.
-(It may be abbreviated ``a''.)
-Type
-.B append
-and press the \s-2RETURN\s0 key.
-.DS I 1i
-% \fBedit text
-\fR:\|\fBappend
-.R
-.DE
-.SH
-.bd I 3
-Messages from
-.I edit
-.fl
-.bd I
-.PP
-If you make a mistake in entering a command and
-type something that edit does not recognize,
-edit will respond with a message
-intended to help you diagnose your error.
-For example, if you misspell the command to input text by typing,
-perhaps, ``add'' instead of ``append'' or ``a'',
-you will receive this message:
-.DS I 1i
-:\|\fBadd\fR
-add: Not an editor command
-:
-.DE
-When you receive a diagnostic message,
-check what you typed in order to determine what
-part of your command confused edit.
-The message above means that edit
-was unable to recognize your mistyped command
-and, therefore, did not execute it.
-Instead, a new ``:''
-appeared to let you know that
-edit is again ready to execute a command.
-.SH
-Text input mode
-.PP
-By giving the command ``append'' (or using the abbreviation ``a''),
-you entered
-.I
-text input mode,
-.R
-also known as
-.I
-append mode.
-.R
-When you enter text input mode,
-edit stops sending you a prompt.
-You will not receive any prompts
-or error messages
-while in text input mode.
-You can enter
-pretty much anything you want on the lines.
-The lines are transmitted one by one to the buffer
-and held there during the editing session.
-You may append as much text as you want, and
-.I
-when you wish to stop entering text lines you should
-type a period as the only character on the line
-and press the \s-2RETURN\s0 key.
-.R
-When you type the period and press \s-2RETURN\s0,
-you signal that you want to stop appending text,
-and edit responds by allowing
-you to exit text input mode and reenter command mode.
-Edit will again
-prompt you for a command by printing ``:''.
-.PP
-Leaving append mode does not destroy the text in
-the buffer.
-You have to leave append
-mode to do any of the other kinds of editing,
-such as changing, adding, or printing text.
-If you type a period as the first character and
-type any other character on the same line,
-edit will believe you want to remain in append mode
-and will not let you out.
-As this can be very frustrating,
-be sure to type
-.B only
-the period and the \s-2RETURN\s0 key.
-.PP
-This is a good place to learn an important
-lesson about computers and text: a blank space is
-a character as far as a computer is concerned.
-If you so much as type a period followed by a blank
-(that is, type a period and then the space bar on the keyboard),
-you will remain in append mode with the last line of text
-being:
-.DS I 1i
-.B
-.ps +2
-\&.
-.ps -2
-.R
-.DE
-Let's say that you enter the lines
-(try to type
-.B exactly
-what you see, including ``thiss''):
-.DS I 1i
-.B
-This is some sample text.
-And thiss is some more text.
-Text editing is strange, but nice.
-\&.
-.R
-.DE
-The last line is the period followed by a \s-2RETURN\s0
-that gets you out of append mode.
-.SH
-Making corrections
-.PP
-If you have read a general introduction to \s-2UNIX\s0,
-you will recall that it is possible to erase individual
-letters that you have typed.
-This is done by typing the designated erase character
-as many times as there are characters
-you want to erase.
-.PP
-The usual erase character varies from place to place and
-user to user. Often it
-is the backspace (control-H),
-so you can correct typing errors
-in the line you are typing
-by holding down the \s-1CTRL\s+1 key
-and typing the ``H'' key. (Sometimes it is the DEL key.)
-If you type the erase character
-you will notice
-that the terminal backspaces in the line you are on.
-You can backspace over your error,
-and then type what you want to be the rest of the line.
-.PP
-If you make a bad start
-in a line
-and would like to begin again,
-you can either backspace to the beginning of the line
-or you can use the at-sign ``@'' to erase everything on the line:
-.DS I 1i
-.B
-Text edtiing is strange, but@
-Text editing is strange, but nice.
-.R
-.fl
-.bd S
-.DE
-When you type the at-sign (@), you erase
-the entire line typed so far
-and are given a fresh line to type on.
-You may immediately begin to retype the line.
-This, unfortunately, does not work after you type the
-line and press \s-2RETURN\s+2.
-To make corrections in lines that have been completed,
-it is necessary to use the editing commands
-covered in the next sessions.
-.SH
-Writing text to disk
-.PP
-You are now ready to edit the text. One common operation
-is to write the text to disk as a file for safekeeping
-after the session is over.
-This is the only way to save information from one session to the next,
-since the editor's buffer is temporary and will last only until the
-end of the editing session.
-Learning how to write a file to disk is second in
-importance only to entering the text.
-To write the contents of the buffer to a disk
-file, use the command ``write''
-(or its abbreviation ``w''):
-.DS I 1i
-:\|\fBwrite
-.R
-.DE
-Edit will copy the contents of the buffer to a disk file.
-If the file does not yet exist,
-a new file will be created automatically
-and the presence of a ``[New file]'' will be noted.
-The newly-created file will be given the name specified when
-you entered the editor, in this case ``text''.
-To confirm that the disk file has been successfully written,
-edit will repeat the filename and give
-the number of lines and the total
-number of characters in the file.
-The buffer remains unchanged by the ``write'' command.
-All of the lines that were written to disk will still be
-in the buffer,
-should you want to modify or add to them.
-.PP
-Edit must have a name for the file to be written.
-If you forgot to indicate the name of the file
-when you began to edit,
-edit will print in response to your write command:
-.DS I 1i
-No current filename
-.DE
-If this happens, you can specify the filename in a new write command:
-.DS I 1i
-:\|\fBwrite text
-.R
-.DE
-After the ``write'' (or ``w''), type a space and then the name of the file.
-.SH
-Signing off
-.PP
-We have done enough for this first lesson on using the
-\s-2UNIX\s0 text editor, and are ready to quit the session with edit.
-To do this we type ``quit'' (or ``q'') and press \s-2RETURN\s+2:
-.DS I 1i
-:\|\fBwrite
-.R
-"text" [New file] 3 lines, 90 characters
-:\|\fBquit\fR
-%
-.DE
-The % is from \s-2UNIX\s0 to tell you that your session with edit is
-over and you may command \s-2UNIX\s0 further.
-Since we want
-to end the entire session at the terminal, we also need to
-exit from \s-2UNIX\s0.
-In response to the \s-2UNIX\s0 prompt of ``\|%\|''
-type the command
-.DS I 1i
-%\|\fBlogout\fR
-.DE
-This will end your session with \s-2UNIX\s0, and will ready the
-terminal for the next user.
-It is always important to type \fBlogout\fR at the end of a session
-to make absolutely sure no one
-could accidentally stumble into your abandoned
-session and thus gain access to your files,
-tempting even the most honest of souls.
-.sp 1
-.PP
-This is the end of the first session on \s-2UNIX\s0 text editing.
-.bp
-.TL
-Session 2
-.sp
-.PP
-Login with \s-2UNIX\s0 as in the first session:
-.DS I 1i
-login: \fBsusan\fP \fI(carriage return)\fR
-Password: \fI(give password and carriage return)\fR
-.if t .sp .2v
-.if n .sp 1
-\&... A Message of General Interest ...
-%
-.DE
-When you indicate you want to edit,
-you can specify the name of the file you worked on last time.
-This will
-start edit working, and it will fetch the contents of the
-file into the buffer, so that you can resume editing the same file.
-When edit has copied the file into the buffer, it
-will repeat its name and tell
-you the number of lines and characters it contains.
-Thus,
-.DS I 1i
-.B
-% edit text
-.R
-"text" 3 lines, 90 characters
-:
-.DE
-means you asked edit to fetch
-the file named ``text'' for editing,
-causing it to copy the
-90 characters of text into the buffer.
-Edit awaits
-your further instructions,
-and indicates this by its prompt character, the colon (:).
-In this session, we will append more text to our file,
-print the contents of the buffer, and learn to change the text of a line.
-.SH
-Adding more text to the file
-.PP
-If you want to add more to the end of your
-text you may do so by using the append command to enter text input mode.
-When ``append'' is the first command
-of your editing session,
-the lines you enter
-are placed at the end of the buffer.
-Here we'll use the abbreviation for the append command, ``a'':
-.DS I 1i
-:\|\fBa
-This is text added in Session 2.
-It doesn't mean much here, but
-it does illustrate the editor.
-\|\fB\s+2\&.\s-2
-.R
-.DE
-You may recall that once you enter append mode
-using the ``a'' (or ``append'') command,
-you need to type a line containing only a period (.)
-to exit append mode.
-.SH
-Interrupt
-.PP
-Should you press the \s-2RUB\s+2 key (sometimes labelled \s-2DELETE\s+2)
-while working with edit,
-it will send this message to you:
-.DS I 1i
-Interrupt
-:
-.DE
-Any command that edit might be executing
-is terminated by rub or delete,
-causing edit to prompt you for a new command.
-If you are appending text at the time,
-you will exit from append mode
-and be expected to give another command.
-The line of text you were typing
-when the append command was interrupted
-will not be entered into the buffer.
-.SH
-Making corrections
-.PP
-If while typing the line you hit an incorrect key,
-recall that
-you may delete the incorrect character
-or cancel the entire line of input by erasing in the usual way.
-Refer either
-to the last few pages of Session 1
-if you need to review
-the procedures for making a correction.
-The most important idea to remember is that
-erasing a character or cancelling a line must be done
-before you press the \s-2RETURN\s+2 key.
-.SH
-Listing what's in the buffer (p)
-.PP
-Having appended text to what you wrote in Session 1,
-you might want to see all the lines in the buffer.
-To print the contents of the buffer, type the command:
-.DS I 1i
-:\|\fB1,$p
-.R
-.DE
-The ``1''\(dg
-.FS
-\(dgThe numeral ``one'' is the top left-most key,
-and should not be confused with the letter ``el''.
-.FE
-stands for line 1 of the buffer,
-the ``$'' is a special symbol designating the last line
-of the buffer,
-and ``p'' (or \fBprint\fR) is the command to print from line 1
-to the end of the buffer.
-The command ``1,$p'' gives you:
-.DS I 1i
-This is some sample text.
-And thiss is some more text.
-Text editing is strange, but nice.
-This is text added in Session 2.
-It doesn't mean much here, but
-it does illustrate the editor.
-.DE
-Occasionally, you may accidentally
-type a character that can't be printed,
-which can be done by striking a key
-while the \s-2CTRL\s0 key is pressed.
-In printing lines, edit uses a special notation to
-show the existence of non-printing characters.
-Suppose you had introduced the non-printing character ``control-A''
-into the word ``illustrate''
-by accidently pressing the \s-2CTRL\s0 key while
-typing ``a''.
-This can happen on many terminals
-because the \s-2CTRL\s+2 key and the ``A'' key
-are beside each other.
-If your finger presses between the two keys,
-control-A results.
-When asked to print the contents of the buffer,
-edit would display
-.DS I 1i
-it does illustr^Ate the editor.
-.DE
-To represent the control-A, edit shows ``^A''.
-The sequence ``^'' followed by a capital
-letter stands for the one character
-entered by holding down the \s-2CTRL\s0 key and typing the letter
-which appears after the ``^''.
-We'll soon discuss the commands that can be used
-to correct this typing error.
-.PP
-In looking over the text we see that
-``this'' is typed as ``thiss'' in the second line,
-a deliberate error so we can learn to make corrections.
-Let's correct the spelling.
-.SH
-Finding things in the buffer
-.PP
-In order to change something in the buffer we first need to
-find it.
-We can find ``thiss'' in the text we have
-entered by looking at a listing
-of the lines.
-Physically speaking, we search the lines
-of text looking for ``thiss'' and stop searching when
-we have found it.
-The way to tell edit to search for something
-is to type it inside slash marks:
-.DS I 1i
-:\|\fB/thiss/
-.R
-.DE
-By typing
-.B /thiss/
-and pressing \s-1RETURN\s0,
-you instruct edit to search for ``thiss''.
-If you ask edit to look for a pattern of characters
-which it cannot find in the buffer,
-it will respond ``Pattern not found''.
-When edit finds
-the characters ``thiss'', it will print the line of text
-for your inspection:
-.DS I 1i
-And thiss is some more text.
-.DE
-Edit is now positioned in the buffer at the
-line it just printed,
-ready to make a change in the line.
-.bp
-.SH
-The current line
-.PP
-Edit keeps track of the line in the buffer where it is located
-at all times during an editing session.
-In general, the line that has been most recently
-printed, entered, or changed
-is the current location in the buffer.
-The editor is prepared to make changes
-at the current location in the buffer,
-unless you direct it to another location.
-.PP
-In particular,
-when you bring a file into the buffer,
-you will be located at the last line in the file,
-where the editor left off copying the lines
-from the file to the buffer.
-If your first editing command is ``append'',
-the lines you enter are added
-to the end of the file,
-after the current line \(em
-the last line in the file.
-.PP
-You can refer to your current location in the buffer by the
-symbol
-period (.) usually known by the name ``dot''.
-If you type ``.'' and carriage
-return you will be instructing edit to print the current line:
-.DS I 1i
-:\|\fB\s+2\&.\s-2
-.R
-And thiss is some more text.
-.DE
-.PP
-If you want to know the number of the current line,
-you can type
-.B \&.=
-and press \s-2RETURN\s+2,
-and edit will respond with the line number:
-.DS I 1i
-:\|\fB\s+2.\s-2=
-.R
-2
-.DE
-If you type the number of any line and press \s-2RETURN\s+2,
-edit will position you at that line and
-print its contents:
-.DS I 1i
-:\|\fB2
-.R
-And thiss is some more text.
-.DE
-You should experiment with these commands
-to gain experience in using them to make changes.
-.SH
-Numbering lines (nu)
-.PP
-The
-.B
-number (nu)
-.R
-command is similar to print,
-giving both the number and the text of each printed line.
-To see the number and the text of the current line type
-.DS I 1i
-:\|\fBnu
-.R
-\0\0\0\0\02\0\0And thiss is some more text.
-.DE
-Note that the shortest abbreviation for the number command is
-``nu'' (and not ``n'', which is used for a different command).
-You may specify a range of lines
-to be listed by the number command in the same way that lines
-are specified for print.
-For example, \f31,$nu\f1 lists all lines in the buffer with their
-corresponding line numbers.
-.SH
-Substitute command (s)
-.PP
-Now that you have found the misspelled word,
-you can change it from ``thiss'' to ``this''.
-As far as edit is concerned,
-changing things is a matter of
-substituting one thing for another.
-As
-.I a
-stood for
-.I append,
-so
-.I s
-stands for
-.I substitute.
-We will use the abbreviation ``s'' to reduce the chance
-of mistyping the substitute command.
-This command will instruct edit to make the change:
-.DS I 1i
-\f32s/thiss/this/\f1
-.DE
-We first indicate the line to be changed, line 2,
-and then
-type an ``s'' to indicate we want
-edit to make a substitution.
-Inside the first set of slashes
-are the characters that we want to change,
-followed by the characters to replace them,
-and then a closing slash mark.
-To summarize:
-.DS I 1i
-2s/ \fIwhat is to be changed\fR / \fIwhat to change it to \fR/
-.DE
-If edit finds an exact match of the characters to be
-changed it will make the change
-.B only
-in the first occurrence of the characters.
-If it does not find the characters
-to be changed, it will respond:
-.DS I 1i
-Substitute pattern match failed
-.DE
-indicating that your instructions could not be carried out.
-When edit does find the characters that you want to change,
-it will make the substitution and automatically print
-the changed line, so that you can check that the correct substitution
-was made.
-In the example,
-.DS I 1i
-:\|\fB2s/thiss/this/
-.R
-And this is some more text.
-.DE
-line 2 (and line 2 only) will be searched for the characters
-``thiss'', and when the first exact match is found, ``thiss''
-will be changed to ``this''.
-Strictly speaking, it was not necessary above to
-specify the number of the line to be changed.
-In
-.DS I 1i
-:\|\fBs/thiss/this/
-.R
-.DE
-edit will assume that we mean to change
-the line where we are currently located (``.'').
-In this case,
-the command without a line number would have produced the same result
-because we were already located
-at the line we wished to change.
-.PP
-For another illustration of the substitute command,
-let us choose the line:
-.DS I 1i
-Text editing is strange, but nice.
-.DE
-You can make this line a bit more positive
-by taking out the characters ``strange, but\ '' so the line
-reads:
-.DS I 1i
-Text editing is nice.
-.DE
-A command that will first position edit at the desired line
-and then make the substitution is:
-.DS I 1i
-:\|\fB/strange/s/strange, but //
-.R
-.DE
-.LP
-What we have done here is combine our search with
-our substitution.
-Such combinations are perfectly legal,
-and speed up editing quite a bit
-once you get used to them.
-That is, you do not necessarily have to use
-line numbers to identify a line to edit.
-Instead, you may identify the line you want to change
-by asking edit to search for a specified pattern of letters
-that occurs in that line.
-The parts of the above command are:
-.in +1i
-.TS
-l l.
-\fB/strange/\fP tells edit to find the characters ``strange'' in the text
-\fBs\fP tells edit to make a substitution
-\fB/strange, but //\fP substitutes nothing at all for the characters ``strange, but ''
-.TE
-.in -1i
-.PP
-You should note the space after ``but'' in ``/strange, but /''.
-If you do not indicate that the space is to be taken out,
-your line will read:
-.DS I 1i
-.if t Text editing is nice.
-.if n Text editing is nice.
-.DE
-which looks a little funny
-because of the extra space between ``is'' and ``nice''.
-Again, we realize from this that a blank space
-is a real character to a computer, and in editing text
-we need to be aware of spaces
-within a line just as we would be aware of an ``a'' or
-a ``4''.
-.SH
-Another way to list what's in the buffer (z)
-.PP
-Although the print command is useful for looking at specific lines
-in the buffer,
-other commands may be more convenient for
-viewing large sections of text.
-You can ask to see a screen full of text at a time
-by using the command
-.B z.
-If you type
-.DS I 1i
-:\|\fB1z
-.R
-.DE
-edit will start with line 1 and continue printing lines,
-stopping either when the screen of
-your terminal is full
-or when the last line in the buffer has been printed.
-If you want to read the next segment of text, type the command
-.DS I 1i
-:\|\fBz
-.DE
-If no starting line number is given for the z command,
-printing will start at the ``current'' line, in this case the
-last line printed.
-Viewing lines in the buffer one screen full at a time
-is known as \fIpaging\fR.
-Paging can also be used to print
-a section of text on a hard-copy terminal.
-.SH
-Saving the modified text
-.PP
-This seems to be a good place to pause in our work,
-and so we should end the second session.
-If you (in haste) type ``q'' to quit the session
-your dialogue with edit will be:
-.DS I 1i
-:\|\fBq
-.R
-No write since last change (:quit! overrides)
-:
-.DE
-This is edit's warning that you have not written
-the modified contents of the buffer to disk.
-You run the risk of losing the work you did
-during the editing session since you typed the latest write
-command.
-Because in this lesson we have not written
-to disk at all, everything we have done
-would have been lost
-if edit had obeyed the \fBq\fR command.
-If you did not want to save the work done during
-this editing session, you would have to type ``q!''
-or (``quit!'')
-to confirm that you indeed wanted to end the session
-immediately,
-leaving the file as it was
-after the most recent ``write'' command.
-However,
-since you want to save what
-you have edited, you need to type:
-.DS I 1i
-:\|\fBw
-.R
-"text" 6 lines, 171 characters
-.DE
-and then follow with the commands to quit and logout:
-.DS I 1i
-:\|\fBq
-% \fBlogout\fR
-.DE
-and hang up the phone or turn off the terminal when
-\s-2UNIX\s0 asks for a name.
-Terminals connected to the port selector
-will stop after the logout command,
-and pressing keys on the keyboard will do nothing.
-.sp 1
-.PP
-This is the end of the second session on \s-2UNIX\s0 text editing.
-.bp
-.TL
-Session 3
-.SH
-Bringing text into the buffer (e)
-.PP
-Login to \s-2UNIX\s0 and make contact with edit.
-You should try to login without
-looking at the notes, but if you must
-then by all means do.
-.PP
-Did you remember to give the name of the file
-you wanted to edit?
-That is, did you type
-.DS I 1i
-% \fBedit text\fR
-.DE
-or simply
-.DS I 1i
-% \fBedit\fR
-.DE
-Both ways get you in contact with edit, but the first way
-will bring a copy of the file named ``text'' into
-the buffer.
-If you did forget to tell edit the name of your file,
-you can get it into the buffer by
-typing:
-.DS I 1i
-:\|\fBe text
-.R
-"text" 6 lines, 171 characters
-.DE
-The command
-.B edit,
-which may be abbreviated \fBe\fR,
-tells edit that you want
-to erase anything that might already be in
-the buffer and bring a copy of the file ``text'' into the buffer
-for editing.
-You may also use the edit (e) command to change files in
-the middle of an editing session,
-or to give edit the name of a new file that you want to create.
-Because the edit command clears the buffer,
-you will receive a warning if you try to edit a new file without
-having saved a copy of the old file.
-This gives you a chance to write the contents of the buffer to disk
-before editing the next file.
-.SH
-Moving text in the buffer (m)
-.PP
-Edit allows you to move lines of text
-from one location in the buffer to another
-by means of the
-.B move
-(\fBm\fR) command.
-The first two examples are for illustration only,
-though after you have read this Session
-you are welcome to return to them for practice.
-The command
-.DS I 1i
-:\|\fB2,4m$
-.R
-.DE
-directs edit to move lines 2, 3, and 4
-to the end of the buffer ($).
-The format for the move command is that you specify
-the first line to be moved, the last line to be moved,
-the move command ``m'', and the line after which
-the moved text is to be placed.
-So,
-.DS I 1i
-:\|\fB1,3m6
-.R
-.DE
-would instruct edit to move lines 1 through 3 (inclusive)
-to a location after line 6 in the buffer.
-To move only one line, say, line 4,
-to a location in the buffer after line 5,
-the command would be ``4m5''.
-.PP
-Let's move some text using the command:
-.DS I 1i
-:\|\fB5,$m1
-.R
-2 lines moved
-it does illustrate the editor.
-.DE
-After executing a command that moves more than one line of the buffer,
-edit tells how many lines were affected by the move
-and prints the last moved line for your inspection.
-If you want to see more than just the last line,
-you can then
-use the print (p), z, or number (nu) command to view more text.
-The buffer should now contain:
-.DS I 1i
-This is some sample text.
-It doesn't mean much here, but
-it does illustrate the editor.
-And this is some more text.
-Text editing is nice.
-This is text added in Session 2.
-.DE
-You can restore the original order by typing:
-.DS I 1i
-:\|\fB4,$m1
-.R
-.DE
-or, combining context searching and the move command:
-.DS I 1i
-:\|\fB/And this is some/,/This is text/m/This is some sample/
-.R
-.DE
-(Do not type both examples here!)
-The problem with combining context searching
-with the move command
-is that your chance of making a typing error
-in such a long command is greater than
-if you type line numbers.
-.SH
-Copying lines (copy)
-.PP
-The
-.B copy
-command
-is used to make a second copy of specified lines,
-leaving the original lines where they were.
-Copy
-has the same format as the move command, for example:
-.DS I 1i
-:\|\fB2,5copy $
-.R
-.DE
-makes a copy of lines 2 through 5,
-placing the added lines after the buffer's end ($).
-Experiment with the copy command
-so that you can become familiar with how it works.
-Note that the shortest abbreviation for copy is
-\f3co\f1 (and
-not the letter ``c'', which has another meaning).
-.SH
-Deleting lines (d)
-.PP
-Suppose you want to delete
-the line
-.DS I 1i
-This is text added in Session 2.
-.DE
-from the buffer.
-If you know the number of the line to be deleted,
-you can type
-that number followed by
-\fBdelete\fR or \fBd\fR.
-This example deletes line 4,
-which is ``This is text added in Session 2.''
-if you typed the commands
-suggested so far.
-.DS I 1i
-:\|\fB4d
-.R
-It doesn't mean much here, but
-.DE
-Here ``4'' is the number of the line to be deleted,
-and ``delete'' or ``d'' is the command to delete the line.
-After executing the delete command,
-edit prints the line that has become the current line (``.'').
-.PP
-If you do not happen to know the line number
-you can search for the line and then delete it using this
-sequence of commands:
-.DS I 1i
-:\|\fB/added in Session 2./
-.R
-This is text added in Session 2.
-:\|\fBd
-.R
-It doesn't mean much here, but
-.DE
-The ``/added in Session 2./''
-asks edit to locate and print
-the line containing the indicated text,
-starting its search at the current line
-and moving line by line
-until it finds the text.
-Once you are sure that you have correctly specified the line
-you want to delete,
-you can enter the delete (d) command.
-In this case it is not necessary to
-specify a line number before the ``d''.
-If no line number is given,
-edit deletes the current line (``.''),
-that is, the line found by our search.
-After the deletion, your buffer should contain:
-.DS I 1i
-This is some sample text.
-And this is some more text.
-Text editing is nice.
-It doesn't mean much here, but
-it does illustrate the editor.
-And this is some more text.
-Text editing is nice.
-This is text added in Session 2.
-It doesn't mean much here, but
-.DE
-To delete both lines 2 and 3:
-.DS I 1i
-And this is some more text.
-Text editing is nice.
-.DE
-you type
-.DS I 1i
-:\|\f32,3d\f1
-2 lines deleted
-.DE
-which specifies the range of lines from 2 to 3,
-and the operation on those lines \(em ``d'' for delete.
-If you delete more than one line
-you will receive a message
-telling you the number of lines deleted,
-as indicated in the example above.
-.PP
-The previous example assumes that you know the line numbers for
-the lines to be deleted.
-If you do not you might combine the search command
-with the delete command:
-.DS I 1i
-:\|\fB/And this is some/,/Text editing is nice./d
-.R
-.DE
-.SH
-A word or two of caution
-.PP
-In using the search function to locate lines to
-be deleted you should be
-.B
-absolutely sure
-.R
-the characters you give as the basis for the search
-will take edit to the line you want deleted.
-Edit will search for the first
-occurrence of the characters starting from where
-you last edited \-
-that is, from the line you see printed if you type dot (.).
-.PP
-A search based on too few
-characters may result in the wrong lines being deleted,
-which edit will do as easily as if you had meant it.
-For this reason, it is usually safer
-to specify the search and then delete in two separate steps,
-at least until you become familiar enough with using the editor
-that you understand how best to specify searches.
-For a beginner it is not a bad idea to double-check
-each command before pressing \s-2RETURN\s+2 to send the command on its way.
-.SH
-Undo (u) to the rescue
-.PP
-The
-.B
-undo (u)
-.R
-command has the ability to
-reverse the effects of the last command that changed the buffer.
-To undo the previous command, type
-``u'' or ``undo''.
-Undo can rescue
-the contents of the buffer from many an unfortunate mistake.
-However, its powers are not unlimited,
-so it is still wise to be reasonably
-careful about the commands you give.
-.PP
-It is possible to undo only commands which
-have the power to change the buffer \(em for example,
-delete, append, move, copy, substitute, and even undo itself.
-The commands write (w) and edit (e), which interact with disk files,
-cannot be undone, nor can commands that do not change
-the buffer, such as print.
-Most importantly,
-the
-.B only
-command that can be reversed by undo
-is the
-last ``undo-able'' command you typed.
-You can use control-H and @ to change
-commands while you are typing them,
-and undo to reverse the effect of the commands
-after you have typed them and pressed \s-2RETURN\s+2.
-.PP
-To illustrate,
-let's issue an undo command.
-Recall that the last buffer-changing command we gave deleted
-the lines formerly numbered 2 and 3.
-Typing undo at this moment will reverse the effects
-of the deletion, causing those two lines to be
-replaced in the buffer.
-.DS I 1i
-:\|\fBu
-.R
-2 more lines in file after undo
-And this is some more text.
-.DE
-Here again, edit informs you if the command affects more
-than one line,
-and prints
-the text of the line which is now ``dot'' (the current line).
-.SH
-More about the dot (.) and buffer end ($)
-.PP
-The function assumed by the symbol dot depends on its context.
-It can be used:
-.IP
-1. to exit from append mode; we type dot (and only a dot) on
-a line and press \s-2RETURN\s+2;
-.IP
-2. to refer to the line we are at in the buffer.
-.LP
-Dot can also be combined with the equal sign to get
-the number of the line currently being edited:
-.DS I 1i
-:\|\fB\&.=
-.R
-.DE
-If we type ``\fB.\fR='' we are asking for the number of the line,
-and if we type ``\fB.\fR'' we are asking for the text of the line.
-.PP
-In this editing session and the last, we used the dollar
-sign to indicate the end of the buffer
-in commands such as print, copy, and move.
-The dollar sign as a command asks edit to print the last
-line in the buffer.
-If the dollar sign is combined with the equal sign (\f3$=\f1)
-edit will print the line number corresponding to the
-last line in the buffer.
-.PP
-``\fB.\fR'' and ``$'', then, represent line numbers.
-Whenever appropriate, these symbols can be used in
-place of line numbers in commands.
-For example
-.DS I 1i
-:\|\fB\s+2.\s-2,$d
-.R
-.DE
-instructs edit to delete all lines from the current line (\fB.\fR)
-to the end of the buffer.
-.SH
-Moving around in the buffer (+ and \-)
-.PP
-When you are editing
-you often want
-to go back and re-read a previous line.
-You could specify a context search for a line you want to
-read if you remember some of its text,
-but if you simply want to see what was written a few, say 3, lines
-ago, you can type
-.DS I 1i
-\-3p
-.DE
-This tells edit to move back to a position 3 lines
-before the current line (.)
-and print that line.
-You can move forward in the buffer similarly:
-.DS I 1i
-+2p
-.DE
-instructs edit to print the line that is 2
-ahead of your current position.
-.PP
-You may use ``+'' and ``\-'' in any command where edit
-accepts line numbers.
-Line numbers specified with ``+'' or ``\-''
-can be combined to print a range of lines.
-The command
-.DS I 1i
-:\|\fB\-1,+2copy$
-.R
-.DE
-makes a copy of 4 lines: the current line, the line before it,
-and the two after it.
-The copied lines will be placed after the last line
-in the buffer ($),
-and the original lines referred to by ``\-1'' and ``+2''
-remain where they are.
-.PP
-Try typing only ``\-''; you will move back one line just as
-if you had typed ``\-1p''.
-Typing the command ``+'' works similarly.
-You might also try typing a few plus or minus signs in a row
-(such as ``+++'') to see edit's response.
-Typing \s-2RETURN\s+2 alone on a line is the equivalent
-of typing ``+1p''; it will move you one line ahead in the buffer
-and print that line.
-.PP
-If you are at the last line of the buffer and try
-to move further ahead, perhaps by typing a ``+'' or
-a carriage return alone on the line,
-edit will remind you that you are at the end of the buffer:
-.sp
-.nf
-.ti 1i
-At end-of-file
-.br
-or
-.ti 1i
-Not that many lines in buffer
-.fi
-.LP
-Similarly, if you try to move to a position before the first line,
-edit will print one of these messages:
-.sp
-.nf
-.ti 1i
-Nonzero address required on this command
-.br
-or
-.ti 1i
-Negative address \- first buffer line is 1
-.fi
-.LP
-The number associated with a buffer line is the line's ``address'',
-in that it can be used to locate the line.
-.SH
-Changing lines (c)
-.PP
-You can also delete certain lines and
-insert new text in their place.
-This can be accomplished easily with the
-.B "change (c)"
-command.
-The change command instructs edit to delete specified lines
-and then switch to text input mode to
-accept the text that will replace them.
-Let's say you want to change the first two lines in the buffer:
-.DS I 1i
-This is some sample text.
-And this is some more text.
-.DE
-to read
-.DS I 1i
-This text was created with the \s-2UNIX\s0 text editor.
-.DE
-To do so, you type:
-.DS I 1i
-:\|\fB1,2c
-.R
-2 lines changed
-.B
-This text was created with the \s-2UNIX\s0 text editor.
-\s+2\&.\s-2
-.R
-:
-.DE
-In the command
-.B 1,2c
-we specify that we want to change
-the range of lines beginning with 1 and ending with 2
-by giving line numbers as with the print command.
-These lines will be deleted.
-After you type \s-2RETURN\s+2 to end the change command,
-edit notifies you if more than one line will be changed
-and places you in text input mode.
-Any text typed on the following lines will be inserted into
-the position where lines were deleted by the change command.
-.B
-You will remain in text input mode until you exit in the usual way,
-by typing a period alone on a line.
-.R
-Note that the number of lines added to the buffer need not be
-the same as the number of lines deleted.
-.sp 1
-.PP
-This is the end of the third session on text editing with \s-2UNIX\s0.
-.bp
-.SH
-.ce 1
-\s+2Session 4\s0
-.sp
-.PP
-This lesson covers several topics, starting with
-commands that apply throughout the buffer,
-characters with special meanings,
-and how to issue \s-2UNIX\s0 commands while in the editor.
-The next topics deal with files:
-more on reading and writing,
-and methods of recovering files lost in a crash.
-The final section suggests sources of further information.
-.SH
-Making commands global (g)
-.PP
-One disadvantage to the commands we have used for
-searching or substituting is that if you
-have a number of instances of a word to change
-it appears that you have to type the command
-repeatedly, once for
-each time the change needs to be made.
-Edit, however, provides a way to make commands
-apply to the entire contents of the buffer \-
-the
-.B
-global (g)
-.R
-command.
-.PP
-To print all lines
-containing a certain sequence of characters
-(say, ``text'')
-the command is:
-.DS I 1i
-:\|\fBg/text/p
-.R
-.DE
-The ``g'' instructs edit to
-make a global search for all lines
-in the buffer containing the characters ``text''.
-The ``p'' prints the lines found.
-.PP
-To issue a global command, start by typing a ``g'' and then a search
-pattern identifying
-the lines to be affected.
-Then, on the same line, type the command to be
-executed for the identified lines.
-Global substitutions are frequently useful.
-For example,
-to change all instances of the word ``text'' to the word ``material''
-the command would be a combination of the global search and the
-substitute command:
-.DS I 1i
-:\|\fBg/text/s/text/material/g
-.R
-.DE
-Note the ``g'' at the end of the global command,
-which instructs edit to change
-each and every instance of ``text'' to ``material''.
-If you do not type the ``g'' at the end of the command
-only the
-.I first
-instance of ``text'' \fIin each line\fR will be changed
-(the normal result of the substitute command).
-The ``g'' at the end of the command is independent of the ``g''
-at the beginning.
-You may give a command such as:
-.DS I 1i
-:\|\fB5s/text/material/g
-.R
-.DE
-to change every instance of ``text'' in line 5 alone.
-Further, neither command will change ``text'' to ``material''
-if ``Text'' begins with a capital rather than a lower-case
-.I t.
-.PP
-Edit does not automatically print the lines modified by a
-global command.
-If you want the lines to be printed, type a ``p''
-at the end of the global command:
-.DS I 1i
-:\|\fBg/text/s/text/material/gp
-.R
-.DE
-You should be careful
-about using the global command in combination with any other \-
-in essence, be sure of what you are telling edit to do
-to the entire buffer.
-For example,
-.DS I 1i
-:\|\fBg/ /d
-.R
-72 less lines in file after global
-.DE
-will delete every line containing a blank anywhere in it.
-This could adversely affect
-your document, since most lines have spaces between words
-and thus would be deleted.
-After executing the global command,
-edit will print a warning if the command added or deleted more than one line.
-Fortunately, the undo command can reverse
-the effects of a global command.
-You should experiment with the global command
-on a small file of text to see what it can do for you.
-.SH
-More about searching and substituting
-.PP
-In using slashes to identify a character string
-that we want to search for or change,
-we have always specified the exact characters.
-There is a less tedious way to
-repeat the same string of characters.
-To change ``text'' to ``texts'' we may type either
-.DS I 1i
-:\|\fB/text/s/text/texts/
-.R
-.DE
-as we have done in the past,
-or a somewhat abbreviated command:
-.DS I 1i
-:\|\fB/text/s//texts/
-.R
-.DE
-In this example, the characters to be changed
-are not specified \-
-there are no characters, not even a space,
-between the two slash marks
-that indicate what is to be changed.
-This lack of characters between the slashes
-is taken by the editor to mean
-``use the characters we last searched for as the characters to be changed.''
-.PP
-Similarly, the last context search may be repeated
-by typing a pair of slashes with nothing between them:
-.DS I 1i
-:\|\fB/does/
-.R
-It doesn't mean much here, but
-:\|\fB//
-.R
-it does illustrate the editor.
-.DE
-(You should note that the search command found the characters ``does''
-in the word ``doesn't'' in the first search request.)
-Because no characters are specified for the second search,
-the editor scans the buffer for the next occurrence of the
-characters ``does''.
-.PP
-Edit normally searches forward through the buffer,
-wrapping around from the end of the buffer to the beginning,
-until the specified character string is found.
-If you want to search in the reverse direction,
-use question marks (?) instead of slashes
-to surround the characters you are searching for.
-.PP
-It is also possible
-to repeat the last substitution
-without having to retype the entire command.
-An ampersand (&) used as a command
-repeats the most recent substitute command,
-using the same search and replacement patterns.
-After altering the current line by typing
-.DS I 1i
-:\|\fBs/text/texts/
-.R
-.DE
-you type
-.DS I 1i
-:\|\fB/text/&
-.R
-.DE
-or simply
-.DS I 1i
-:\|\fB//&
-.R
-.DE
-to make the same change on the next line in the buffer
-containing the characters ``text''.
-.SH
-Special characters
-.PP
-Two characters have special meanings when
-used in specifying searches: ``$'' and ``^''.
-``$'' is taken by the editor to mean ``end of the line''
-and is used to identify strings
-that occur at the end of a line.
-.DS I 1i
-:\|\fBg/text.$/s//material./p
-.R
-.DE
-tells the editor to search for all lines ending in ``text.''
-(and nothing else, not even a blank space),
-to change each final ``text.'' to ``material.'',
-and print the changed lines.
-.PP
-The symbol ``^'' indicates the beginning of a line.
-Thus,
-.DS I 1i
-:\|\fBs/^/1. /
-.R
-.DE
-instructs the editor to insert ``1.'' and a space at the beginning
-of the current line.
-.PP
-The characters ``$'' and ``^'' have special meanings only in the context
-of searching.
-At other times, they are ordinary characters.
-If you ever need to search for a character that has a special meaning,
-you must indicate that the
-character is to lose temporarily
-its special significance by typing another special character,
-the backslash (\\), before it.
-.DS I 1i
-:\|\fBs/\\\\\&$/dollar/
-.R
-.DE
-looks for the character ``$'' in the current
-line and replaces it by the word ``dollar''.
-Were it not for the backslash, the ``$'' would have represented
-``the end of the line'' in your search
-rather than the character ``$''.
-The backslash retains its special significance
-unless it is preceded by another backslash.
-.SH
-Issuing \s-2UNIX\s0 commands from the editor
-.PP
-After creating several files with the editor,
-you may want to delete files
-no longer useful to you or ask for a list of your files.
-Removing and listing files are not functions of the editor,
-and so they require the use of \s-2UNIX\s0 system commands
-(also referred to as ``shell'' commands, as
-``shell'' is the name of the program that processes \s-2UNIX\s0 commands).
-You do not need to quit the editor to execute a \s-2UNIX\s0 command
-as long as you indicate that it
-is to be sent to the shell for execution.
-To use the \s-2UNIX\s0 command
-.B rm
-to remove the file named ``junk'' type:
-.DS I 1i
-:\|\fB!rm junk
-.R
-!
-:
-.DE
-The exclamation mark (!)
-indicates that the rest of the line is to be processed as a shell command.
-If the buffer contents have not been written since the last change,
-a warning will be printed before the command is executed:
-.DS I 1i
-[No write since last change]
-.DE
-The editor prints a ``!'' when the command is completed.
-Other tutorials describe useful features of the system,
-of which an editor is only one part.
-.SH
-Filenames and file manipulation
-.PP
-Throughout each editing session,
-edit keeps track of the name of the file being edited as the
-.I "current filename."
-Edit remembers as the current filename the name given
-when you entered the editor.
-The current filename changes whenever the edit (e) command
-is used to specify a new file.
-Once edit has recorded a current filename,
-it inserts that name into any command where a filename has been omitted.
-If a write command does not specify a file,
-edit, as we have seen, supplies the current filename.
-If you are editing a file named ``draft3'' having 283 lines in it,
-you can have the editor write onto a different file
-by including its name in the write command:
-.DS I 1i
-:\fB\|w chapter3
-.R
-"chapter3" [new file] 283 lines, 8698 characters
-.DE
-The current filename remembered by the editor
-.I
-will not be changed as a result of the write command.
-.R
-Thus, if the next write command
-does not specify a name,
-edit will write onto the current file (``draft3'')
-and not onto the file ``chapter3''.
-.SH
-The file (f) command
-.PP
-To ask for the current filename, type
-.B file
-(or
-.B f ).
-In response, the editor provides current information about the buffer,
-including the filename, your current position, the number of
-lines in the buffer,
-and the percent of the distance through the file
-your current location is.
-.DS I 1i
-:\|\fBf
-.R
-"text" [Modified] line 3 of 4 --75%--
-.DE
-.\"The expression ``[Edited]'' indicates that the buffer contains
-.\"either the editor's copy of the existing file ``text''
-.\"or a file which you are just now creating.
-If the contents of the buffer have changed
-since the last time the file was written,
-the editor will tell you that the file has been ``[Modified]''.
-After you save the changes by writing onto a disk file,
-the buffer will no longer be considered modified:
-.DS I 1i
-:\|\fBw
-.R
-"text" 4 lines, 88 characters
-:\|\fBf
-.R
-"text" line 3 of 4 --75%--
-.DE
-.SH
-Reading additional files (r)
-.PP
-The
-\f3read (r)\f1 command allows you to add the contents of a file
-to the buffer
-at a specified location,
-essentially copying new lines
-between two existing lines.
-To use it, specify the line after which the new text will be placed,
-the \f3read (r)\f1 command,
-and then the name of the file.
-If you have a file named ``example'', the command
-.DS I 1i
-:\|\fB$r example
-.R
-"example" 18 lines, 473 characters
-.DE
-reads the file ``example''
-and adds it to the buffer after the last line.
-The current filename is not changed by the read command.
-.SH
-Writing parts of the buffer
-.PP
-The
-.B
-write (w)
-.R
-command can write all or part of the buffer
-to a file you specify.
-We are already familiar with
-writing the entire contents of the
-buffer to a disk file.
-To write only part of the buffer onto a file,
-indicate the beginning and ending lines before the write command,
-for example
-.DS I 1i
-:\|\fB45,$w ending
-.R
-.DE
-Here all lines from 45 through the end of the buffer
-are written onto the file named
-.I ending.
-The lines remain in the buffer
-as part of the document you are editing,
-and you may continue to edit the entire buffer.
-Your original file is unaffected
-by your command to write part of the buffer
-to another file.
-Edit still remembers whether you have saved changes to the buffer
-in your original file or not.
-.SH
-Recovering files
-.PP
-Although it does not happen very often,
-there are times \s-2UNIX\s+2 stops working
-because of some malfunction.
-This situation is known as a \fIcrash\fR.
-Under most circumstances,
-edit's crash recovery feature
-is able to save work to within a few lines of changes
-before a crash (or an accidental phone hang up).
-If you lose the contents of an editing buffer in a system crash,
-you will normally receive mail when you login that gives
-the name of the recovered file.
-To recover the file,
-enter the editor and type the command
-.B recover
-(\fBrec\fR),
-followed by the name of the lost file.
-For example,
-to recover the buffer for an edit session
-involving the file ``chap6'', the command is:
-.DS I 1i
-.R
-:\|\fBrecover chap6
-.R
-.DE
-Recover is sometimes unable to save the entire buffer successfully,
-so always check the contents of the saved buffer carefully
-before writing it back onto the original file.
-For best results,
-write the buffer to a new file temporarily
-so you can examine it without risk to the original file.
-Unfortunately,
-you cannot use the recover command
-to retrieve a file you removed
-using the shell command \f3rm\f1.
-.SH
-Other recovery techniques
-.PP
-If something goes wrong when you are using the editor,
-it may be possible to save your work by using the command
-.B preserve
-(\fBpre\fR),
-which saves the buffer as if the system had crashed.
-If you are writing a file and you get the message
-``Quota exceeded'', you have tried to use more disk storage
-than is allotted to your account.
-.I
-Proceed with caution
-.R
-because it is likely that only a part
-of the editor's buffer is now present in the file you tried to write.
-In this case you should use the shell escape from the editor (!)
-to remove some files you don't need and try to write
-the file again.
-If this is not possible and you cannot find someone to help you,
-enter the command
-.DS I 1i
-:\|\fBpreserve
-.R
-.DE
-and wait for the reply,
-.DS I 1i
-File preserved.
-.DE
-If you do not receive this reply,
-seek help immediately.
-Do not simply leave the editor.
-If you do, the buffer will be lost,
-and you may not be able to save your file.
-If the reply is ``File preserved.''
-you can leave the editor
-(or logout)
-to remedy the situation.
-After a preserve, you can use the recover command
-once the problem has been corrected,
-or the \fB\-r\fR option of the edit command
-if you leave the editor and want to return.
-.PP
-If you make an undesirable change to the buffer
-and type a write command before discovering your mistake,
-the modified version will replace any previous version of the file.
-Should you ever lose a good version of a document in this way,
-do not panic and leave the editor.
-As long as you stay in the editor,
-the contents of the buffer remain accessible.
-Depending on the nature of the problem,
-it may be possible
-to restore the buffer to a more complete
-state with the undo command.
-After fixing the damaged buffer, you can again write the file
-to disk.
-.SH
-Further reading and other information
-.PP
-Edit is an editor designed for beginning and casual users.
-It is actually a version of a more powerful editor called
-.I ex.
-These lessons are intended to introduce you to the editor
-and its more commonly-used commands.
-We have not covered all of the editor's commands,
-but a selection of commands
-that should be sufficient to accomplish most of your editing tasks.
-You can find out more about the editor in the
-.I
-Ex Reference Manual,
-.R
-which is applicable to both
-.I ex
-and
-.I edit.
-One way to become familiar with the manual is to begin by reading
-the description of commands that you already know.
-.bd I 3
-.SH
-Using
-.I ex
-.fl
-.bd I
-.PP
-As you become more experienced with using the editor,
-you may still find that edit continues to meet your needs.
-However, should you become interested in using
-.I ex,
-it is easy to switch.
-To begin an editing session with
-.I ex,
-use the name
-.B ex
-in your command instead of
-.B edit.
-.PP
-Edit commands also work in
-.I ex,
-but the editing environment is somewhat different.
-You should be aware of a few differences
-between
-.I ex
-and
-.I edit.
-In edit, only the characters ``^'', ``$'', and ``\\'' have
-special meanings in searching the buffer
-or indicating characters to be changed by a substitute command.
-Several additional characters have special
-meanings in ex, as described in the
-.I
-Ex Reference Manual.
-.R
-Another feature of the edit environment prevents users from
-accidently entering two alternative modes of editing,
-.I open
-and
-.I visual,
-in which
-the editor behaves quite differently from normal command mode.
-If you are using ex and you encounter strange behavior,
-you may have accidently entered open mode by typing ``o''.
-Type the \s-2ESC\s0 key and then a ``Q''
-to get out of open or visual mode and back into
-the regular editor command mode.
-The document
-.I
-An Introduction to Display Editing with Vi\|\|
-.R
-provide full details of visual mode.
-.bp
-.SH
-.ce 1
-\s+2Index\s0
-.LP
-.sp 2
-.2C
-.nf
-addressing, \fIsee\fR line numbers
-ampersand, 20
-append mode, 6-7
-append (a) command, 6, 7, 9
-``At end of file'' (message), 18
-backslash (\\), 21
-buffer, 3
-caret (^), 10, 20
-change (c) command, 18
-command mode, 5-6
-``Command not found'' (message), 6
-context search, 10-12, 19-21
-control characters (``^'' notation), 10
-control-H, 7
-copy (co) command, 15
-corrections, 7, 16
-current filename, 21
-current line (\|.\|), 11, 17
-delete (d) command, 15-16
-dial-up, 5
-disk, 3
-documentation, 3, 23
-dollar ($), 10, 11, 17, 20-21
-dot (\f3\|.\|\f1) 11, 17
-edit (text editor), 3, 5, 23
-edit (e) command, 5, 9, 14
-editing commands:
-.in +.25i
-append (a), 6, 7, 9
-change (c), 18
-copy (co), 15
-delete (d), 15-16
-edit (text editor), 3, 5, 23
-edit (e), 5, 9, 14
-file (f), 21-22
-global (g), 19
-move (m), 14-15
-number (nu), 11
-preserve (pre), 22-23
-print (p), 10
-quit (q), 8, 13
-read (r), 22
-recover (rec), 22, 23
-substitute (s), 11-12, 19, 20
-undo (u), 16-17, 23
-write (w), 8, 13, 21, 22
-z, 12-13
-! (shell escape), 21
-$=, 17
-+, 17
-\-, 17
-//, 12, 20
-??, 20
-\&., 11, 17
-\&.=, 11, 17
-.in -.25i
-entering text, 3, 6-7
-erasing
-.in +.25i
-characters (^H), 7
-lines (@), 7
-.in -.25i
-error corrections, 7, 16
-ex (text editor), 23
-\fIEx Reference Manual\fR, 23
-exclamation (!), 21
-file, 3
-file (f) command, 21-22
-file recovery, 22-23
-filename, 3, 21
-global (g) command, 19
-input mode, 6-7
-Interrupt (message), 9
-line numbers, \fIsee also\fR current line
-.in +.25i
-dollar sign ($), 10, 11, 17
-dot (\|.\|), 11, 17
-relative (+ and \-), 17
-.in -.25i
-list, 10
-logging in, 4-6
-logging out, 8
-``Login incorrect'' (message), 5
-minus (\-), 17
-move (m) command, 14-15
-``Negative address\(emfirst buffer line is 1'' (message), 18
-``No current filename'' (message), 8
-``No such file or directory'' (message), 5, 6
-``No write since last change'' (message), 21
-non-printing characters, 10
-``Nonzero address required'' (message), 18
-``Not an editor command'' (message), 6
-``Not that many lines in buffer'' (message), 18
-number (nu) command, 11
-password, 5
-period (\|.\|), 11, 17
-plus (+), 17
-preserve (pre) command, 22-23
-print (p) command, 10
-program, 3
-prompts
-.in .25i
-% (\s-2UNIX\s0), 5
-: (edit), 5, 6, 7
-\0 (append), 7
-.in -.25i
-question (?), 20
-quit (q) command, 8, 13
-read (r) command, 22
-recover (rec) command, 22, 23
-recovery, \fIsee\fR\| file recovery
-references, 3, 23
-remove (rm) command, 21, 22
-reverse command effects (undo), 16-17, 23
-searching, 10-12, 19-21
-shell, 21
-shell escape (!), 21
-slash (/), 11-12, 20
-special characters (^, $, \\), 10, 11, 17, 20-21
-substitute (s) command, 11-12, 19, 20
-terminals, 4-5
-text input mode, 7
-undo (u) command, 16-17, 23
-\s-1UNIX\s0, 3
-write (w) command, 8, 13, 21, 22
-z command, 12-13
-
diff --git a/docs/USD.doc/exref/Makefile b/docs/USD.doc/exref/Makefile
deleted file mode 100644
index 11b5423607e7..000000000000
--- a/docs/USD.doc/exref/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# @(#)Makefile 8.8 (Berkeley) 10/10/96
-
-ROFF= groff
-TBL= tbl
-
-all: exref.ps summary.ps
-
-exref.ps: ex.rm
- ${TBL} ex.rm | ${ROFF} -ms > $@
- chmod 444 $@
-
-summary.ps: ex.summary
- ${TBL} ex.summary | ${ROFF} -ms > $@
- chmod 444 $@
-
-clean:
- rm -f exref.ps summary.ps
diff --git a/docs/USD.doc/exref/ex.rm b/docs/USD.doc/exref/ex.rm
deleted file mode 100644
index 217bad46d277..000000000000
--- a/docs/USD.doc/exref/ex.rm
+++ /dev/null
@@ -1,2213 +0,0 @@
-.\" 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. 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.
-.\"
-.\" @(#)ex.rm 8.5 (Berkeley) 8/18/96
-.\"
-.nr LL 6.5i
-.nr FL 6.5i
-.EH 'USD:12-%''Ex Reference Manual'
-.OH 'Ex Reference Manual''USD:12-%'
-.nr )P 0
-.de ZP
-.nr pd \\n()P
-.nr )P 0
-.if \\n(.$=0 .IP
-.if \\n(.$=1 .IP "\\$1"
-.if \\n(.$>=2 .IP "\\$1" "\\$2"
-.nr )P \\n(pd
-.rm pd
-..
-.de LC
-.br
-.sp .1i
-.ne 4
-.LP
-.ta 4.0i
-..
-.bd S B 3
-.\".RP
-.TL
-Ex Reference Manual
-.br
-Version 3.7
-.AU
-William Joy
-.AU
-Mark Horton
-.AI
-Computer Science Division
-Department of Electrical Engineering and Computer Science
-University of California, Berkeley
-Berkeley, Ca. 94720
-.AB
-.I Ex
-a line oriented text editor, which supports both command and display
-oriented editing.
-This reference manual describes the command oriented part of
-.I ex;
-the display editing features of
-.I ex
-are described in
-.I "An Introduction to Display Editing with Vi."
-Other documents about the editor include the introduction
-.I "Edit: A tutorial",
-the
-.I "Ex/edit Command Summary",
-and a
-.I "Vi Quick Reference"
-card.
-.AE
-.NH 1
-Starting ex
-.PP
-.FS
-The financial support of an \s-2IBM\s0 Graduate Fellowship and the National
-Science Foundation under grants MCS74-07644-A03 and MCS78-07291 is gratefully
-acknowledged.
-.FE
-Each instance of the editor has a set of options,
-which can be set to tailor it to your liking.
-The command
-.I edit
-invokes a version of
-.I ex
-designed for more casual or beginning
-users by changing the default settings of some of these options.
-To simplify the description which follows we
-assume the default settings of the options.
-.PP
-When invoked,
-.I ex
-determines the terminal type from the \s-2TERM\s0 variable in the environment.
-It there is a \s-2TERMCAP\s0 variable in the environment, and the type
-of the terminal described there matches the \s-2TERM\s0 variable,
-then that description
-is used. Also if the \s-2TERMCAP\s0 variable contains a pathname (beginning
-with a \fB/\fR) then the editor will seek the description of the terminal
-in that file (rather than the default /etc/termcap).
-If there is a variable \s-2EXINIT\s0 in the environment, then the editor
-will execute the commands in that variable,
-otherwise if there is a file
-.I \&.exrc
-in your \s-2HOME\s0 directory
-.I ex
-reads commands from that file, simulating a
-.I source
-command.
-Option setting commands placed in
-\s-2EXINIT\s0 or
-.I \&.exrc
-will be executed before each editor session.
-.PP
-A command to enter
-.I ex
-has the following prototype:\(dg
-.FS
-\(dg Brackets `[' `]' surround optional parameters here.
-.FE
-.DS
-\fBex\fP [ \fB\-\fP ] [ \fB\-v\fP ] [ \fB\-t\fP \fItag\fP ] [ \fB\-r\fP ] [ \fB\-l\fP ] [ \fB\-w\fP\fIn\fP ] [ \fB\-x\fP ] [ \fB\-R\fP ] [ \fB+\fP\fIcommand\fP ] name ...
-.DE
-The most common case edits a single file with no options, i.e.:
-.DS
-\fBex\fR name
-.DE
-The
-.B \-
-command line option
-option suppresses all interactive-user feedback
-and is useful in processing editor scripts in command files.
-The
-.B \-v
-option is equivalent to using
-.I vi
-rather than
-.I ex.
-The
-.B \-t
-option is equivalent to an initial
-.I tag
-command, editing the file containing the
-.I tag
-and positioning the editor at its definition.
-The
-.B \-r
-option is used in recovering after an editor or system crash,
-retrieving the last saved version of the named file or,
-if no file is specified,
-typing a list of saved files.
-The
-.B \-l
-option sets up for editing \s-2LISP\s0, setting the
-.I showmatch
-and
-.I lisp
-options.
-The
-.B \-w
-option sets the default window size to
-.I n,
-and is useful on dialups to start in small windows.
-The
-.B \-x
-option causes
-.I ex
-to prompt for a
-.I key ,
-which is used to encrypt and decrypt the contents of the file,
-which should already be encrypted using the same key,
-see
-.I crypt (1).
-The
-.B \-R
-option sets the
-.I readonly
-option at the start.
-.I Name
-arguments indicate files to be edited.
-An argument of the form
-\fB+\fIcommand\fR
-indicates that the editor should begin by executing the specified command.
-If
-.I command
-is omitted, then it defaults to ``$'', positioning the editor at the last
-line of the first file initially. Other useful commands here are scanning
-patterns of the form ``/pat'' or line numbers, e.g. ``+100'' starting
-at line 100.
-.NH 1
-File manipulation
-.NH 2
-Current file
-.PP
-.I Ex
-is normally editing the contents of a single file,
-whose name is recorded in the
-.I current
-file name.
-.I Ex
-performs all editing actions in a buffer
-(actually a temporary file)
-into which the text of the file is initially read.
-Changes made to the buffer have no effect on the file being
-edited unless and until the buffer contents are written out to the
-file with a
-.I write
-command.
-After the buffer contents are written,
-the previous contents of the written file are no longer accessible.
-When a file is edited,
-its name becomes the current file name,
-and its contents are read into the buffer.
-.PP
-The current file is almost always considered to be
-.I edited.
-This means that the contents of the buffer are logically
-connected with the current file name,
-so that writing the current buffer contents onto that file,
-even if it exists,
-is a reasonable action.
-If the current file is not
-.I edited
-then
-.I ex
-will not normally write on it if it already exists.*
-.FS
-* The
-.I file
-command will say ``[Not edited]'' if the current file is not considered
-edited.
-.FE
-.NH 2
-Alternate file
-.PP
-Each time a new value is given to the current file name,
-the previous current file name is saved as the
-.I alternate
-file name.
-Similarly if a file is mentioned but does not become the current file,
-it is saved as the alternate file name.
-.NH 2
-Filename expansion
-.PP
-Filenames within the editor may be specified using the normal
-shell expansion conventions.
-In addition,
-the character `%' in filenames is replaced by the
-.I current
-file name and the character
-`#' by the
-.I alternate
-file name.\(dg
-.FS
-\(dg This makes it easy to deal alternately with
-two files and eliminates the need for retyping the
-name supplied on an
-.I edit
-command after a
-.I "No write since last change"
-diagnostic is received.
-.FE
-.NH 2
-Multiple files and named buffers
-.PP
-If more than one file is given on the command line,
-then the first file is edited as described above.
-The remaining arguments are placed with the first file in the
-.I "argument list."
-The current argument list may be displayed with the
-.I args
-command.
-The next file in the argument list may be edited with the
-.I next
-command.
-The argument list may also be respecified by specifying
-a list of names to the
-.I next
-command.
-These names are expanded,
-the resulting list of names becomes the new argument list,
-and
-.I ex
-edits the first file on the list.
-.PP
-For saving blocks of text while editing, and especially when editing
-more than one file,
-.I ex
-has a group of named buffers.
-These are similar to the normal buffer, except that only a limited number
-of operations are available on them.
-The buffers have names
-.I a
-through
-.I z.\(dd
-.FS
-\(dd It is also possible to refer to
-.I A
-through
-.I Z;
-the upper case buffers are the same as the lower but commands
-append to named buffers rather than replacing
-if upper case names are used.
-.FE
-.NH 2
-Read only
-.PP
-It is possible to use
-.I ex
-in
-.I "read only"
-mode to look at files that you have no intention of modifying.
-This mode protects you from accidently overwriting the file.
-Read only mode is on when the
-.I readonly
-option is set.
-It can be turned on with the
-.B \-R
-command line option,
-by the
-.I view
-command line invocation,
-or by setting the
-.I readonly
-option.
-It can be cleared by setting
-.I noreadonly .
-It is possible to write, even while in read only mode, by indicating
-that you really know what you are doing.
-You can write to a different file, or can use the ! form of write,
-even while in read only mode.
-.NH 1
-Exceptional Conditions
-.NH 2
-Errors and interrupts
-.PP
-When errors occur
-.I ex
-(optionally) rings the terminal bell and, in any case, prints an error
-diagnostic. If the primary input is from a file, editor processing
-will terminate. If an interrupt signal is received,
-.I ex
-prints ``Interrupt'' and returns to its command level. If the primary
-input is a file, then
-.I ex
-will exit when this occurs.
-.NH 2
-Recovering from hangups and crashes
-.PP
-If a hangup signal is received and the buffer has been modified since
-it was last written out, or if the system crashes, either the editor
-(in the first case) or the system (after it reboots in the second) will
-attempt to preserve the buffer. The next time you log in you should be
-able to recover the work you were doing, losing at most a few lines of
-changes from the last point before the hangup or editor crash. To
-recover a file you can use the
-.B \-r
-option. If you were editing the file
-.I resume,
-then you should change
-to the directory where you were when the crash occurred, giving the command
-.DS
-\fBex \-r\fP\fI resume\fP
-.DE
-After checking that the retrieved file is indeed ok, you can
-.I write
-it over the previous contents of that file.
-.PP
-You will normally get mail from the system telling you when a file has
-been saved after a crash. The command
-.DS
-\fBex\fP \-\fBr\fP
-.DE
-will print a list of the files which have been saved for you.
-(In the case of a hangup,
-the file will not appear in the list,
-although it can be recovered.)
-.NH 1
-Editing modes
-.PP
-.I Ex
-has five distinct modes. The primary mode is
-.I command
-mode. Commands are entered in command mode when a `:' prompt is
-present, and are executed each time a complete line is sent. In
-.I "text input"
-mode
-.I ex
-gathers input lines and places them in the file. The
-.I append,
-.I insert,
-and
-.I change
-commands use text input mode.
-No prompt is printed when you are in text input mode.
-This mode is left by typing a `.' alone at the beginning of a line, and
-.I command
-mode resumes.
-.PP
-The last three modes are
-.I open
-and
-.I visual
-modes, entered by the commands of the same name, and, within open and
-visual modes
-.I "text insertion"
-mode.
-.I Open
-and
-.I visual
-modes allow local editing operations to be performed on the text in the
-file. The
-.I open
-command displays one line at a time on any terminal while
-.I visual
-works on \s-2CRT\s0 terminals with random positioning cursors, using the
-screen as a (single) window for file editing changes.
-These modes are described (only) in
-.I "An Introduction to Display Editing with Vi."
-.NH
-Command structure
-.PP
-Most command names are English words,
-and initial prefixes of the words are acceptable abbreviations.
-The ambiguity of abbreviations is resolved in favor of the more commonly
-used commands.*
-.FS
-* As an example, the command
-.I substitute
-can be abbreviated `s'
-while the shortest available abbreviation for the
-.I set
-command is `se'.
-.FE
-.NH 2
-Command parameters
-.PP
-Most commands accept prefix addresses specifying the lines in the file
-upon which they are to have effect.
-The forms of these addresses will be discussed below.
-A number of commands also may take a trailing
-.I count
-specifying the number of lines to be involved in the command.\(dg
-.FS
-\(dg Counts are rounded down if necessary.
-.FE
-Thus the command ``10p'' will print the tenth line in the buffer while
-``delete 5'' will delete five lines from the buffer,
-starting with the current line.
-.PP
-Some commands take other information or parameters,
-this information always being given after the command name.\(dd
-.FS
-\(dd Examples would be option names in a
-.I set
-command i.e. ``set number'',
-a file name in an
-.I edit
-command,
-a regular expression in a
-.I substitute
-command,
-or a target address for a
-.I copy
-command, i.e. ``1,5 copy 25''.
-.FE
-.NH 2
-Command variants
-.PP
-A number of commands have two distinct variants.
-The variant form of the command is invoked by placing an
-`!' immediately after the command name.
-Some of the default variants may be controlled by options;
-in this case, the `!' serves to toggle the default.
-.NH 2
-Flags after commands
-.PP
-The characters `#', `p' and `l' may be placed after many commands.**
-.FS
-**
-A `p' or `l' must be preceded by a blank or tab
-except in the single special case `dp'.
-.FE
-In this case, the command abbreviated by these characters
-is executed after the command completes.
-Since
-.I ex
-normally prints the new current line after each change, `p' is rarely necessary.
-Any number of `+' or `\-' characters may also be given with these flags.
-If they appear, the specified offset is applied to the current line
-value before the printing command is executed.
-.NH 2
-Comments
-.PP
-It is possible to give editor commands which are ignored.
-This is useful when making complex editor scripts
-for which comments are desired.
-The comment character is the double quote: ".
-Any command line beginning with " is ignored.
-Comments beginning with " may also be placed at the ends
-of commands, except in cases where they could be confused as part
-of text (shell escapes and the substitute and map commands).
-.NH 2
-Multiple commands per line
-.PP
-More than one command may be placed on a line by separating each pair
-of commands by a `|' character.
-However the
-.I global
-commands,
-comments,
-and the shell escape `!'
-must be the last command on a line, as they are not terminated by a `|'.
-.NH 2
-Reporting large changes
-.PP
-Most commands which change the contents of the editor buffer give
-feedback if the scope of the change exceeds a threshold given by the
-.I report
-option.
-This feedback helps to detect undesirably large changes so that they may
-be quickly and easily reversed with an
-.I undo.
-After commands with more global effect such as
-.I global
-or
-.I visual,
-you will be informed if the net change in the number of lines
-in the buffer during this command exceeds this threshold.
-.NH 1
-Command addressing
-.NH 2
-Addressing primitives
-.IP \fB.\fR 20
-The current line.
-Most commands leave the current line as the last line which they affect.
-The default address for most commands is the current line,
-thus `\fB.\fR' is rarely used alone as an address.
-.IP \fIn\fR 20
-The \fIn\fRth line in the editor's buffer, lines being numbered
-sequentially from 1.
-.IP \fB$\fR 20
-The last line in the buffer.
-.IP \fB%\fR 20
-An abbreviation for ``1,$'', the entire buffer.
-.IP \fI+n\fR\ \fI\-n\fR 20
-An offset relative to the current buffer line.\(dg
-.FS
-\(dg
-The forms `.+3' `+3' and `+++' are all equivalent;
-if the current line is line 100 they all address line 103.
-.FE
-.IP \fB/\fIpat\fR\fB/\fR\ \fB?\fIpat\fR\fB?\fR 20
-Scan forward and backward respectively for a line containing \fIpat\fR, a
-regular expression (as defined below). The scans normally wrap around the end
-of the buffer.
-If all that is desired is to print the next line containing \fIpat\fR, then
-the trailing \fB/\fR or \fB?\fR may be omitted.
-If \fIpat\fP is omitted or explicitly empty, then the last
-regular expression specified is located.\(dd
-.FS
-\(dd The forms \fB\e/\fP and \fB\e?\fP scan
-using the last regular expression used in a scan; after a substitute
-\fB//\fP and \fB??\fP would scan using the substitute's regular expression.
-.FE
-.IP \fB\(aa\(aa\fP\ \fB\(aa\fP\fIx\fP 20
-Before each non-relative motion of the current line `\fB.\fP',
-the previous current line is marked with a tag, subsequently referred to as
-`\(aa\(aa'.
-This makes it easy to refer or return to this previous context.
-Marks may also be established by the
-.I mark
-command, using single lower case letters
-.I x
-and the marked lines referred to as
-`\(aa\fIx\fR'.
-.NH 2
-Combining addressing primitives
-.PP
-Addresses to commands consist of a series of addressing primitives,
-separated by `,' or `;'.
-Such address lists are evaluated left-to-right.
-When addresses are separated by `;' the current line `\fB.\fR'
-is set to the value of the previous addressing expression
-before the next address is interpreted.
-If more addresses are given than the command requires,
-then all but the last one or two are ignored.
-If the command takes two addresses, the first addressed line must
-precede the second in the buffer.\(dg
-.FS
-\(dg Null address specifications are permitted in a list of addresses,
-the default in this case is the current line `.';
-thus `,100' is equivalent to `\fB.\fR,100'.
-It is an error to give a prefix address to a command which expects none.
-.FE
-.NH 1
-Command descriptions
-.PP
-The following form is a prototype for all
-.I ex
-commands:
-.DS
-\fIaddress\fR \fBcommand\fR \fI! parameters count flags\fR
-.DE
-All parts are optional; the degenerate case is the empty command which prints
-the next line in the file. For sanity with use from within
-.I visual
-mode,
-.I ex
-ignores a ``:'' preceding any command.
-.PP
-In the following command descriptions, the
-default addresses are shown in parentheses,
-which are
-.I not,
-however,
-part of the command.
-.LC
-\fBabbreviate\fR \fIword rhs\fP abbr: \fBab\fP
-.ZP
-Add the named abbreviation to the current list.
-When in input mode in visual, if
-.I word
-is typed as a complete word, it will be changed to
-.I rhs .
-.LC
-( \fB.\fR ) \fBappend\fR abbr: \fBa\fR
-.br
-\fItext\fR
-.br
-\&\fB.\fR
-.ZP
-Reads the input text and places it after the specified line.
-After the command, `\fB.\fR'
-addresses the last line input or the
-specified line if no lines were input.
-If address `0' is given,
-text is placed at the beginning of the buffer.
-.LC
-\fBa!\fR
-.br
-\fItext\fR
-.br
-\&\fB.\fR
-.ZP
-The variant flag to
-.I append
-toggles the setting for the
-.I autoindent
-option during the input of
-.I text.
-.LC
-\fBargs\fR
-.ZP
-The members of the argument list are printed, with the current argument
-delimited by `[' and `]'.
-.ig
-.PP
-\fBcd\fR \fIdirectory\fR
-.ZP
-The
-.I cd
-command is a synonym for
-.I chdir.
-..
-.LC
-( \fB.\fP , \fB.\fP ) \fBchange\fP \fIcount\fP abbr: \fBc\fP
-.br
-\fItext\fP
-.br
-\&\fB.\fP
-.ZP
-Replaces the specified lines with the input \fItext\fP.
-The current line becomes the last line input;
-if no lines were input it is left as for a
-\fIdelete\fP.
-.LC
-\fBc!\fP
-.br
-\fItext\fP
-.br
-\&\fB.\fP
-.ZP
-The variant toggles
-.I autoindent
-during the
-.I change.
-.ig
-.LC
-\fBchdir\fR \fIdirectory\fR
-.ZP
-The specified \fIdirectory\fR becomes the current directory.
-If no directory is specified, the current value of the
-.I home
-option is used as the target directory.
-After a
-.I chdir
-the current file is not considered to have been
-edited so that write restrictions on pre-existing files apply.
-..
-.LC
-( \fB.\fP , \fB.\fP )\|\fBcopy\fP \fIaddr\fP \fIflags\fP abbr: \fBco\fP
-.ZP
-A
-.I copy
-of the specified lines is placed after
-.I addr,
-which may be `0'.
-The current line
-`\fB.\fR'
-addresses the last line of the copy.
-The command
-.I t
-is a synonym for
-.I copy.
-.LC
-( \fB.\fR , \fB.\fR )\|\fBdelete\fR \fIbuffer\fR \fIcount\fR \fIflags\fR abbr: \fBd\fR
-.ZP
-Removes the specified lines from the buffer.
-The line after the last line deleted becomes the current line;
-if the lines deleted were originally at the end,
-the new last line becomes the current line.
-If a named
-.I buffer
-is specified by giving a letter,
-then the specified lines are saved in that buffer,
-or appended to it if an upper case letter is used.
-.LC
-\fBedit\fR \fIfile\fR abbr: \fBe\fR
-.br
-\fBex\fR \fIfile\fR
-.ZP
-Used to begin an editing session on a new file.
-The editor
-first checks to see if the buffer has been modified since the last
-.I write
-command was issued.
-If it has been,
-a warning is issued and the
-command is aborted.
-The
-command otherwise deletes the entire contents of the editor buffer,
-makes the named file the current file and prints the new filename.
-After insuring that this file is sensible\(dg
-.FS
-\(dg I.e., that it is not a binary file such as a directory,
-a block or character special file other than
-.I /dev/tty,
-a terminal,
-or a binary or executable file
-(as indicated by the first word).
-.FE
-the editor reads the file into its buffer.
-.IP
-If the read of the file completes without error,
-the number of lines and characters read is typed.
-If there were any non-\s-2ASCII\s0 characters
-in the file they are stripped of their non-\s-2ASCII\s0
-high bits,
-and any null characters in the file are discarded.
-If none of these errors occurred, the file is considered
-.I edited.
-If the last line of the input file is missing the trailing
-newline character, it will be supplied and a complaint will be issued.
-This command leaves the current line `\fB.\fR' at the last line read.\(dd
-.FS
-\(dd If executed from within
-.I open
-or
-.I visual,
-the current line is initially the first line of the file.
-.FE
-.LC
-\fBe!\fR \fIfile\fR
-.ZP
-The variant form suppresses the complaint about modifications having
-been made and not written from the editor buffer, thus
-discarding all changes which have been made before editing the new file.
-.LC
-\fBe\fR \fB+\fIn\fR \fIfile\fR
-.ZP
-Causes the editor to begin at line
-.I n
-rather than at the last line;
-\fIn\fR may also be an editor command containing no spaces, e.g.: ``+/pat''.
-.LC
-\fBfile\fR abbr: \fBf\fR
-.ZP
-Prints the current file name,
-whether it has been `[Modified]' since the last
-.I write
-command,
-whether it is
-.I "read only" ,
-the current line,
-the number of lines in the buffer,
-and the percentage of the way through the buffer of the current line.*
-.FS
-* In the rare case that the current file is `[Not edited]' this is
-noted also; in this case you have to use the form \fBw!\fR to write to
-the file, since the editor is not sure that a \fBwrite\fR will not
-destroy a file unrelated to the current contents of the buffer.
-.FE
-.LC
-\fBfile\fR \fIfile\fR
-.ZP
-The current file name is changed to
-.I file
-which is considered
-`[Not edited]'.
-.LC
-( 1 , $ ) \fBglobal\fR /\fIpat\|\fR/ \fIcmds\fR abbr: \fBg\fR
-.ZP
-First marks each line among those specified which matches
-the given regular expression.
-Then the given command list is executed with `\fB.\fR' initially
-set to each marked line.
-.IP
-The command list consists of the remaining commands on the current
-input line and may continue to multiple lines by ending all but the
-last such line with a `\e'.
-If
-.I cmds
-(and possibly the trailing \fB/\fR delimiter) is omitted, each line matching
-.I pat
-is printed.
-.I Append,
-.I insert,
-and
-.I change
-commands and associated input are permitted;
-the `\fB.\fR' terminating input may be omitted if it would be on the
-last line of the command list.
-.I Open
-and
-.I visual
-commands are permitted in the command list and take input from the terminal.
-.IP
-The
-.I global
-command itself may not appear in
-.I cmds.
-The
-.I undo
-command is also not permitted there,
-as
-.I undo
-instead can be used to reverse the entire
-.I global
-command.
-The options
-.I autoprint
-and
-.I autoindent
-are inhibited during a
-.I global,
-(and possibly the trailing \fB/\fR delimiter) and the value of the
-.I report
-option is temporarily infinite,
-in deference to a \fIreport\fR for the entire global.
-Finally, the context mark `\'\'' is set to the value of
-`.' before the global command begins and is not changed during a global
-command,
-except perhaps by an
-.I open
-or
-.I visual
-within the
-.I global.
-.LC
-\fBg!\fR \fB/\fIpat\fB/\fR \fIcmds\fR abbr: \fBv\fR
-.IP
-The variant form of \fIglobal\fR runs \fIcmds\fR at each line not matching
-\fIpat\fR.
-.LC
-( \fB.\fR )\|\fBinsert\fR abbr: \fBi\fR
-.br
-\fItext\fR
-.br
-\&\fB.\fR
-.ZP
-Places the given text before the specified line.
-The current line is left at the last line input;
-if there were none input it is left at the line before the addressed line.
-This command differs from
-.I append
-only in the placement of text.
-.KS
-.LC
-\fBi!\fR
-.br
-\fItext\fR
-.br
-\&\fB.\fR
-.ZP
-The variant toggles
-.I autoindent
-during the
-.I insert.
-.KE
-.LC
-( \fB.\fR , \fB.\fR+1 ) \fBjoin\fR \fIcount\fR \fIflags\fR abbr: \fBj\fR
-.ZP
-Places the text from a specified range of lines
-together on one line.
-White space is adjusted at each junction to provide at least
-one blank character, two if there was a `\fB.\fR' at the end of the line,
-or none if the first following character is a `)'.
-If there is already white space at the end of the line,
-then the white space at the start of the next line will be discarded.
-.LC
-\fBj!\fR
-.ZP
-The variant causes a simpler
-.I join
-with no white space processing; the characters in the lines are simply
-concatenated.
-.LC
-( \fB.\fR ) \fBk\fR \fIx\fR
-.ZP
-The
-.I k
-command is a synonym for
-.I mark.
-It does not require a blank or tab before the following letter.
-.LC
-( \fB.\fR , \fB.\fR ) \fBlist\fR \fIcount\fR \fIflags\fR
-.ZP
-Prints the specified lines in a more unambiguous way:
-tabs are printed as `^I'
-and the end of each line is marked with a trailing `$'.
-The current line is left at the last line printed.
-.LC
-\fBmap\fR \fIlhs\fR \fIrhs\fR
-.ZP
-The
-.I map
-command is used to define macros for use in
-.I visual
-mode.
-.I Lhs
-should be a single character, or the sequence ``#n'', for n a digit,
-referring to function key \fIn\fR. When this character or function key
-is typed in
-.I visual
-mode, it will be as though the corresponding \fIrhs\fR had been typed.
-On terminals without function keys, you can type ``#n''.
-See section 6.9 of the ``Introduction to Display Editing with Vi''
-for more details.
-.LC
-( \fB.\fR ) \fBmark\fR \fIx\fR
-.ZP
-Gives the specified line mark
-.I x,
-a single lower case letter.
-The
-.I x
-must be preceded by a blank or a tab.
-The addressing form `\'x' then addresses this line.
-The current line is not affected by this command.
-.LC
-( \fB.\fR , \fB.\fR ) \fBmove\fR \fIaddr\fR abbr: \fBm\fR
-.ZP
-The
-.I move
-command repositions the specified lines to be after
-.I addr .
-The first of the moved lines becomes the current line.
-.LC
-\fBnext\fR abbr: \fBn\fR
-.ZP
-The next file from the command line argument list is edited.
-.LC
-\fBn!\fR
-.ZP
-The variant suppresses warnings about the modifications to the buffer not
-having been written out, discarding (irretrievably) any changes which may
-have been made.
-.LC
-\fBn\fR \fIfilelist\fR
-.br
-\fBn\fR \fB+\fIcommand\fR \fIfilelist\fR
-.ZP
-The specified
-.I filelist
-is expanded and the resulting list replaces the
-current argument list;
-the first file in the new list is then edited.
-If
-.I command
-is given (it must contain no spaces), then it is executed after editing the first such file.
-.LC
-( \fB.\fR , \fB.\fR ) \fBnumber\fR \fIcount\fR \fIflags\fR abbr: \fB#\fR or \fBnu\fR
-.ZP
-Prints each specified line preceded by its buffer line
-number.
-The current line is left at the last line printed.
-.KS
-.LC
-( \fB.\fR ) \fBopen\fR \fIflags\fR abbr: \fBo\fR
-.br
-( \fB.\fR ) \fBopen\fR /\fIpat\|\fR/ \fIflags\fR
-.ZP
-Enters intraline editing \fIopen\fR mode at each addressed line.
-If
-.I pat
-is given,
-then the cursor will be placed initially at the beginning of the
-string matched by the pattern.
-To exit this mode use Q.
-See
-.I "An Introduction to Display Editing with Vi"
-for more details.
-.KE
-.LC
-\fBpreserve\fR
-.ZP
-The current editor buffer is saved as though the system had just crashed.
-This command is for use only in emergencies when a
-.I write
-command has resulted in an error and you don't know how to save your work.
-After a
-.I preserve
-you should seek help.
-.LC
-( \fB.\fR , \fB.\fR )\|\fBprint\fR \fIcount\fR abbr: \fBp\fR or \fBP\fR
-.ZP
-Prints the specified lines
-with non-printing characters printed as control characters `^\fIx\fR\|';
-delete (octal 177) is represented as `^?'.
-The current line is left at the last line printed.
-.LC
-( \fB.\fR )\|\fBput\fR \fIbuffer\fR abbr: \fBpu\fR
-.ZP
-Puts back
-previously
-.I deleted
-or
-.I yanked
-lines.
-Normally used with
-.I delete
-to effect movement of lines,
-or with
-.I yank
-to effect duplication of lines.
-If no
-.I buffer
-is specified, then the last
-.I deleted
-or
-.I yanked
-text is restored.*
-.FS
-* But no modifying commands may intervene between the
-.I delete
-or
-.I yank
-and the
-.I put,
-nor may lines be moved between files without using a named buffer.
-.FE
-By using a named buffer, text may be restored that was saved there at any
-previous time.
-.LC
-\fBquit\fR abbr: \fBq\fR
-.ZP
-Causes
-.I ex
-to terminate.
-No automatic write of the editor buffer to a file is performed.
-However,
-.I ex
-issues a warning message if the file has changed
-since the last
-.I write
-command was issued, and does not
-.I quit.\(dg
-.FS
-\(dg \fIEx\fR
-will also issue a diagnostic if there are more files in the argument
-list.
-.FE
-Normally, you will wish to save your changes, and you
-should give a \fIwrite\fR command;
-if you wish to discard them, use the \fBq!\fR command variant.
-.LC
-\fBq!\fR
-.ZP
-Quits from the editor, discarding changes to the buffer without complaint.
-.LC
-( \fB.\fR ) \fBread\fR \fIfile\fR abbr: \fBr\fR
-.ZP
-Places a copy of the text of the given file in the
-editing buffer after the specified line.
-If no
-.I file
-is given the current file name is used.
-The current file name is not changed unless there is none in which
-case
-.I file
-becomes the current name.
-The sensibility restrictions for the
-.I edit
-command apply here also.
-If the file buffer is empty and there is no current name then
-.I ex
-treats this as an
-.I edit
-command.
-.IP
-Address `0' is legal for this command and causes the file to be read at
-the beginning of the buffer.
-Statistics are given as for the
-.I edit
-command when the
-.I read
-successfully terminates.
-After a
-.I read
-the current line is the last line read.\(dd
-.FS
-\(dd Within
-.I open
-and
-.I visual
-the current line is set to the first line read rather than the last.
-.FE
-.LC
-( \fB.\fR ) \fBread\fR \fB!\fR\fIcommand\fR
-.ZP
-Reads the output of the command
-.I command
-into the buffer after the specified line.
-This is not a variant form of the command, rather a read
-specifying a
-.I command
-rather than a
-.I filename;
-a blank or tab before the \fB!\fR is mandatory.
-.LC
-\fBrecover \fIfile\fR
-.ZP
-Recovers
-.I file
-from the system save area.
-Used after a accidental hangup of the phone**
-.FS
-** The system saves a copy of the file you were editing only if you
-have made changes to the file.
-.FE
-or a system crash** or
-.I preserve
-command.
-Except when you use
-.I preserve
-you will be notified by mail when a file is saved.
-.LC
-\fBrewind\fR abbr: \fBrew\fR
-.ZP
-The argument list is rewound, and the first file in the list is edited.
-.LC
-\fBrew!\fR
-.ZP
-Rewinds the argument list discarding any changes made to the current buffer.
-.LC
-\fBset\fR \fIparameter\fR
-.ZP
-With no arguments, prints those options whose values have been
-changed from their defaults;
-with parameter
-.I all
-it prints all of the option values.
-.IP
-Giving an option name followed by a `?'
-causes the current value of that option to be printed.
-The `?' is unnecessary unless the option is Boolean valued.
-Boolean options are given values either by the form
-`set \fIoption\fR' to turn them on or
-`set no\fIoption\fR' to turn them off;
-string and numeric options are assigned via the form
-`set \fIoption\fR=value'.
-.IP
-More than one parameter may be given to
-.I set \|;
-they are interpreted left-to-right.
-.LC
-\fBshell\fR abbr: \fBsh\fR
-.IP
-A new shell is created.
-When it terminates, editing resumes.
-.LC
-\fBsource\fR \fIfile\fR abbr: \fBso\fR
-.IP
-Reads and executes commands from the specified file.
-.I Source
-commands may be nested.
-.LC
-( \fB.\fR , \fB.\fR ) \fBsubstitute\fR /\fIpat\fR\|/\fIrepl\fR\|/ \fIoptions\fR \fIcount\fR \fIflags\fR abbr: \fBs\fR
-.IP
-On each specified line, the first instance of pattern
-.I pat
-is replaced by replacement pattern
-.I repl.
-If the
-.I global
-indicator option character `g'
-appears, then all instances are substituted;
-if the
-.I confirm
-indication character `c' appears,
-then before each substitution the line to be substituted
-is typed with the string to be substituted marked
-with `\(ua' characters.
-By typing an `y' one can cause the substitution to be performed,
-any other input causes no change to take place.
-After a
-.I substitute
-the current line is the last line substituted.
-.IP
-Lines may be split by substituting
-new-line characters into them.
-The newline in
-.I repl
-must be escaped by preceding it with a `\e'.
-Other metacharacters available in
-.I pat
-and
-.I repl
-are described below.
-.LC
-.B stop
-.ZP
-Suspends the editor, returning control to the top level shell.
-If
-.I autowrite
-is set and there are unsaved changes,
-a write is done first unless the form
-.B stop !
-is used.
-This commands is only available where supported by the teletype driver
-and operating system.
-.LC
-( \fB.\fR , \fB.\fR ) \fBsubstitute\fR \fIoptions\fR \fIcount\fR \fIflags\fR abbr: \fBs\fR
-.ZP
-If
-.I pat
-and
-.I repl
-are omitted, then the last substitution is repeated.
-This is a synonym for the
-.B &
-command.
-.LC
-( \fB.\fR , \fB.\fR ) \fBt\fR \fIaddr\fR \fIflags\fR
-.ZP
-The
-.I t
-command is a synonym for
-.I copy .
-.LC
-\fBta\fR \fItag\fR
-.ZP
-The focus of editing switches to the location of
-.I tag,
-switching to a different line in the current file where it is defined,
-or if necessary to another file.\(dd
-.FS
-\(dd If you have modified the current file before giving a
-.I tag
-command, you must write it out; giving another
-.I tag
-command, specifying no
-.I tag
-will reuse the previous tag.
-.FE
-.IP
-The tags file is normally created by a program such as
-.I ctags,
-and consists of a number of lines with three fields separated by blanks
-or tabs. The first field gives the name of the tag,
-the second the name of the file where the tag resides, and the third
-gives an addressing form which can be used by the editor to find the tag;
-this field is usually a contextual scan using `/\fIpat\fR/' to be immune
-to minor changes in the file. Such scans are always performed as if
-.I nomagic
-was set.
-.PP
-The tag names in the tags file must be sorted alphabetically.
-.LC
-\fBunabbreviate\fR \fIword\fP abbr: \fBuna\fP
-.ZP
-Delete
-.I word
-from the list of abbreviations.
-.LC
-\fBundo\fR abbr: \fBu\fR
-.ZP
-Reverses the changes made in the buffer by the last
-buffer editing command.
-Note that
-.I global
-commands are considered a single command for the purpose of
-.I undo
-(as are
-.I open
-and
-.I visual.)
-Also, the commands
-.I write
-and
-.I edit
-which interact with the
-file system cannot be undone.
-.I Undo
-is its own inverse.
-.IP
-.I Undo
-always marks the previous value of the current line `\fB.\fR'
-as `\'\''.
-After an
-.I undo
-the current line is the first line restored
-or the line before the first line deleted if no lines were restored.
-For commands with more global effect
-such as
-.I global
-and
-.I visual
-the current line regains it's pre-command value after an
-.I undo.
-.LC
-\fBunmap\fR \fIlhs\fR
-.ZP
-The macro expansion associated by
-.I map
-for
-.I lhs
-is removed.
-.LC
-( 1 , $ ) \fBv\fR /\fIpat\fR\|/ \fIcmds\fR
-.ZP
-A synonym for the
-.I global
-command variant \fBg!\fR, running the specified \fIcmds\fR on each
-line which does not match \fIpat\fR.
-.LC
-\fBversion\fR abbr: \fBve\fR
-.ZP
-Prints the current version number of the editor
-as well as the date the editor was last changed.
-.LC
-( \fB.\fR ) \fBvisual\fR \fItype\fR \fIcount\fR \fIflags\fR abbr: \fBvi\fR
-.ZP
-Enters visual mode at the specified line.
-.I Type
-is optional and may be `\-' , `\(ua' or `\fB.\fR'
-as in the
-.I z
-command to specify the placement of the specified line on the screen.
-By default, if
-.I type
-is omitted, the specified line is placed as the first on the screen.
-A
-.I count
-specifies an initial window size; the default is the value of the option
-.I window.
-See the document
-.I "An Introduction to Display Editing with Vi"
-for more details.
-To exit this mode, type Q.
-.LC
-\fBvisual\fP file
-.br
-\fBvisual\fP +\fIn\fP file
-.ZP
-From visual mode,
-this command is the same as edit.
-.LC
-( 1 , $ ) \fBwrite\fR \fIfile\fR abbr: \fBw\fR
-.ZP
-Writes changes made back to \fIfile\fR, printing the number of lines and
-characters written.
-Normally \fIfile\fR is omitted and the text goes back where it came from.
-If a \fIfile\fR is specified, then text will be written to that file.*
-.FS
-* The editor writes to a file only if it is
-the current file and is
-.I edited ,
-if the file does not exist,
-or if the file is actually a teletype,
-.I /dev/tty,
-.I /dev/null.
-Otherwise, you must give the variant form \fBw!\fR to force the write.
-.FE
-If the file does not exist it is created.
-The current file name is changed only if there is no current file
-name; the current line is never changed.
-.IP
-If an error occurs while writing the current and
-.I edited
-file, the editor
-considers that there has been ``No write since last change''
-even if the buffer had not previously been modified.
-.LC
-( 1 , $ ) \fBwrite>>\fR \fIfile\fR abbr: \fBw>>\fR
-.ZP
-Writes the buffer contents at the end of
-an existing file.
-.IP
-.LC
-\fBw!\fR \fIname\fR
-.ZP
-Overrides the checking of the normal \fIwrite\fR command,
-and will write to any file which the system permits.
-.LC
-( 1 , $ ) \fBw\fR \fB!\fR\fIcommand\fR
-.ZP
-Writes the specified lines into
-.I command.
-Note the difference between \fBw!\fR which overrides checks and
-\fBw\ \ !\fR which writes to a command.
-.LC
-\fBwq\fR \fIname\fR
-.ZP
-Like a \fIwrite\fR and then a \fIquit\fR command.
-.LC
-\fBwq!\fR \fIname\fR
-.ZP
-The variant overrides checking on the sensibility of the
-.I write
-command, as \fBw!\fR does.
-.LC
-\fBxit\fP \fIname\fR
-.ZP
-If any changes have been made and not written, writes the buffer out.
-Then, in any case, quits.
-.LC
-( \fB.\fR , \fB.\fR )\|\fByank\fR \fIbuffer\fR \fIcount\fR abbr: \fBya\fR
-.ZP
-Places the specified lines in the named
-.I buffer,
-for later retrieval via
-.I put.
-If no buffer name is specified, the lines go to a more volatile place;
-see the \fIput\fR command description.
-.LC
-( \fB.+1\fR ) \fBz\fR \fIcount\fR
-.ZP
-Print the next \fIcount\fR lines, default \fIwindow\fR.
-.LC
-( \fB.\fR ) \fBz\fR \fItype\fR \fIcount\fR
-.ZP
-Prints a window of text with the specified line at the top.
-If \fItype\fR is `\-' the line is placed at the bottom; a `\fB.\fR' causes
-the line to be placed in the center.*
-A count gives the number of lines to be displayed rather than
-double the number specified by the \fIscroll\fR option.
-On a \s-2CRT\s0 the screen is cleared before display begins unless a
-count which is less than the screen size is given.
-The current line is left at the last line printed.
-.FS
-* Forms `z=' and `z\(ua' also exist; `z=' places the current line in the
-center, surrounds it with lines of `\-' characters and leaves the current
-line at this line. The form `z\(ua' prints the window before `z\-'
-would. The characters `+', `\(ua' and `\-' may be repeated for cumulative
-effect.
-On some v2 editors, no
-.I type
-may be given.
-.FE
-.LC
-\fB!\fR \fIcommand\fR\fR
-.ZP
-The remainder of the line after the `!' character is sent to a shell
-to be executed.
-Within the text of
-.I command
-the characters
-`%' and `#' are expanded as in filenames and the character
-`!' is replaced with the text of the previous command.
-Thus, in particular,
-`!!' repeats the last such shell escape.
-If any such expansion is performed, the expanded line will be echoed.
-The current line is unchanged by this command.
-.IP
-If there has been ``[No\ write]'' of the buffer contents since the last
-change to the editing buffer, then a diagnostic will be printed
-before the command is executed as a warning.
-A single `!' is printed when the command completes.
-.LC
-( \fIaddr\fR , \fIaddr\fR ) \fB!\fR \fIcommand\fR\fR
-.ZP
-Takes the specified address range and supplies it as
-standard input to
-.I command;
-the resulting output then replaces the input lines.
-.LC
-( $ ) \fB=\fR
-.ZP
-Prints the line number of the
-addressed line.
-The current line is unchanged.
-.KS
-.LC
-( \fB.\fR , \fB.\fR ) \fB>\fR \fIcount\fR \fIflags\fR
-.br
-( \fB.\fR , \fB.\fR ) \fB<\fR \fIcount\fR \fIflags\fR
-.IP
-Perform intelligent shifting on the specified lines;
-\fB<\fR shifts left and \fB>\fR shift right.
-The quantity of shift is determined by the
-.I shiftwidth
-option and the repetition of the specification character.
-Only white space (blanks and tabs) is shifted;
-no non-white characters are discarded in a left-shift.
-The current line becomes the last line which changed due to the
-shifting.
-.KE
-.LC
-\fB^D\fR
-.ZP
-An end-of-file from a terminal input scrolls through the file.
-The
-.I scroll
-option specifies the size of the scroll, normally a half screen of text.
-.LC
-( \fB.\fR+1 , \fB.\fR+1 )
-.br
-( \fB.\fR+1 , \fB.\fR+1 ) |
-.ZP
-An address alone causes the addressed lines to be printed.
-A blank line prints the next line in the file.
-.LC
-( \fB.\fR , \fB.\fR ) \fB&\fR \fIoptions\fR \fIcount\fR \fIflags\fR
-.ZP
-Repeats the previous
-.I substitute
-command.
-.LC
-( \fB.\fR , \fB.\fR ) \fB\s+2~\s0\fR \fIoptions\fR \fIcount\fR \fIflags\fR
-.ZP
-Replaces the previous regular expression with the previous
-replacement pattern from a substitution.
-.NH 1
-Regular expressions and substitute replacement patterns
-.NH 2
-Regular expressions
-.PP
-A regular expression specifies a set of strings of characters.
-A member of this set of strings is said to be
-.I matched
-by the regular expression.
-.I Ex
-remembers two previous regular expressions:
-the previous regular expression used in a
-.I substitute
-command
-and the previous regular expression used elsewhere
-(referred to as the previous \fIscanning\fR regular expression.)
-The previous regular expression
-can always be referred to by a null \fIre\fR, e.g. `//' or `??'.
-.NH 2
-Magic and nomagic
-.PP
-The regular expressions allowed by
-.I ex
-are constructed in one of two ways depending on the setting of
-the
-.I magic
-option.
-The
-.I ex
-and
-.I vi
-default setting of
-.I magic
-gives quick access to a powerful set of regular expression
-metacharacters.
-The disadvantage of
-.I magic
-is that the user must remember that these metacharacters are
-.I magic
-and precede them with the character `\e'
-to use them as ``ordinary'' characters.
-With
-.I nomagic,
-the default for
-.I edit,
-regular expressions are much simpler,
-there being only two metacharacters.
-The power of the other metacharacters is still available by preceding
-the (now) ordinary character with a `\e'.
-Note that `\e' is thus always a metacharacter.
-.PP
-The remainder of the discussion of regular expressions assumes
-that
-that the setting of this option is
-.I magic.\(dg
-.FS
-\(dg To discern what is true with
-.I nomagic
-it suffices to remember that the only
-special characters in this case will be `\(ua' at the beginning
-of a regular expression,
-`$' at the end of a regular expression,
-and `\e'.
-With
-.I nomagic
-the characters `\s+2~\s0' and `&' also lose their special meanings
-related to the replacement pattern of a substitute.
-.FE
-.NH 2
-Basic regular expression summary
-.PP
-The following basic constructs are used to construct
-.I magic
-mode regular expressions.
-.IP \fIchar\fR 15
-An ordinary character matches itself.
-The characters `\(ua' at the beginning of a line,
-`$' at the end of line,
-`*' as any character other than the first,
-`.', `\e', `[', and `\s+2~\s0' are not ordinary characters and
-must be escaped (preceded) by `\e' to be treated as such.
-.IP \fB\(ua\fR
-At the beginning of a pattern
-forces the match to succeed only at the beginning of a line.
-.IP \fB$\fR
-At the end of a regular expression forces the match to
-succeed only at the end of the line.
-.IP \&\fB.\fR
-Matches any single character except
-the new-line character.
-.IP \fB\e<\fR
-Forces the match
-to occur only at the beginning of a ``variable'' or ``word'';
-that is, either at the beginning of a line, or just before
-a letter, digit, or underline and after a character not one of
-these.
-.IP \fB\e>\fR
-Similar to `\e<', but matching the end of a ``variable''
-or ``word'', i.e. either the end of the line or before character
-which is neither a letter, nor a digit, nor the underline character.
-.IP \fB[\fIstring\fR]\fR
-Matches any (single) character in the class defined by
-.I string.
-Most characters in
-.I string
-define themselves.
-A pair of characters separated by `\-' in
-.I string
-defines the set of characters collating between the specified lower and upper
-bounds, thus `[a\-z]' as a regular expression matches
-any (single) lower-case letter.
-If the first character of
-.I string
-is an `\(ua' then the construct
-matches those characters which it otherwise would not;
-thus `[\(uaa\-z]' matches anything but a lower-case letter (and of course a
-newline).
-To place any of the characters
-`\(ua', `[', or `\-' in
-.I string
-you must escape them with a preceding `\e'.
-.NH 2
-Combining regular expression primitives
-.PP
-The concatenation of two regular expressions matches the leftmost and
-then longest string
-which can be divided with the first piece matching the first regular
-expression and the second piece matching the second.
-Any of the (single character matching) regular expressions mentioned
-above may be followed by the character `*' to form a regular expression
-which matches any number of adjacent occurrences (including 0) of characters
-matched by the regular expression it follows.
-.PP
-The character `\s+2~\s0' may be used in a regular expression,
-and matches the text which defined the replacement part
-of the last
-.I substitute
-command.
-A regular expression may be enclosed between the sequences
-`\e(' and `\e)' with side effects in the
-.I substitute
-replacement patterns.
-.NH 2
-Substitute replacement patterns
-.PP
-The basic metacharacters for the replacement pattern are
-`&' and `~'; these are
-given as `\e&' and `\e~' when
-.I nomagic
-is set.
-Each instance of `&' is replaced by the characters
-which the regular expression matched.
-The metacharacter `~' stands, in the replacement pattern,
-for the defining text of the previous replacement pattern.
-.PP
-Other metasequences possible in the replacement pattern
-are always introduced by the escaping character `\e'.
-The sequence `\e\fIn\fR' is replaced by the text matched
-by the \fIn\fR-th regular subexpression enclosed between
-`\e(' and `\e)'.\(dg
-.FS
-\(dg When nested, parenthesized subexpressions are present,
-\fIn\fR is determined by counting occurrences of `\e(' starting from the left.
-.FE
-The sequences `\eu' and `\el' cause the immediately following character in
-the replacement to be converted to upper- or lower-case respectively
-if this character is a letter.
-The sequences `\eU' and `\eL' turn such conversion on, either until
-`\eE' or `\ee' is encountered, or until the end of the replacement pattern.
-.de LC
-.br
-.sp .1i
-.ne 4
-.LP
-.ta 3i
-..
-.NH 1
-Option descriptions
-.PP
-.LC
-\fBautoindent\fR, \fBai\fR default: noai
-.ZP
-Can be used to ease the preparation of structured program text.
-At the beginning of each
-.I append ,
-.I change
-or
-.I insert
-command
-or when a new line is
-.I opened
-or created by an
-.I append ,
-.I change ,
-.I insert ,
-or
-.I substitute
-operation within
-.I open
-or
-.I visual
-mode,
-.I ex
-looks at the line being appended after,
-the first line changed
-or the line inserted before and calculates the amount of white space
-at the start of the line.
-It then aligns the cursor at the level of indentation so determined.
-.IP
-If the user then types lines of text in,
-they will continue to be justified at the displayed indenting level.
-If more white space is typed at the beginning of a line,
-the following line will start aligned with the first non-white character
-of the previous line.
-To back the cursor up to the preceding tab stop one can hit
-\fB^D\fR.
-The tab stops going backwards are defined at multiples of the
-.I shiftwidth
-option.
-You
-.I cannot
-backspace over the indent,
-except by sending an end-of-file with a \fB^D\fR.
-.IP
-Specially processed in this mode is a line with no characters added
-to it, which turns into a completely blank line (the white
-space provided for the
-.I autoindent
-is discarded.)
-Also specially processed in this mode are lines beginning with
-an `\(ua' and immediately followed by a \fB^D\fR.
-This causes the input to be repositioned at the beginning of the line,
-but retaining the previous indent for the next line.
-Similarly, a `0' followed by a \fB^D\fR
-repositions at the beginning but without
-retaining the previous indent.
-.IP
-.I Autoindent
-doesn't happen in
-.I global
-commands or when the input is not a terminal.
-.LC
-\fBautoprint\fR, \fBap\fR default: ap
-.ZP
-Causes the current line to be printed after each
-.I delete ,
-.I copy ,
-.I join ,
-.I move ,
-.I substitute ,
-.I t ,
-.I undo
-or
-shift command.
-This has the same effect as supplying a trailing `p'
-to each such command.
-.I Autoprint
-is suppressed in globals,
-and only applies to the last of many commands on a line.
-.LC
-\fBautowrite\fR, \fBaw\fR default: noaw
-.ZP
-Causes the contents of the buffer to be written to the current file
-if you have modified it and give a
-.I next,
-.I rewind,
-.I stop,
-.I tag,
-or
-.I !
-command, or a \fB^\(ua\fR (switch files) or \fB^]\fR (tag goto) command
-in
-.I visual.
-Note, that the
-.I edit
-and
-.I ex
-commands do
-.B not
-autowrite.
-In each case, there is an equivalent way of switching when autowrite
-is set to avoid the
-.I autowrite
-(\fIedit\fR
-for
-.I next ,
-.I rewind!
-for .I rewind ,
-.I stop!
-for
-.I stop ,
-.I tag!
-for
-.I tag ,
-.I shell
-for
-.I ! ,
-and
-\fB:e\ #\fR and a \fB:ta!\fR command from within
-.I visual).
-.LC
-\fBbeautify\fR, \fBbf\fR default: nobeautify
-.ZP
-Causes all control characters except tab, newline and form-feed
-to be discarded from the input.
-A complaint is registered the first time a
-backspace character is discarded.
-.I Beautify
-does not apply to command input.
-.LC
-\fBdirectory\fR, \fBdir\fR default: dir=/tmp
-.ZP
-Specifies the directory in which
-.I ex
-places its buffer file.
-If this directory in not
-writable, then the editor will exit abruptly when it fails to be
-able to create its buffer there.
-.LC
-\fBedcompatible\fR default: noedcompatible
-.ZP
-Causes the presence of absence of
-.B g
-and
-.B c
-suffixes on substitute commands to be remembered, and to be toggled
-by repeating the suffices. The suffix
-.B r
-makes the substitution be as in the
-.I ~
-command, instead of like
-.I &.
-.LC
-\fBerrorbells\fR, \fBeb\fR default: noeb
-.ZP
-Error messages are preceded by a bell.*
-.FS
-* Bell ringing in
-.I open
-and
-.I visual
-on errors is not suppressed by setting
-.I noeb.
-.FE
-If possible the editor always places the error message in a standout mode of the
-terminal (such as inverse video) instead of ringing the bell.
-.LC
-\fBhardtabs\fR, \fBht\fR default: ht=8
-.ZP
-Gives the boundaries on which terminal hardware tabs are set (or
-on which the system expands tabs).
-.LC
-\fBignorecase\fR, \fBic\fR default: noic
-.ZP
-All upper case characters in the text are mapped to lower case in regular
-expression matching.
-In addition, all upper case characters in regular expressions are mapped
-to lower case except in character class specifications.
-.LC
-\fBlisp\fR default: nolisp
-.ZP
-\fIAutoindent\fR indents appropriately for
-.I lisp
-code, and the \fB( ) { } [[\fR and \fB]]\fR commands in
-.I open
-and
-.I visual
-are modified to have meaning for \fIlisp\fR.
-.LC
-\fBlist\fR default: nolist
-.ZP
-All printed lines will be displayed (more) unambiguously,
-showing tabs and end-of-lines as in the
-.I list
-command.
-.LC
-\fBmagic\fR default: magic for \fIex\fR and \fIvi\fR\(dg
-.FS
-\(dg \fINomagic\fR for \fIedit\fR.
-.FE
-.ZP
-If
-.I nomagic
-is set, the number of regular expression metacharacters is greatly reduced,
-with only `\(ua' and `$' having special effects.
-In addition the metacharacters
-`~'
-and
-`&'
-of the replacement pattern are treated as normal characters.
-All the normal metacharacters may be made
-.I magic
-when
-.I nomagic
-is set by preceding them with a `\e'.
-.LC
-\fBmesg\fR default: mesg
-.ZP
-Causes write permission to be turned off to the terminal
-while you are in visual mode, if
-.I nomesg
-is set.
-.LC
-\fBmodeline\fR default: nomodeline
-.ZP
-If
-.I modeline
-is set, then the first 5 lines and the last five lines of the file
-will be checked for ex command lines and the comands issued.
-To be recognized as a command line, the line must have the string
-.B ex:
-or
-.B vi:
-preceeded by a tab or a space. This string may be anywhere in the
-line and anything after the
-.I :
-is interpeted as editor commands. This option defaults to off because
-of unexpected behavior when editting files such as
-.I /etc/passwd.
-.LC
-\fBnumber, nu\fR default: nonumber
-.ZP
-Causes all output lines to be printed with their
-line numbers.
-In addition each input line will be prompted for by supplying the line number
-it will have.
-.LC
-\fBopen\fR default: open
-.ZP
-If \fInoopen\fR, the commands
-.I open
-and
-.I visual
-are not permitted.
-This is set for
-.I edit
-to prevent confusion resulting from accidental entry to
-open or visual mode.
-.LC
-\fBoptimize, opt\fR default: optimize
-.ZP
-Throughput of text is expedited by setting the terminal
-to not do automatic carriage returns
-when printing more than one (logical) line of output,
-greatly speeding output on terminals without addressable
-cursors when text with leading white space is printed.
-.LC
-\fBparagraphs,\ para\fR default: para=IPLPPPQPP\0LIbp
-.ZP
-Specifies the paragraphs for the \fB{\fR and \fB}\fR operations in
-.I open
-and
-.I visual.
-The pairs of characters in the option's value are the names
-of the macros which start paragraphs.
-.LC
-\fBprompt\fR default: prompt
-.ZP
-Command mode input is prompted for with a `:'.
-.LC
-\fBredraw\fR default: noredraw
-.ZP
-The editor simulates (using great amounts of output), an intelligent
-terminal on a dumb terminal (e.g. during insertions in
-.I visual
-the characters to the right of the cursor position are refreshed
-as each input character is typed.)
-Useful only at very high speed.
-.LC
-\fBremap\fP default: remap
-.ZP
-If on, macros are repeatedly tried until they are unchanged.
-For example, if
-.B o
-is mapped to
-.B O ,
-and
-.B O
-is mapped to
-.B I ,
-then if
-.I remap
-is set,
-.B o
-will map to
-.B I ,
-but if
-.I noremap
-is set, it will map to
-.B O .
-.LC
-\fBreport\fR default: report=5\(dg
-.FS
-\(dg 2 for \fIedit\fR.
-.FE
-.ZP
-Specifies a threshold for feedback from commands.
-Any command which modifies more than the specified number of lines
-will provide feedback as to the scope of its changes.
-For commands such as
-.I global ,
-.I open ,
-.I undo ,
-and
-.I visual
-which have potentially more far reaching scope,
-the net change in the number of lines in the buffer is
-presented at the end of the command, subject to this same threshold.
-Thus notification is suppressed during a
-.I global
-command on the individual commands performed.
-.LC
-\fBscroll\fR default: scroll=\(12 window
-.ZP
-Determines the number of logical lines scrolled when an end-of-file
-is received from a terminal input in command mode,
-and the number of lines printed by a command mode
-.I z
-command (double the value of
-.I scroll ).
-.LC
-\fBsections\fR default: sections=SHNHH\0HU
-.ZP
-Specifies the section macros for the \fB[[\fR and \fB]]\fR operations
-in
-.I open
-and
-.I visual.
-The pairs of characters in the options's value are the names
-of the macros which start paragraphs.
-.LC
-\fBshell\fR, \fBsh\fR default: sh=/bin/sh
-.ZP
-Gives the path name of the shell forked for
-the shell escape command `!', and by the
-.I shell
-command.
-The default is taken from SHELL in the environment, if present.
-.LC
-\fBshiftwidth\fR, \fBsw\fR default: sw=8
-.ZP
-Gives the width a software tab stop,
-used in reverse tabbing with \fB^D\fR when using
-.I autoindent
-to append text,
-and by the shift commands.
-.LC
-\fBshowmatch, sm\fR default: nosm
-.ZP
-In
-.I open
-and
-.I visual
-mode, when a \fB)\fR or \fB}\fR is typed, move the cursor to the matching
-\fB(\fR or \fB{\fR for one second if this matching character is on the
-screen. Extremely useful with
-.I lisp.
-.LC
-\fBslowopen, slow\fR terminal dependent
-.ZP
-Affects the display algorithm used in
-.I visual
-mode, holding off display updating during input of new text to improve
-throughput when the terminal in use is both slow and unintelligent.
-See
-.I "An Introduction to Display Editing with Vi"
-for more details.
-.LC
-\fBtabstop,\ ts\fR default: ts=8
-.ZP
-The editor expands tabs in the input file to be on
-.I tabstop
-boundaries for the purposes of display.
-.LC
-\fBtaglength,\ tl\fR default: tl=0
-.ZP
-Tags are not significant beyond this many characters.
-A value of zero (the default) means that all characters are significant.
-.LC
-\fBtags\fR default: tags=tags /usr/lib/tags
-.ZP
-A path of files to be used as tag files for the
-.I tag
-command.
-A requested tag is searched for in the specified files, sequentially.
-By default, files called
-.B tags
-are searched for in the current directory and in /usr/lib
-(a master file for the entire system).
-.LC
-\fBterm\fR from environment TERM
-.ZP
-The terminal type of the output device.
-.LC
-\fBterse\fR default: noterse
-.ZP
-Shorter error diagnostics are produced for the experienced user.
-.LC
-\fBwarn\fR default: warn
-.ZP
-Warn if there has been `[No write since last change]' before a `!'
-command escape.
-.LC
-\fBwindow\fR default: window=speed dependent
-.ZP
-The number of lines in a text window in the
-.I visual
-command.
-The default is 8 at slow speeds (600 baud or less),
-16 at medium speed (1200 baud),
-and the full screen (minus one line) at higher speeds.
-.LC
-\fBw300,\ w1200\, w9600\fR
-.ZP
-These are not true options but set
-.B window
-only if the speed is slow (300), medium (1200), or high (9600),
-respectively.
-They are suitable for an EXINIT
-and make it easy to change the 8/16/full screen rule.
-.LC
-\fBwrapscan\fR, \fBws\fR default: ws
-.ZP
-Searches using the regular expressions in addressing
-will wrap around past the end of the file.
-.LC
-\fBwrapmargin\fR, \fBwm\fR default: wm=0
-.ZP
-Defines a margin for automatic wrapover of text during input in
-.I open
-and
-.I visual
-modes. See
-.I "An Introduction to Text Editing with Vi"
-for details.
-.LC
-\fBwriteany\fR, \fBwa\fR default: nowa
-.IP
-Inhibit the checks normally made before
-.I write
-commands, allowing a write to any file which the system protection
-mechanism will allow.
-.NH 1
-Acknowledgements
-.PP
-Chuck Haley contributed greatly to the early development of
-.I ex.
-Bruce Englar encouraged the redesign which led to
-.I ex
-version 1.
-Bill Joy wrote versions 1 and 2.0 through 2.7,
-and created the framework that users see in the present editor.
-Mark Horton added macros and other features and made the
-editor work on a large number of terminals and Unix systems.
diff --git a/docs/USD.doc/exref/ex.summary b/docs/USD.doc/exref/ex.summary
deleted file mode 100644
index 83084a368ed8..000000000000
--- a/docs/USD.doc/exref/ex.summary
+++ /dev/null
@@ -1,730 +0,0 @@
-.\" 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. 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.
-.\"
-.\" @(#)ex.summary 8.3 (Berkeley) 8/18/96
-.\"
-.ds p \v'-0.2'.\v'+0.2'
-.ds U \s-2UNIX\s+2
-.ds c \v'-0.2':\v'+0.2'
-.nr LL 6.5i
-.lt 6.5i
-.ll 6.5i
-.ds CH
-.ds LF Computing Services, U.C. Berkeley
-.ds RF April 3, 1979
-.de SP
-.sp 1v
-..
-.nr PI 3n
-.nr PD 0
-.ND
-.ps 12
-.ft B
-.ce 1
-Ex/Edit Command Summary (Version 2.0)
-.sp 1
-.ft R
-.nr VS 11
-.nr PS 9
-.2C
-.PP
-.I Ex
-and
-.I edit
-are text editors, used for creating
-and modifying files of text on the \*U
-computer system.
-.I Edit
-is a variant of
-.I ex
-with features designed to
-make it less complicated
-to learn and use.
-In terms of command syntax and effect
-the editors are essentially identical,
-and this command summary applies to both.
-.PP
-The summary is meant as a quick reference
-for users already acquainted
-with
-.I edit
-or \fIex\fP.
-Fuller explanations of the editors are available
-in the documents
-.I
-Edit: A Tutorial
-.R
-(a self-teaching introduction) and the
-.I
-Ex Reference Manual
-.R
-(the comprehensive reference source for
-both \fIedit\fP and \fIex\fP).
-Both of these writeups are available in the
-Computing Services Library.
-.PP
-In the examples included with the
-summary, commands and text entered by
-the user are printed in \fBboldface\fR to
-distinguish them from responses printed
-by the computer.
-.sp 0.45v
-.LP
-.B
-The Editor Buffer
-.PP
-In order to perform its tasks
-the editor sets aside a temporary
-work space,
-called a \fIbuffer\fR,
-separate from the user's permanent
-file.
-Before starting to work on an existing
-file the editor makes a copy of it in the
-buffer, leaving the original untouched.
-All editing changes are made to the
-buffer copy, which must then
-be written back to the permanent
-file in order to update the
-old version.
-The buffer disappears
-at the end of the editing session.
-.sp 0.45v
-.LP
-.B
-Editing: Command and Text Input Modes
-.PP
-.R
-During an editing session there are
-two usual modes of operation:
-\fIcommand\fP mode and \fItext input\fP
-mode.
-(This disregards, for the moment,
-.I open
-and
-.I visual
-modes, discussed below.)
-In command mode, the editor issues a
-colon prompt (:)
-to show that it is ready to
-accept and execute a command.
-In text input mode, on the other hand, there is
-no prompt and the editor merely accepts text to
-be added to the buffer.
-Text input mode is initiated by the commands
-\fIappend\fP, \fIinsert\fP, and \fIchange\fP,
-and is terminated by typing a period as the
-first and only character on a line.
-.sp 0.45v
-.LP
-.B
-Line Numbers and Command Syntax
-.PP
-.R
-The editor keeps track of lines of text
-in the buffer by numbering them consecutively
-starting with 1 and renumbering
-as lines are added or deleted.
-At any given time the editor is positioned
-at one of these lines; this position is
-called the \fIcurrent line\fP.
-Generally, commands that change the
-contents of the buffer print the
-new current line at the end of their
-execution.
-.PP
-Most commands can be preceded by one or two
-line-number addresses which indicate the lines
-to be affected.
-If one number is given the command operates on
-that line only; if two, on an inclusive range
-of lines.
-Commands that can take line-number prefixes also
-assume default prefixes if none are given.
-The default assumed by each command is designed
-to make it convenient to use in many instances
-without any line-number prefix.
-For the most part, a command used without a
-prefix operates on the current line,
-though exceptions to this rule should be noted.
-The \fIprint\fP command
-by itself, for instance, causes
-one line, the current line, to be
-printed at the terminal.
-.PP
-The summary shows the number of line addresses
-that can be
-prefixed to each command as well as
-the defaults assumed if they are omitted.
-For example,
-.I (.,.)
-means that up to 2 line-numbers may be given,
-and that if none is given the
-command operates on the current line.
-(In the address prefix notation, ``.'' stands
-for the current line and ``$'' stands for
-the last line of the buffer.)
-If no such notation appears, no
-line-number prefix may be used.
-.PP
-Some commands take trailing
-information;
-only
-the more important instances of this
-are mentioned in the summary.
-.sp 0.25v
-.LP
-.B
-Open and Visual Modes
-.PP
-.R
-Besides command and text input modes,
-.I ex
-and
-.I edit
-provide on some CRT terminals other modes of editing,
-.I open
-and
-.I visual .
-In these modes the cursor can
-be moved to individual words
-or characters in a line.
-The commands then given are very different
-from the standard editor commands; most do not appear on the screen when
-typed.
-.I
-An Introduction to Display Editing with Vi
-.R
-provides a full discussion.
-.sp 0.25v
-.LP
-.B
-Special Characters
-.PP
-.R
-.fi
-Some characters take on special meanings
-when used in context searches
-and in patterns given to the \fIsubstitute\fP command.
-For \fIedit\fR, these are ``^'' and ``$'',
-meaning the beginning and end of a line,
-respectively.
-.I Ex
-has the following additional special characters:
-.B
-.ce 1
-\&. & * [ ] ~
-.R
-To use one of the special characters as its
-simple graphic representation
-rather than with its special meaning,
-precede it by a backslash (\\).
-The backslash always has a special meaning.
-.1C
-.TS
-cp10 cp10 cp10 cp10
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-Name Abbr Description Examples
-.sp 1.75
-(.)\fBappend a T{
-Begins text input mode,
-adding lines to the buffer after
-the line specified. Appending continues
-until ``.'' is typed alone at the
-beginning of a new line, followed by
-a carriage return. \fI0a\fR places
-lines at the beginning of the buffer.
-T} T{
-.nf
-\fR:\fBa
-Three lines of text
-are added to the buffer
-after the current line.
-\*p
-.R
-\*c
-.fi
-T}
-.SP
-\fR(.,.)\fBchange c T{
-Deletes indicated line(s) and
-initiates text input mode to
-replace them with new text which follows.
-New text is terminated the same way
-as with \fIappend\fR.
-T} T{
-.nf
-:\fB5,6c
-Lines 5 and 6 are
-deleted and replaced by
-these three lines.
-\*p
-.R
-\*c
-.fi
-T}
-.SP
-\fR(.,.)\fBcopy \fIaddr co T{
-Places a copy of the specified lines
-after the line indicated by \fIaddr\fR.
-The example places a copy of lines 8 through
-12, inclusive, after line 25.
-T} T{
-.nf
-\fR:\fB8,12co 25
-\fRLast line copied is printed
-\fR\*c
-.fi
-T}
-.SP
-\fR(.,.)\fBdelete d T{
-Removes lines from the buffer
-and prints the current line after the deletion.
-T} T{
-.nf
-\fR:\fB13,15d
-\fRNew current line is printed
-\*c
-.fi
-T}
-.TE
-.sp 0.5v
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-T{
-\fBedit \fIfile\fP
-.br
-\fBedit! \fIfile\fP
-T} T{
-e
-.br
-e!
-T} T{
-.fi
-\fRClears the editor buffer and then
-copies into it the named \fIfile\fR,
-which becomes the current file.
-This is a way of shifting to a different
-file
-without leaving the editor.
-The editor issues a warning
-message if this command is used before
-saving changes
-made to the file already in the buffer;
-using the form \fBe!\fR overrides this protective mechanism.
-T} T{
-.nf
-\fR:\fBe ch10\fR
-No write since last change
-:\fBe! ch10\fR
-"ch10" 3 lines, 62 characters
-\*c
-.fi
-T}
-.SP
-\fBfile \fIname\fR f T{
-\fRIf followed by a \fIname\fR, renames
-the current file to \fIname\fR.
-If used without \fIname\fR, prints
-the name of the current file.
-T} T{
-.nf
-\fR:\fBf ch9
-\fR"ch9" [Modified] 3 lines ...
-:\fBf
-\fR"ch9" [Modified] 3 lines ...
-\*c
-.fi
-T}
-.SP
-(1,$)\fBglobal g \fBglobal/\fIpattern\fB/\fIcommands T{
-.nf
-:\fBg/nonsense/d
-\fR\*c
-.fi
-T}
-\fR(1,$)\fBglobal! g!\fR or \fBv T{
-Searches the entire buffer (unless a smaller
-range is specified by line-number prefixes) and
-executes \fIcommands\fR on every line with
-an expression matching \fIpattern\fR.
-The second form, abbreviated
-either \fBg!\fR or \fBv\fR,
-executes \fIcommands\fR on lines that \fIdo
-not\fR contain the expression \fIpattern\fR.
-T} \^
-.SP
-\fR(.)\fBinsert i T{
-Inserts new lines of text immediately before the specified line.
-Differs from
-.I append
-only in that text is placed before, rather than after, the indicated line.
-In other words, \fB1i\fR has the same effect as \fB0a\fR.
-T} T{
-.nf
-:\fB1i
-These lines of text will
-be added prior to line 1.
-\&.
-\fR:
-.fi
-T}
-.SP
-\fR(.,.+1)\fBjoin j T{
-Join lines together, adjusting white space (spaces
-and tabs) as necessary.
-T} T{
-.nf
-:\fB2,5j\fR
-Resulting line is printed
-:
-.fi
-T}
-.TE
-.bp
-.TS
-cp10 cp10 cp10 cp10
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-Name Abbr Description Examples
-.sp 1.75
-\fR(.,.)\fBlist l T{
-\fRPrints lines in a more
-unambiguous way than the \fIprint\fR
-command does. The end of a line,
-for example, is marked with a ``$'',
-and tabs printed as ``^I''.
-T} T{
-.nf
-:\fB9l
-\fRThis is line 9$
-\*c
-.fi
-T}
-.TE
-.sp 0.5v
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-\fR(.,.)\fBmove \fIaddr\fB m T{
-\fRMoves the specified lines
-to a position after the line
-indicated by \fIaddr\fR.
-T} T{
-.nf
-\fR:\fB12,15m 25\fR
-New current line is printed
-\*c
-.fi
-T}
-.SP
-\fR(.,.)\fBnumber nu T{
-Prints each line preceded
-by its buffer line number.
-T} T{
-.nf
-\fR:\fBnu
-\0\0\fR10\0 This is line 10
-\*c
-.fi
-T}
-.SP
-\fR(.)\fBopen o T{
-Too involved to discuss here,
-but if you enter open mode
-accidentally, press
-the \s-2ESC\s0 key followed by
-\fBq\fR to
-get back into normal editor
-command mode.
-\fIEdit\fP is designed to
-prevent accidental use of
-the open command.
-T}
-.SP
-\fBpreserve pre T{
-Saves a copy of the current buffer contents as though the system had
-just crashed. This is for use in an emergency when a
-.I write
-command has failed and you don't know how else to save your work.\(dg
-T} T{
-.nf
-:\fBpreserve\fR
-File preserved.
-:
-.fi
-T}
-.SP
-\fR(.,.)\fBprint p Prints the text of line(s). T{
-.nf
-:\fB+2,+3p\fR
-The second and third lines
-after the current line
-:
-.fi
-T}
-.TE
-.FS
-.ll 6.5i
-\(dg You should seek assistance from a system administrator as soon as
-possible after saving a file with the
-.I preserve
-command, because the preserved copy of the file is saved in a
-directory used to store temporary files, and thus, the preserved
-copy may only be available for a short period of time.
-.FE
-.SP
-.nf
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-T{
-.nf
-\fBquit
-quit!
-.fi
-T} T{
-.nf
-q
-q!
-T} T{
-.fi
-\fREnds the editing session.
-You will receive a
-warning if you have changed the buffer
-since last writing its contents
-to the file. In this event you
-must either type \fBw\fR to write,
-or type \fBq!\fR to exit from
-the editor without saving your changes.
-T} T{
-.nf
-\fR:\fBq
-\fRNo write since last change
-:\fBq!
-\fR%
-.fi
-T}
-.SP
-\fR(.)\fBread \fIfile\fP r T{
-.fi
-\fRPlaces a copy of \fIfile\fR in the
-buffer after the specified line.
-Address 0 is permissible and causes
-the copy of \fIfile\fR to be placed
-at the beginning of the buffer.
-The \fIread\fP command does not
-erase any text already in the buffer.
-If no line number is specified,
-\fIfile\fR is placed after the
-current line.
-T} T{
-.nf
-\fR:\fB0r newfile
-\fR"newfile" 5 lines, 86 characters
-\*c
-.fi
-T}
-.SP
-\fBrecover \fIfile\fP rec T{
-.fi
-Retrieves a copy of the editor buffer
-after a system crash, editor crash,
-phone line disconnection, or
-\fIpreserve\fR command.
-T}
-.SP
-\fR(.,.)\fBsubstitute s T{
-.nf
-\fBsubstitute/\fIpattern\fB/\fIreplacement\fB/
-substitute/\fIpattern\fB/\fIreplacement\fB/gc
-.fi
-\fRReplaces the first occurrence of \fIpattern\fR
-on a line
-with \fIreplacement\fP.
-Including a \fBg\fR after the command
-changes all occurrences of \fIpattern\fP
-on the line.
-The \fBc\fR option allows the user to
-confirm each substitution before it is
-made; see the manual for details.
-T} T{
-.nf
-:\fB3p
-\fRLine 3 contains a misstake
-:\fBs/misstake/mistake/
-\fRLine 3 contains a mistake
-\*c
-.fi
-T}
-.TE
-.bp
-.TS
-cp10 cp10 cp10 cp10
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-Name Abbr Description Examples
-.sp 1.75
-\fBundo u T{
-.fi
-\fRReverses the changes made in
-the buffer by the last buffer-editing
-command.
-Note that this example contains
-a notification about the number of
-lines affected.
-T} T{
-.nf
-\fR:\fB1,15d
-\fR15 lines deleted
-new line number 1 is printed
-:\fBu
-\fR15 more lines in file ...
-old line number 1 is printed
-\*c
-.fi
-T}
-.SP
-\fR(1,$)\fBwrite \fIfile\fR w T{
-.fi
-\fRCopies data from the buffer onto
-a permanent file. If no \fIfile\fR
-is named, the current filename
-is used.
-The file is automatically created
-if it does not yet exist.
-A response containing the number of
-lines and characters in the file
-indicates that the write
-has been completed successfully.
-The editor's built-in protections
-against overwriting existing files
-will in some circumstances
-inhibit a write.
-The form \fBw!\fR forces the
-write, confirming that
-an existing file is to be overwritten.
-T} T{
-.nf
-\fR:\fBw
-\fR"file7" 64 lines, 1122 characters
-:\fBw file8
-\fR"file8" File exists ...
-:\fBw! file8
-\fR"file8" 64 lines, 1122 characters
-\*c
-.fi
-T}
-\fR(1,$)\fBwrite! \fIfile\fP w! \^ \^
-.TE
-.sp 0.5v
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-\fR(.)\fBz \fIcount\fP z T{
-.fi
-\fRPrints a screen full of text starting
-with the line indicated;
-or, if \fIcount\fR is specified,
-prints that number of lines.
-Variants of the \fIz\fR command
-are described in the manual.
-T}
-.SP
-\fB!\fIcommand T{
-.fi
-Executes the remainder of the line
-after \fB!\fR as a \*U command.
-The buffer is unchanged by this, and
-control is returned to the editor when
-the execution of \fIcommand\fR is complete.
-T} T{
-.nf
-\fR:\fB!date
-\fRFri Jun 9 12:15:11 PDT 1978
-!
-\*c
-.fi
-T}
-.SP
-\fRcontrol-d T{
-.fi
-Prints the next \fIscroll\fR of text,
-normally half of a screen. See the
-manual for details of the \fIscroll\fR
-option.
-T}
-.SP
-\fR(.+1)<cr> T{
-.fi
-An address alone followed by a carriage
-return causes the line to be printed.
-A carriage return by itself prints the
-line following the current line.
-T} T{
-.nf
-:\fR<cr>
-the line after the current line
-\*c
-.fi
-T}
-.TE
-.sp 0.5v
-.TS
-ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
-\fB/\fIpattern\fB/ T{
-.fi
-\fRSearches for the next line in which
-\fIpattern\fR occurs and prints it.
-T} T{
-.nf
-\fR:\fB/This pattern/
-\fRThis pattern next occurs here.
-\*c
-.fi
-T}
-.SP
-\fB// T{
-Repeats the most recent search.
-T} T{
-.nf
-\fR:\fB//
-\fRThis pattern also occurs here.
-\*c
-.fi
-T}
-.SP
-\fB?\fIpattern\fB? T{
-Searches in the reverse direction
-for \fIpattern\fP.
-T}
-.SP
-\fB?? T{
-Repeats the most recent search,
-moving in the reverse direction
-through the buffer.
-T}
-.TE
diff --git a/docs/USD.doc/vi.man/spell.ok b/docs/USD.doc/vi.man/spell.ok
deleted file mode 100644
index 80ebcaba829d..000000000000
--- a/docs/USD.doc/vi.man/spell.ok
+++ /dev/null
@@ -1,179 +0,0 @@
-Ar
-Bostic
-CDPATH
-COLUMNSXX
-Cscope
-Ds
-EXINIT
-Ee
-Ev
-Fa
-Ff
-Fl
-HUnhsh
-IPLPPPQPP
-LIpplpipbp
-Li
-Lite
-NEXINIT
-NHSHH
-Nex
-Nn
-POSIX
-Pp
-QQ
-SIGWINCHXX
-Std
-Sy
-TMPDIR
-Tt
-USD
-Unmap
-VI
-Vi
-XXXX
-ZZ
-ags
-ai
-altwerase
-ap
-autoindent
-autoprint
-autowrite
-aw
-bf
-bigwords
-cd
-cdpath
-cedit
-cmd
-co
-creens
-cs
-ctags
-db
-dbopen
-dd
-di
-dir
-dit
-doc
-docs
-eFRrsv
-eFRrv
-eFlRrv
-ead
-eb
-edcompatible
-egrep
-elete
-errorbells
-esc
-exrc
-exu
-fg
-filec
-hange
-hardtabs
-ht
-ic
-iclower
-ignorecase
-ile
-ind
-ious
-ist
-ize
-keytime
-leftright
-lhs
-li
-libc
-lobal
-lp
-matchtime
-mber
-mesg
-mk
-modeful
-modeline
-modelines
-nex
-nexrc
-nk
-nonblank
-nooption
-noprint
-nsert
-nul
-nvi
-oin
-onnections
-ove
-ppend
-prev
-pu
-readonly
-rec
-recdir
-redist
-rhs
-rint
-rk
-ro
-rsion
-sccs
-scr
-se
-searchincr
-sh
-shareware
-shellmeta
-shiftwidth
-showmatch
-showmode
-sidescroll
-slowopen
-sm
-smd
-sourceany
-su
-sual
-sw
-ta
-tabstop
-taglength
-tagn
-tagp
-tagstring
-th's
-tildeop
-tl
-tmp
-tr
-ts
-ttytype
-ttywerase
-ubstitute
-uffers
-uit
-unm
-urce
-var
-ve
-vi
-viu
-wa
-wi
-windowname
-wl
-wm
-wn
-wq
-wraplen
-wrapmargin
-wrapscan
-writeany
-ws
-ya
-yy
diff --git a/docs/USD.doc/vi.ref/Makefile b/docs/USD.doc/vi.ref/Makefile
deleted file mode 100644
index 0e1b6343350d..000000000000
--- a/docs/USD.doc/vi.ref/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# @(#)Makefile 8.20 (Berkeley) 8/18/96
-
-MACROS= -me
-ROFF= groff
-TBL= tbl
-
-all: vi.ref.txt vi.ref.ps
-
-vi.ref.txt: vi.ref index.so
- soelim vi.ref | ${TBL} | groff ${MACROS} -Tascii > $@
- rm -f index
- chmod 444 $@
-
-vi.ref.ps: vi.ref index.so
- soelim vi.ref | ${TBL} | ${ROFF} ${MACROS} > $@
- rm -f index
- chmod 444 $@
-
-index.so: vi.ref
- # Build index.so, side-effect of building the paper.
- soelim vi.ref | ${TBL} | ${ROFF} ${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 $@
-
-clean:
- rm -f vi.ref.ps vi.ref.txt index index.so
diff --git a/docs/USD.doc/vi.ref/ex.cmd.roff b/docs/USD.doc/vi.ref/ex.cmd.roff
deleted file mode 100644
index 382e635a6fdd..000000000000
--- a/docs/USD.doc/vi.ref/ex.cmd.roff
+++ /dev/null
@@ -1,1924 +0,0 @@
-.\" 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.
-.\"
-.\" @(#)ex.cmd.roff 8.41 (Berkeley) 8/17/96
-.\"
-.SH 1 "Ex Description"
-.pp
-The following words have special meanings for
-.CO ex
-commands.
-.KY "<end-of-file>"
-.IP "<end-of-file>"
-The end-of-file character is used to scroll the screen in the
-.CO ex
-editor.
-This character is normally
-.LI <control-D> .
-However, whatever character is set for the current terminal is supported
-as well as
-.LI <control-D> .
-.KY "line"
-.IP "line"
-A single-line address, given in any of the forms described in the
-section entitled
-.QB "Ex Addressing" .
-The default for
-.LI line
-is the current line.
-.KY "range"
-.IP "range"
-A line, or a pair of line addresses, separated by a comma or semicolon.
-(See the section entitled
-.QB "Ex Addressing"
-for more information.)
-The default for range is the current line
-.i only ,
-i.e.
-.QT \&.,. .
-A percent sign
-.PQ %
-stands for the range
-.QT 1,$ .
-The starting address must be less than, or equal to, the ending address.
-.KY "count"
-.IP "count"
-A positive integer, specifying the number of lines to be affected by
-the command; the default is 1.
-Generally, a count past the end-of-file may be specified, e.g. the
-command
-.QT "p 3000"
-in a 10 line file is acceptable, and will print from the current line
-through the last line in the file.
-.KY "flags"
-.IP "flags"
-One or more of the characters
-.QQ # ,
-.QQ p ,
-and
-.QQ l .
-When a command that accepts these flags completes, the addressed line(s)
-are written out as if by the corresponding
-.CO # ,
-.CO l
-or
-.CO p
-commands.
-In addition, any number of
-.QT +
-or
-.QT \-
-characters can be specified before, after, or during the flags, in which
-case the line written is not necessarily the one affected by the command,
-but rather the line addressed by the offset address specified.
-The default for
-.LI flags
-is none.
-.KY "file"
-.IP "file"
-A pattern used to derive a pathname; the default is the current file.
-File names are subjected to normal
-.XR sh 1
-word expansions.
-.pp
-Anywhere a file name is specified, it is also possible to use
-the special string
-.QT /tmp .
-This will be replaced with a temporary file name which can be used
-for temporary work, e.g.
-.QT ":e /tmp"
-creates and edits a new file.
-.pp
-If both a count and a range are specified for commands that use either,
-the starting line for the command is the
-.i last
-line addressed by the range, and
-.LI count - 1
-subsequent lines are affected by the command, e.g. the command
-.QT 2,3p4
-prints out lines 3, 4, 5 and 6.
-.pp
-When only a line or range is specified, with no command, the implied
-command is either a
-.CO list ,
-.CO number
-or
-.CO print
-command.
-The command used is the most recent of the three commands to have been
-used (including any use as a flag).
-If none of these commands have been used before, the
-.CO print
-command is the implied command.
-When no range or count is specified and the command line is a blank line,
-the current line is incremented by 1 and then the current line is displayed.
-.pp
-Zero or more whitespace characters may precede or follow the addresses,
-count, flags, or command name.
-Any object following a command name (such as buffer, file, etc.),
-that begins with an alphabetic character,
-should be separated from the command name by at least one whitespace
-character.
-.pp
-Any character, including
-.LI <carriage-return> ,
-.QT %
-and
-.QT #
-retain their literal value when preceded by a backslash.
-.SH 1 "Ex Commands"
-.pp
-The following section describes the commands available in the
-.CO ex
-editor.
-In each entry below, the tag line is a usage synopsis for the command.
-.pp
-Each command can be entered as the abbreviation
-(those characters in the synopsis command word preceding the
-.QQ [
-character),
-the full command (all characters shown for the command word,
-omitting the
-.QQ [
-and
-.QQ ]
-characters),
-or any leading subset of the full command down to the abbreviation.
-For example, the args command (shown as
-.QT ar[gs]
-in the synopsis)
-can be entered as
-.QT ar ,
-.QT arg
-or
-.QT args .
-.pp
-Each
-.CO ex
-command described below notes the new current line after it
-is executed, as well as any options that affect the command.
-.\" I cannot get a double quote to print to save my life. The ONLY way
-.\" I've been able to get this to work is with the .tr command.
-.tr Q"
-.ds ms Q
-.KY DOUBLEQUOTE
-.IP "\*(ms"
-.tr QQ
-A comment.
-Command lines beginning with the double-quote character
-.PQ """"
-are ignored.
-This permits comments in editor scripts and startup files.
-.KY "<control-D>"
-.KY "<end-of-file>"
-.IP "<control-D>"
-.IP "<end-of-file>"
-Scroll the screen.
-Write the next N lines, where N is the value of the
-.OP scroll
-option.
-The command is the end-of-file terminal character, which may be
-different on different terminals.
-Traditionally, it is the
-.LI <control-D>
-key.
-.sp
-Historically, the
-.CO eof
-command ignored any preceding count, and the
-.LI <end-of-file>
-character was ignored unless it was entered as the first character
-of the command.
-This implementation treats it as a command
-.i only
-if entered as the first character of the command line, and otherwise
-treats it as any other character.
-.SS
-.SP Line:
-Set to the last line written.
-.SP Options:
-Affected by the
-.OP scroll
-option.
-.SE
-.KY "!"
-.IP "! argument(s)"
-.Ip "[range]! argument(s)"
-Execute a shell command, or filter lines through a shell command.
-In the first synopsis, the remainder of the line after the
-.QT !
-character is passed to the program named by the
-.OP shell
-option, as a single argument.
-.sp
-Within the rest of the line,
-.QT %
-and
-.QT #
-are expanded into the current and alternate pathnames, respectively.
-The character
-.QT !
-is expanded with the command text of the previous
-.CO !
-command.
-(Therefore, the command
-.CO !!
-repeats the previous
-.CO !
-command.)
-The special meanings of
-.QT % ,
-.QT # ,
-and
-.QT !
-can be overridden by escaping them with a backslash.
-If no
-.CO !
-or
-.CO :!
-command has yet been executed, it is an error to use an unescaped
-.QT !
-character.
-The
-.CO !
-command does
-.i not
-do shell expansion on the strings provided as arguments.
-If any of the above expansions change the command the user entered,
-the command is redisplayed at the bottom of the screen.
-.sp
-.CO Ex
-then executes the program named by the
-.OP shell
-option, with a
-.b \-c
-flag followed by the arguments (which are bundled into a single argument).
-.sp
-The
-.CO !
-command is permitted in an empty file.
-.sp
-If the file has been modified since it was last completely written,
-the
-.Co !
-command will warn you.
-.sp
-A single
-.QT !
-character is displayed when the command completes.
-.sp
-In the second form of the
-.CO !
-command, the remainder of the line after the
-.QT !
-is passed to the program named by the
-.OP shell
-option, as described above.
-The specified lines are passed to the program as standard input,
-and the standard and standard error output of the program replace
-the original lines.
-.SS
-.SP Line:
-Unchanged if no range was specified, otherwise set to the first
-line of the range.
-.SP Options:
-Affected by the
-.OP shell
-and
-.OP warn
-options.
-.SE
-.KY "#"
-.IP "[range] # [count] [flags]"
-.KY "number"
-.Ip "[range] nu[mber] [count] [flags]"
-Display the selected lines, each preceded with its line number.
-.sp
-The line number format is
-.QQ %6d ,
-followed by two spaces.
-.SS
-.SP Line:
-Set to the last line displayed.
-.SP Options:
-Affected by the
-.OP list
-option.
-.SE
-.KY "@"
-.IP "@ buffer"
-.KY "*"
-.Ip "* buffer"
-Execute a buffer.
-Each line in the named buffer is executed as an
-.CO ex
-command.
-If no buffer is specified, or if the specified buffer is
-.QT @
-or
-.QT * ,
-the last buffer executed is used.
-.KY <
-.IP "[range] <[< ...] [count] [flags]"
-Shift lines left or right.
-The specified lines are shifted to the left (for the
-.CO <
-command) or right (for the
-.CO >
-command), by the number of columns specified by the
-.OP shiftwidth
-option.
-Only leading whitespace characters are deleted when shifting left;
-once the first column of the line contains a nonblank character,
-the
-.CO shift
-command will succeed, but the line will not be modified.
-.sp
-If the command character
-.CO <
-or
-.CO >
-is repeated more than once, the command is repeated once for each
-additional command character.
-.SS
-.SP Line:
-If the current line is set to one of the lines that are affected
-by the command, it is unchanged.
-Otherwise, it is set to the first nonblank character of the lowest
-numbered line shifted.
-.SP Options:
-Affected by the
-.OP shiftwidth
-option.
-.SE
-.KY =
-.IP "[line] = [flags]"
-Display the line number of
-.LI line
-(which defaults to the last line in the file).
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY >
-.IP "[range] >[> ...] [count] [flags]"
-Shift right.
-The specified lines are shifted to the right by the number of columns
-specified by the
-.OP shiftwidth
-option, by inserting tab and space characters.
-Empty lines are not changed.
-.sp
-If the command character
-.QT >
-is repeated more than once, the command is repeated once for each
-additional command character.
-.SS
-.SP Line:
-Set to the last line modified by the command.
-.SP Options:
-Affected by the
-.OP shiftwidth
-option.
-.SE
-.KY abbrev
-.IP "ab[brev] lhs rhs"
-Add an abbreviation to the current abbreviation list.
-When inserting text in
-.CO vi ,
-each time a non-word character is entered after a word character,
-a set of characters ending at the word character are checked for
-a match with
-.LI lhs .
-If a match is found, they are replaced with
-.LI rhs .
-The set of characters that are checked for a match are defined as follows,
-for inexplicable historical reasons.
-If only one or two characters were entered before the non-word character
-that triggered the check,
-and after the beginning of the insertion,
-or the beginning of the line or the file,
-or the last
-.LI <blank>
-character that was entered,
-then the one or the both characters are checked for a match.
-Otherwise, the set includes both characters,
-as well as the characters that precede them that are the same word
-class (i.e. word or non-word) as the
-.b second
-to last character entered before the non-word character that triggered
-the check,
-back to the first
-.LI <blank> character,
-the beginning of the insertion,
-or the beginning of the line or the file.
-.sp
-For example, the abbreviations:
-.sp
-.ne 3v
-.ft C
-.TS
-r l l.
-:abbreviate abc ABC
-:abbreviate #i #include
-:abbreviate /*#i /*#include
-.TE
-.ft R
-will all work, while the abbreviations:
-.sp
-.ne 2v
-.ft C
-.TS
-r l l.
-:abbreviate a#i A#include
-:abbreviate /* /********************
-.TE
-.ft R
-will not work, and are not permitted by
-.CO nvi .
-.sp
-To keep the abbreviation expansion from happening,
-the character immediately following the
-.LI lhs
-characters should be quoted with a
-.LI <literal-next>
-character.
-.sp
-The replacement
-.LI rhs
-is itself subject to both further abbreviation expansion and further
-map expansion.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY append
-.IP "[line] a[ppend][!]"
-The input text is appended to the specified line.
-If line 0 is specified, the text is inserted at the beginning of the file.
-Set to the last line input.
-If no lines are input, then set to
-.LI line ,
-or to the first line of the file if a
-.LI line
-of 0 was specified.
-Following the command name with a
-.QT !
-character causes the
-.OP autoindent
-option to be toggled for the duration of the command.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-Affected by the
-.OP autoindent
-and
-.OP number
-options.
-.SE
-.KY args
-.IP "ar[gs]"
-Display the argument list.
-The current argument is displayed inside of
-.QT [
-and
-.QT ]
-characters.
-The argument list is the list of operands specified on startup,
-which can be replaced using the
-.CO next
-command.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY bg
-.IP bg
-.CO Vi
-mode only.
-Background the current screen.
-The screen is unchanged,
-but is no longer accessible and disappears from the display.
-Use the
-.CO fg
-command to bring the screen back to the display foreground.
-.SS
-.SP Line:
-Set to the current line when the screen was last edited.
-.SP Options:
-None.
-.SE
-.KY change
-.IP "[range] c[hange][!] [count]"
-Replace the lines with input text.
-Following the command name with a
-.QT !
-character causes the
-.OP autoindent
-option to be toggled for the duration of the command.
-.SS
-.SP Line:
-Set to the last line input, or, if no lines were input,
-set to the line before the target line, or to the first
-line of the file if there are no lines preceding the target line.
-.SP Options:
-Affected by the
-.OP autoindent
-and
-.OP number
-options.
-.SE
-.KY cd
-.KY chdir
-.IP "chd[ir][!] [directory]"
-.Ip "cd[!] [directory]"
-Change the current working directory.
-The
-.LI directory
-argument is subjected to
-.XR sh 1
-word expansions.
-When invoked with no directory argument and the
-.LI HOME
-environment variable is set, the directory named by the
-.LI HOME
-environment variable becomes the new current directory.
-Otherwise, the new current directory becomes the directory returned
-by the
-.XR getpwent 3
-routine.
-.sp
-The
-.CO chdir
-command will fail if the file has been modified since the last complete
-write of the file.
-You can override this check by appending a
-.QT !
-character to the command.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-Affected by the
-.OP cdpath
-option.
-.SE
-.KY copy
-.KY t
-.IP "[range] co[py] line [flags]"
-.Ip "[range] t line [flags]"
-Copy the specified lines (range) after the destination line.
-Line 0 may be specified to insert the lines at the beginning of
-the file.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY cscope
-.IP "cs[cope] command [args]"
-Execute a
-.CO cscope
-command.
-For more information, see the section of the reference manual entitled
-.QB "Tags, Tag Stacks, and Cscope" .
-.KY delete
-.IP "[range] d[elete] [buffer] [count] [flags]"
-Delete the lines from the file.
-The deleted text is saved in the specified buffer, or, if no buffer
-is specified, in the unnamed buffer.
-If the command name is followed by a letter that could be interpreted
-as either a buffer name or a flag value (because neither a
-.LI count
-or
-.LI flags
-values were given),
-.CO ex
-treats the letter as a
-.LI flags
-value if the letter immediately follows the command name,
-without any whitespace separation.
-If the letter is preceded by whitespace characters,
-it treats it as a buffer name.
-.SS
-.SP Line:
-Set to the line following the deleted lines,
-or to the last line if the deleted lines were at the end.
-.SP Options:
-None.
-.SE
-.KY display
-.IP "di[splay] b[uffers] | c[onnections] | s[creens] | t[ags]"
-Display buffers,
-.CO cscope
-connections, screens or tags.
-The
-.CO display
-command takes one of three additional arguments, which are as follows:
-.SS
-.SP b[uffers]
-Display all buffers (including named, unnamed, and numeric)
-that contain text.
-.SP c[onnections]
-Display the source directories for all attached
-.CO cscope
-databases.
-.SP s[creens]
-Display the file names of all background screens.
-.SP t[ags]
-Display the tags stack.
-.SE
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY edit
-.IP "e[dit][!] [+cmd] [file]"
-.Ip "ex[!] [+cmd] [file]"
-Edit a different file.
-If the current buffer has been modified since the last complete write,
-the command will fail.
-You can override this by appending a
-.QT !
-character to the command name.
-.sp
-If the
-.QT +cmd
-option is specified, that
-.CO ex
-command will be executed in the new file.
-Any
-.CO ex
-command may be used, although the most common use of this feature is
-to specify a line number or search pattern to set the initial location
-in the new file.
-.sp
-Capitalizing the first letter of the command, i.e.
-.CO Edit
-or
-.CO Ex ,
-while in
-.CO vi
-mode, will edit the file in a new screen.
-In this case, any modifications to the current file are ignored.
-.SS
-.SP Line:
-If you have previously edited the file, the current line will be set
-to your last position in the file.
-If that position does not exist, or you have not previously edited the
-file, the current line will be set to the first line of the file if
-you are in
-.CO vi
-mode, and the last line of the file if you are in
-.CO ex .
-.SP Options:
-None.
-.SE
-.KY exusage
-.IP "exu[sage] [command]"
-Display usage for an
-.CO ex
-command.
-If
-.LI command
-is specified, a usage statement for that command is displayed.
-Otherwise, usage statements for all
-.CO ex
-commands are displayed.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY file
-.IP "f[ile] [file]"
-Display and optionally change the file name.
-If a file name is specified, the current pathname is changed to the
-specified name.
-The current pathname, the number of lines, and the current position
-in the file are displayed.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY fg
-.IP "fg [name]"
-.CO Vi
-mode only.
-Foreground the specified screen.
-If the argument name doesn't exactly match the name of a file displayed
-by a background screen,
-it is compared against the last component of each of the file names.
-If no background screen is specified,
-the first background screen is foregrounded.
-.sp
-By default,
-foregrounding causes the current screen to be swapped with the backgrounded
-screen.
-Capitalizing the first letter of the command, i.e.
-.CO Fg ,
-will foreground the backgrounded screen in a new screen instead of
-swapping it with the current screen.
-.SS
-.SP Line:
-Set to the current line when the screen was last edited.
-.SP Options:
-None.
-.SE
-.KY global
-.IP "[range] g[lobal] /pattern/ [commands]"
-.KY v
-.Ip "[range] v /pattern/ [commands]"
-Apply commands to lines matching (or not matching) a pattern.
-The lines within the given range that match
-.PQ g[lobal] ,
-or do not match
-.PQ v
-the given pattern are selected.
-Then, the specified
-.CO ex
-command(s) are executed with the current line
-.PQ \&.
-set to each selected line.
-If no range is specified, the entire file is searched for matching,
-or not matching, lines.
-.sp
-Multiple commands can be specified, one per line, by escaping each
-.LI <newline>
-character with a backslash, or by separating commands with a
-.QT |
-character.
-If no commands are specified, the command defaults to the
-.CO print
-command.
-.sp
-For the
-.CO append ,
-.CO change
-and
-.CO insert
-commands, the input text must be part of the global command line.
-In this case, the terminating period can be omitted if it ends the commands.
-.sp
-The
-.CO visual
-command may also be specified as one of the
-.CO ex
-commands.
-In this mode, input is taken from the terminal.
-Entering a
-.CO Q
-command in
-.CO vi
-mode causes the next line matching the pattern to be selected and
-.CO vi
-to be reentered, until the list is exhausted.
-.sp
-The
-.CO global ,
-.CO v
-and
-.CO undo
-commands cannot be used as part of these commands.
-.sp
-The editor options
-.OP autoindent ,
-.OP autoprint
-and
-.OP report
-are turned off for the duration of the
-.CO global
-and
-.CO v
-commands.
-.SS
-.SP Line:
-The last line modified.
-.SP Options:
-Affected by the
-.OP ignorecase
-and
-.OP magic
-options.
-Turns off the
-.OP autoindent ,
-.OP autoprint
-and
-.OP report
-options.
-.SE
-.KY help
-.IP "he[lp]"
-Display a help message.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY insert
-.IP "[line] i[nsert][!]"
-The input text is inserted before the specified line.
-Following the command name with a
-.QT !
-character causes the
-.OP autoindent
-option setting to be toggled for the duration of this command.
-.SS
-.SP Line:
-Set to the last line input; if no lines were input,
-set to the line before the target line, or to the first line
-of the file if there are no lines preceding the target line.
-Affected by the
-.OP autoindent
-and
-.OP number
-options.
-.SE
-.KY join
-.IP "[range] j[oin][!] [count] [flags]"
-Join lines of text together.
-.sp
-A
-.LI count
-specified to the
-.Sy join
-command specifies that the last line of the
-.LI range
-plus
-.LI count
-subsequent lines will be joined.
-(Note, this differs by one from the general rule where only
-.LI count - 1
-subsequent lines are affected.)
-.sp
-If the current line ends with a whitespace character, all whitespace
-is stripped from the next line.
-Otherwise, if the next line starts with a open parenthesis
-.PQ ( ,
-do nothing.
-Otherwise, if the current line ends with a question mark
-.PQ ? ,
-period
-.PQ \&.
-or exclamation point
-.PQ ! ,
-insert two spaces.
-Otherwise, insert a single space.
-.sp
-Appending a
-.QT !
-character to the command name causes a simpler join with no
-white-space processing.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY list
-.IP "[range] l[ist] [count] [flags]"
-Display the lines unambiguously.
-Tabs are displayed as
-.QT ^I ,
-and the end of the line is marked with a
-.QT $
-character.
-.SS
-.SP Line:
-Set to the last line displayed.
-.SP Options:
-Affected by the
-.OP number
-option.
-.SE
-.KY map
-.IP "map[!] [lhs rhs]"
-Define or display maps (for
-.CO vi
-only).
-.sp
-If
-.QT lhs
-and
-.QT rhs
-are not specified, the current set of command mode maps are displayed.
-If a
-.QT !
-character is appended to to the command,
-the text input mode maps are displayed.
-.sp
-Otherwise, when the
-.QT lhs
-character sequence is entered in
-.CO vi ,
-the action is as if the corresponding
-.QT rhs
-had been entered.
-If a
-.QT !
-character is appended to the command name,
-the mapping is effective during text input mode,
-otherwise, it is effective during command mode.
-This allows
-.QT lhs
-to have two different macro definitions at the same time: one for command
-mode and one for input mode.
-.sp
-Whitespace characters require escaping with a
-.LI <literal-next>
-character to be entered in the
-.LI lhs
-string in visual mode.
-.sp
-Normally, keys in the
-.LI rhs
-string are remapped (see the
-.OP remap
-option),
-and it is possible to create infinite loops.
-However, keys which map to themselves are not further remapped,
-regardless of the setting of the
-.OP remap
-option.
-For example, the command
-.QT ":map n nz."
-maps the
-.QT n
-key to the
-.CO n
-and
-.CO z
-commands.
-.sp
-To exit an infinitely looping map, use the terminal
-.LI <interrupt>
-character.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-Affected by the
-.OP remap
-option.
-.SE
-.KY mark
-.KY k
-.IP "[line] ma[rk] <character>"
-.Ip "[line] k <character>"
-Mark the line with the mark
-.LI <character> .
-The expressions
-.QT '<character>
-and
-.QT `<character>
-can then be used as an address in any command that uses one.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY move
-.IP "[range] m[ove] line"
-Move the specified lines after the target line.
-A target line of 0 places the lines at the beginning of the file.
-.SS
-.SP Line:
-Set to the first of the moved lines.
-.SP Options:
-None.
-.SE
-.KY mkexrc
-.IP "mk[exrc][!] file"
-Write the abbreviations, editor options and maps to the specified
-file.
-Information is written in a form which can later be read back in
-using the
-.CO ex
-.CO source
-command.
-If
-.LI file
-already exists, the
-.CO mkexrc
-command will fail.
-This check can be overridden by appending a
-.QT !
-character to the command.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY next
-.IP "n[ext][!] [file ...]"
-Edit the next file from the argument list.
-The
-.CO next
-command will fail if the file has been modified since the last complete
-write.
-This check can be overridden by appending the
-.QT !
-character to the command name.
-The argument list can optionally be replaced by specifying a new one
-as arguments to this command.
-In this case, editing starts with the first file on the new list.
-.sp
-Capitalizing the first letter of the command, i.e.
-.CO Next ,
-while in
-.CO vi
-mode, will set the argument list and edit the file in a new screen.
-In this case, any modifications to the current file are ignored.
-.SS
-.SP Line:
-Set as described for the
-.CO edit
-command.
-.SP Options:
-Affected by the options
-.OP autowrite
-and
-.OP writeany .
-.SE
-.KY open
-.IP "[line] o[pen] /pattern/ [flags]"
-Enter open mode.
-Open mode is the same as being in
-.CO vi ,
-but with a one-line window.
-All the standard
-.CO vi
-commands are available.
-If a match is found for the optional RE argument,
-the cursor is set to the start of the matching pattern.
-.sp
-.i "This command is not yet implemented."
-.SS
-.SP Line:
-Unchanged, unless the optional RE is specified, in which case it is
-set to the line where the matching pattern is found.
-.SP Options:
-Affected by the
-.OP open
-option.
-.SE
-.KY preserve
-.IP "pre[serve]"
-Save the file in a form that can later be recovered using the
-.CO ex
-.b \-r
-option.
-When the file is preserved, an email message is sent to the user.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY previous
-.IP "prev[ious][!]"
-Edit the previous file from the argument list.
-The
-.CO previous
-command will fail if the file has been modified since the last complete
-write.
-This check can be overridden by appending the
-.QT !
-character to the command name.
-.sp
-Capitalizing the first letter of the command, i.e.
-.CO Previous ,
-while in
-.CO vi
-mode, will edit the file in a new screen.
-In this case, any modifications to the current file are ignored.
-.SS
-.SP Line:
-Set as described for the
-.CO edit
-command.
-.SP Options:
-Affected by the options
-.OP autowrite
-and
-.OP writeany .
-None.
-.SE
-.KY print
-.IP "[range] p[rint] [count] [flags]"
-Display the specified lines.
-.SS
-.SP Line:
-Set to the last line displayed.
-.SP Options:
-Affected by the
-.OP list
-and
-.OP number
-option.
-.SE
-.KY put
-.IP "[line] pu[t] [buffer]"
-Append buffer contents to the current line.
-If a buffer is specified, its contents are appended to the line,
-otherwise, the contents of the unnamed buffer are used.
-.SS
-.SP Line:
-Set to the line after the current line.
-.SP Options:
-None.
-.SE
-.KY quit
-.IP "q[uit][!]"
-End the editing session.
-If the file has been modified since the last complete write, the
-.CO quit
-command will fail.
-This check may be overridden by appending a
-.QT !
-character to the command.
-.sp
-If there are more files to edit, the
-.CO quit
-command will fail.
-Appending a
-.QT !
-character to the command name or entering two
-.CO quit
-commands (i.e.
-.CO wq ,
-.CO quit ,
-.CO xit
-or
-.CO ZZ )
-in a row) will override this check and the editor will exit.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY read
-.IP "[line] r[ead][!] [file]"
-Read a file.
-A copy of the specified file is appended to the line.
-If
-.LI line
-is 0, the copy is inserted at the beginning of the file.
-If no file is specified, the current file is read; if there is no
-current file, then
-.LI file
-becomes the current file.
-If there is no current file and no
-.LI file
-is specified, then the
-.CO read
-command will fail.
-.sp
-If
-.LI file
-is preceded by a
-.QT !
-character,
-.LI file
-is treated as if it were a shell command, and passed to the program
-named by the
-.OP shell
-edit option.
-The standard and standard error outputs of that command are read into
-the file after the specified line.
-The special meaning of the
-.QT !
-character can be overridden by escaping it with a backslash
-.PQ \e
-character.
-.SS
-.SP Line:
-When executed from
-.CO ex ,
-the current line is set to the last line read.
-When executed from
-.CO vi ,
-the current line is set to the first line read.
-.SP Options:
-None.
-.SE
-.KY recover
-.IP "rec[over] file"
-Recover
-.LI file
-if it was previously saved.
-If no saved file by that name exists, the
-.CO recover
-command behaves equivalently to the
-.CO edit
-command.
-.SS
-.SP Line:
-Set as described for the
-.CO edit
-command.
-.SP Options:
-None.
-.SE
-.KY resize
-.IP "res[ize] [+|-]size"
-.CO Vi
-mode only.
-Grow or shrink the current screen.
-If
-.LI size
-is a positive, signed number, the current screen is grown by that many lines.
-If
-.LI size
-is a negative, signed number, the current screen is shrunk by that many lines.
-If
-.LI size
-is not signed, the current screen is set to the specified
-.LI size .
-Applicable only to split screens.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY rewind
-.IP "rew[ind][!]"
-Rewind the argument list.
-If the current file has been modified since the last complete write,
-the
-.CO rewind
-command will fail.
-This check may be overridden by appending the
-.QT !
-character to the command.
-.sp
-Otherwise, the current file is set to the first file in the argument
-list.
-.SS
-.SP Line:
-Set as described for the
-.CO edit
-command.
-.SP Options:
-Affected by the
-.OP autowrite
-and
-.OP writeany
-options.
-.SE
-.KY set
-.IP "se[t] [option[=[value]] ...] [nooption ...] [option? ...] [all]"
-Display or set editor options.
-When no arguments are specified, the editor option
-.OP term ,
-and any editor options whose values have been changed from the
-default settings are displayed.
-If the argument
-.LI all
-is specified, the values of all of editor options are displayed.
-.sp
-Specifying an option name followed by the character
-.QT ?
-causes the current value of that option to be displayed.
-The
-.QT ?
-can be separated from the option name by whitespace characters.
-The
-.QT ?
-is necessary only for Boolean valued options.
-Boolean options can be given values by the form
-.QT "set option"
-to turn them on, or
-.QT "set nooption"
-to turn them off.
-String and numeric options can be assigned by the form
-.QT "set option=value" .
-Any whitespace characters in strings can be included literally by preceding
-each with a backslash.
-More than one option can be set or listed by a single set command,
-by specifying multiple arguments, each separated from the next by
-whitespace characters.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY shell
-.IP "sh[ell]"
-Run the shell program.
-The program named by the
-.OP shell
-option is run with a
-.b \-i
-(for interactive) flag.
-Editing is resumed when that program exits.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-Affected by the
-.OP shell
-option.
-.SE
-.KY source
-.IP "so[urce] file"
-Read and execute
-.CO ex
-commands from a file.
-.CO Source
-commands may be nested.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY substitute
-.IP "[range] s[ubstitute] [/pattern/replace/] [options] [count] [flags]"
-.KY &
-.Ip "[range] & [options] [count] [flags]"
-.KY ~
-.Ip "[range] ~ [options] [count] [flags]"
-Make substitutions.
-Replace the first instance of
-.LI pattern
-with the string
-.LI replace
-on the specified line(s).
-If the
-.QT /pattern/repl/
-argument is not specified, the
-.QT /pattern/repl/
-from the previous
-.CO substitute
-command is used.
-Any character other than an alphabetic, numeric, <blank> or backslash
-character may be used as the delimiter.
-.sp
-If
-.LI options
-includes the letter
-.QT c
-(confirm), you will be prompted for confirmation before each replacement
-is done.
-An affirmative response (in English, a
-.QT y
-character) causes the replacement to be made.
-A quit response (in English, a
-.QT q
-character) causes the
-.CO substitute
-command to be terminated.
-Any other response causes the replacement not to be made, and the
-.CO substitute
-command continues.
-If
-.LI options
-includes the letter
-.QT g
-(global), all nonoverlapping instances of
-.LI pattern
-in the line are replaced.
-.sp
-The
-.CO &
-version of the command is the same as not specifying a pattern
-or replacement string to the
-.CO substitute
-command, and the
-.QT &
-is replaced by the pattern and replacement information from the
-previous substitute command.
-.sp
-The
-.CO ~
-version of the command is the same as
-.CO &
-and
-.CO s ,
-except that the search pattern used is the last RE used in
-.i any
-command, not necessarily the one used in the last
-.CO substitute
-command.
-.sp
-For example, in the sequence
-.ft C
-.(b
-s/red/blue/
-/green
-~
-.)b
-.ft R
-the
-.QT ~
-is equivalent to
-.QT s/green/blue/ .
-.sp
-The
-.CO substitute
-command may be interrupted, using the terminal interrupt character.
-All substitutions completed before the interrupt are retained.
-.SS
-.SP Line:
-Set to the last line upon which a substitution was made.
-.SP Options:
-Affected by the
-.OP ignorecase
-and
-.OP magic
-option.
-.SE
-.KY suspend
-.IP "su[spend][!]"
-.KY stop
-.Ip "st[op][!]"
-.KY <control-Z>
-.Ip <control-Z>
-Suspend the edit session.
-Appending a
-.QT !
-character to these commands turns off the
-.OP autowrite
-option for the command.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-Affected by the
-.OP autowrite
-and
-.OP writeany
-options.
-.SE
-.KY tag
-.IP "ta[g][!] tagstring"
-Edit the file containing the specified tag.
-If the tag is in a different file, then the new file is edited.
-If the current file has been modified since the last complete write,
-the
-.CO tag
-command will fail.
-This check can be overridden by appending the
-.QT !
-character to the command name.
-.sp
-The
-.CO tag
-command searches for
-.LI tagstring
-in the tags file(s) specified by the
-.Op tags
-option.
-(See
-.XR ctags 1
-for more information on tags files.)
-.sp
-Capitalizing the first letter of the command, i.e.
-.CO Tag ,
-while in
-.CO vi
-mode, will edit the file in a new screen.
-In this case, any modifications to the current file are ignored.
-.SS
-.SP Line:
-Set to the line indicated by the tag.
-.SP Options:
-Affected by the
-.OP autowrite ,
-.OP taglength ,
-.OP tags
-and
-.OP writeany
-options.
-.SE
-.KY tagnext
-.IP "tagn[ext][!]"
-Edit the file containing the next context for the current tag.
-If the context is in a different file, then the new file is edited.
-If the current file has been modified since the last complete write,
-the
-.CO tagnext
-command will fail.
-This check can be overridden by appending the
-.QT !
-character to the command name.
-.sp
-Capitalizing the first letter of the command, i.e.
-.CO Tagnext ,
-while in
-.CO vi
-mode, will edit the file in a new screen.
-In this case, any modifications to the current file are ignored.
-.SS
-.SP Line:
-Set to the line indicated by the tag.
-.SP Options:
-Affected by the
-.OP autowrite
-and
-.OP writeany
-options.
-.SE
-.KY tagpop
-.IP "tagp[op][!] [file | number]"
-Pop to the specified tag in the tags stack.
-If neither
-.LI file
-or
-.LI number
-is specified, the
-.CO tagpop
-command pops to the most recent entry on the tags stack.
-If
-.LI file
-or
-.LI number
-is specified, the
-.CO tagpop
-command pops to the most recent entry in the tags stack for that file,
-or numbered entry in the tags stack, respectively.
-(See the
-.CO display
-command for information on displaying the tags stack.)
-.sp
-If the file has been modified since the last complete write, the
-.CO tagpop
-command will fail.
-This check may be overridden by appending a
-.QT !
-character to the command name.
-.SS
-.SP Line:
-Set to the line indicated by the tag.
-.SP Options:
-Affected by the
-.OP autowrite
-and
-.OP writeany
-options.
-.SE
-.KY tagprev
-.IP "tagp[rev][!]"
-Edit the file containing the previous context for the current tag.
-If the context is in a different file, then the new file is edited.
-If the current file has been modified since the last complete write,
-the
-.CO tagprev
-command will fail.
-This check can be overridden by appending the
-.QT !
-character to the command name.
-.sp
-Capitalizing the first letter of the command, i.e.
-.CO Tagprev ,
-while in
-.CO vi
-mode, will edit the file in a new screen.
-In this case, any modifications to the current file are ignored.
-.SS
-.SP Line:
-Set to the line indicated by the tag.
-.SP Options:
-Affected by the
-.OP autowrite
-and
-.OP writeany
-options.
-.SE
-.KY tagtop
-.IP "tagt[op][!]"
-Pop to the least recent tag on the tags stack, clearing the tags stack.
-.sp
-If the file has been modified since the last complete write, the
-.CO tagtop
-command will fail.
-This check may be overridden by appending a
-.QT !
-character to the command name.
-.SS
-.SP Line:
-Set to the line indicated by the tag.
-.SP Options:
-Affected by the
-.OP autowrite
-and
-.OP writeany
-options.
-.SE
-.KY unabbrev
-.IP "una[bbrev] lhs"
-Delete an abbreviation.
-Delete
-.LI lhs
-from the current list of abbreviations.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY undo
-.IP "u[ndo]"
-Undo the last change made to the file.
-Changes made by
-.CO global ,
-.CO v ,
-.CO visual
-and map sequences are considered a single command.
-If repeated, the
-.CO u
-command alternates between these two states, and is its own inverse.
-.SS
-.SP Line:
-Set to the last line modified by the command.
-.SP Options:
-None.
-.SE
-.KY unmap
-.IP "unm[ap][!] lhs"
-Unmap a mapped string.
-Delete the command mode map definition for
-.LI lhs .
-If a
-.QT !
-character is appended to the command name, delete the text input mode
-map definition instead.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY version
-.IP "ve[rsion]"
-Display the version of the
-.CO ex/vi
-editor.
-.KY visual
-.IP "[line] vi[sual] [type] [count] [flags]"
-.CO Ex
-mode only.
-Enter
-.CO vi .
-The
-.LI type
-is optional, and can be
-.QT \- ,
-.QT +
-or
-.QT ^ ,
-as in the
-.CO ex
-.CO z
-command, to specify the position of the specified line in the screen
-window.
-(The default is to place the line at the top of the screen window.)
-A
-.LI count
-specifies the number of lines that will initially be displayed.
-(The default is the value of the
-.OP window
-editor option.)
-.SS
-.SP Line:
-Unchanged unless
-.LI line
-is specified, in which case it is set to that line.
-.SP Options:
-None.
-.SE
-.KY visual
-.IP "vi[sual][!] [+cmd] [file]"
-.CO Vi
-mode only.
-Edit a new file.
-Identical to the
-.QT "edit[!] [+cmd] [file]"
-command.
-.sp
-Capitalizing the first letter of the command, i.e.
-.CO Visual ,
-will edit the file in a new screen.
-In this case, any modifications to the current file are ignored.
-.KY viusage
-.IP "viu[sage] [command]"
-Display usage for a
-.CO vi
-command.
-If
-.LI command
-is specified, a usage statement for that command is displayed.
-Otherwise, usage statements for all
-.CO vi
-commands are displayed.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY write
-.IP "[range] w[rite][!] [>>] [file]"
-.Ip "[range] w[rite] [!] [file]"
-.KY wn
-.Ip "[range] wn[!] [>>] [file]"
-.KY wq
-.Ip "[range] wq[!] [>>] [file]"
-Write the file.
-The specified lines (the entire file, if no range is given) is written
-to
-.LI file .
-If
-.LI file
-is not specified, the current pathname is used.
-If
-.LI file
-is specified, and it exists, or if the current pathname was set using the
-.CO file
-command, and the file already exists, these commands will fail.
-Appending a
-.QT !
-character to the command name will override this check and the write
-will be attempted, regardless.
-.sp
-Specifying the optional
-.QT >>
-string will cause the write to be appended to the file, in which case
-no tests are made for the file already existing.
-.sp
-If the file is preceded by a
-.QT !
-character, the program named by the shell edit option is
-invoked with file as its second argument, and the specified
-lines are passed as standard input to that command.
-The
-.QT !
-in this usage must be separated from command name by at least one
-whitespace character.
-The special meaning of the
-.QT !
-may be overridden by escaping it with a backslash
-.PQ \e
-character.
-.sp
-The
-.CO wq
-version of the write command will exit the editor after writing the file,
-if there are no further files to edit.
-Appending a
-.QT !
-character to the command name or entering two
-.QQ quit
-commands (i.e.
-.CO wq ,
-.CO quit ,
-.CO xit
-or
-.CO ZZ )
-in a row) will override this check and the editor will exit,
-ignoring any files that have not yet been edited.
-.sp
-The
-.CO wn
-version of the write command will move to the next file after writing
-the file, unless the write fails.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-Affected by the
-.OP readonly
-and
-.OP writeany
-options.
-.SE
-.KY xit
-.IP "[range] x[it][!] [file]"
-Write the file if it has been modified.
-The specified lines are written to
-.LI file ,
-if the file has been modified since the last complete write to any
-file.
-If no
-.LI range
-is specified, the entire file is written.
-.sp
-The
-.CO xit
-command will exit the editor after writing the file,
-if there are no further files to edit.
-Appending a
-.QT !
-character to the command name or entering two
-.QQ quit
-commands (i.e.
-.CO wq ,
-.CO quit ,
-.CO xit
-or
-.CO ZZ )
-in a row) will override this check and the editor will exit,
-ignoring any files that have not yet been edited.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-Affected by the
-.OP readonly
-and
-.OP writeany
-options.
-.SE
-.KY yank
-.IP "[range] ya[nk] [buffer] [count]"
-Copy the specified lines to a buffer.
-If no buffer is specified, the unnamed buffer is used.
-.SS
-.SP Line:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY z
-.IP "[line] z [type] [count] [flags]"
-Adjust the window.
-If no
-.LI type
-is specified, then
-.LI count
-lines following the specified line are displayed.
-The default
-.LI count
-is the value of the
-.OP window
-option.
-The
-.LI type
-argument changes the position at which
-.LI line
-is displayed on the screen by changing the number of lines
-displayed before and after
-.LI line .
-The following
-.LI type
-characters may be used:
-.SS
-.SP \-
-Place the line at the bottom of the screen.
-.SP +
-Place the line at the top of the screen.
-.SP \&.
-Place the line in the middle of the screen.
-.SP ^
-Write out count lines starting
-.LI "count * 2"
-lines before
-.LI line ;
-the net effect of this is that a
-.QT z^
-command following a
-.CO z
-command writes the previous page.
-.SP =
-Center
-.LI line
-on the screen with a line of hyphens displayed immediately before and
-after it.
-The number of preceding and following lines of text displayed are
-reduced to account for those lines.
-.SE
-.SS
-.SP Line:
-Set to the last line displayed, with the exception of the
-.Dq Li \&=
-.LI type ,
-where the current line is set to the line specified by the command.
-.SP Options:
-Affected by the
-.OP scroll
-option.
-.SE
diff --git a/docs/USD.doc/vi.ref/index.so b/docs/USD.doc/vi.ref/index.so
deleted file mode 100644
index 4c3acb6e4f04..000000000000
--- a/docs/USD.doc/vi.ref/index.so
+++ /dev/null
@@ -1,260 +0,0 @@
-! 21, 42
-"" 42
-# 22, 43
-$ 22
-% 22
-& 23, 51
-'<character> 23
-( 23
-) 24
-* 43
-+ 19
-, 24
-. 24
-/RE/ 25
-0 25
-0<control-D> 38
-: 26
-; 26
-< 26, 43
-<carriage-return> 14
-<control-A> 17
-<control-B> 17
-<control-D> 17, 38, 42
-<control-E> 18
-<control-F> 18
-<control-G> 18
-<control-H> 18, 39
-<control-J> 19
-<control-L> 19
-<control-M> 19
-<control-N> 19
-<control-P> 19
-<control-R> 19
-<control-T> 19, 38
-<control-U> 20
-<control-W> 20, 39
-<control-X> 39
-<control-Y> 20
-<control-Z> 20, 52
-<control-]> 20
-<control-^> 21
-<end-of-file> 40, 42
-<erase> 39
-<escape> 20, 39
-<interrupt> 12, 37, 39
-<line erase> 39
-<literal-next> 12, 39
-<newline> 14
-<nul> 38
-<space> 21
-<word erase> 39
-= 43
-> 26, 43
-?RE? 25
-@ 26, 43
-A 27
-B 27
-C 27
-D 27
-E 28
-F 28
-G 28
-H 28
-I 28
-J 29
-L 29
-M 29
-N 25
-O 29
-P 29
-Q 30
-R 30
-S 30
-T 30
-U 30
-W 31
-X 31
-Y 31
-ZZ 31
-[[ 31
-\- 24
-]] 32
-^ 32
-^<control-D> 38
-_ 32
-`<character> 23
-a 32
-abbrev 43
-alternate pathname 13
-altwerase 56
-append 44
-args 44
-autoindent 56
-autoprint 56
-autowrite 57
-b 32
-backup 57
-beautify 57
-bg 44
-bigword 16
-buffer 13
-c 33
-cd 45
-cdpath 57
-cedit 57
-change 45
-chdir 45
-columns 58
-comment 58
-copy 45
-count 16, 41
-cscope 45
-current pathname 12
-d 33
-delete 45
-directory 58
-display 45
-e 33
-edcompatible 58
-edit 46
-errorbells 58
-escapetime 58
-exrc 58
-extended 58
-exusage 46
-f 33
-fg 46
-file 41, 46
-filec 58
-flags 41
-flash 59
-global 47
-hardtabs 59
-help 47
-i 33
-iclower 59
-ignorecase 59
-insert 47
-j 19
-join 47
-k 19, 48
-keytime 59
-l 21
-leftright 59
-line 41
-lines 59
-lisp 59
-list 48, 59
-lock 59
-m 34
-magic 60
-map 48
-mark 48
-matchtime 60
-mesg 60
-mkexrc 49
-modelines 60
-motion 15
-move 48
-msgcat 60
-n 25
-next 49
-noprint 60
-number 43, 61
-o 34
-octal 61
-open 49, 61
-optimize 61
-p 34
-paragraph 16
-paragraphs 61
-path 61
-preserve 49
-previous 49
-previous context 15
-print 50, 61
-prompt 61
-put 50
-quit 50
-r 34
-range 41
-read 50
-readonly 61
-recdir 62
-recover 50
-redraw 62
-remap 62
-report 62
-resize 50
-rewind 51
-ruler 62
-s 34
-scroll 62
-searchincr 62
-section 17
-sections 63
-secure 63
-sentence 17
-set 51
-shell 51, 63
-shellmeta 63
-shiftwidth 63
-showmatch 63
-showmode 63
-sidescroll 63
-slowopen 63
-source 51
-sourceany 64
-stop 52
-substitute 51
-suspend 52
-t 35, 45
-tabstop 64
-tag 52
-taglength 64
-tagnext 52
-tagpop 53
-tagprev 53
-tags 64
-tagtop 53
-term 64
-terse 64
-tildeop 64
-timeout 64
-ttywerase 64
-u 35
-unabbrev 53
-undo 53
-unmap 54
-unnamed buffer 14
-v 47
-verbose 64
-version 54
-visual 54
-viusage 54
-w 35
-w1200 64
-w300 64
-w9600 64
-warn 65
-whitespace 14
-window 65
-windowname 65
-wn 54
-word 16
-wq 54
-wraplen 65
-wrapmargin 65
-wrapscan 65
-write 54
-writeany 66
-x 35
-xit 55
-y 35
-yank 55
-z 36, 55
-{ 36
-| 36
-} 37
-~ 37, 51
diff --git a/docs/USD.doc/vi.ref/merge.awk b/docs/USD.doc/vi.ref/merge.awk
deleted file mode 100644
index c65207c106a7..000000000000
--- a/docs/USD.doc/vi.ref/merge.awk
+++ /dev/null
@@ -1,16 +0,0 @@
-# @(#)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"
-}
diff --git a/docs/USD.doc/vi.ref/ref.so b/docs/USD.doc/vi.ref/ref.so
deleted file mode 100644
index a82c79258bb1..000000000000
--- a/docs/USD.doc/vi.ref/ref.so
+++ /dev/null
@@ -1,103 +0,0 @@
-.\" 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
-..
diff --git a/docs/USD.doc/vi.ref/set.opt.roff b/docs/USD.doc/vi.ref/set.opt.roff
deleted file mode 100644
index 838412897ab0..000000000000
--- a/docs/USD.doc/vi.ref/set.opt.roff
+++ /dev/null
@@ -1,1303 +0,0 @@
-.\" 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.
-.\"
-.\" @(#)set.opt.roff 8.66 (Berkeley) 10/10/96
-.\"
-.SH 1 "Set Options"
-.pp
-There are a large number of options that may be set (or unset) to
-change the editor's behavior.
-This section describes the options, their abbreviations and their
-default values.
-.pp
-In each entry below, the first part of the tag line is the full name
-of the option, followed by any equivalent abbreviations.
-(Regardless of the abbreviations, it is only necessary to use the
-minimum number of characters necessary to distinguish an abbreviation
-from all other commands for it to be accepted, in
-.EV nex nvi .
-Historically, only the full name and the official abbreviations
-were accepted by
-.EV ex vi .
-Using full names in your startup files and environmental variables will
-probably make them more portable.)
-The part in square brackets is the default value of the option.
-Most of the options are boolean, i.e. they are either on or off,
-and do not have an associated value.
-.pp
-Options apply to both
-.CO ex
-and
-.CO vi
-modes, unless otherwise specified.
-.pp
-With a few exceptions,
-all options are settable per screen, i.e. the
-.OP tags
-option can be set differently in each screen.
-The exceptions are the
-.OP columns ,
-.OP lines ,
-.OP secure
-and
-.OP term
-options.
-Changing these options modifies the respective information for all screens.
-.pp
-For information on modifying the options or to display the options and
-their current values, see the
-.QQ set
-command in the section entitled
-.QB "Ex Commands" .
-.KY altwerase
-.IP "altwerase [off]"
-.CO Vi
-only.
-Change how
-.CO vi
-does word erase during text input.
-When this option is set, text is broken up into three classes:
-alphabetic, numeric and underscore characters, other nonblank
-characters, and blank characters.
-Changing from one class to another marks the end of a word.
-In addition, the class of the first character erased is ignored
-(which is exactly what you want when erasing pathname components).
-.KY autoindent
-.IP "autoindent, ai [off]"
-If this option is set, whenever you create a new line (using the
-.CO vi
-.CO A ,
-.CO a ,
-.CO C ,
-.CO c ,
-.CO I ,
-.CO i ,
-.CO O ,
-.CO o ,
-.CO R ,
-.CO r ,
-.CO S ,
-and
-.CO s
-commands, or the
-.CO ex
-.CO append ,
-.CO change ,
-and
-.CO insert
-commands) the new line is automatically indented to align the cursor with
-the first nonblank character of the line from which you created it.
-Lines are indented using tab characters to the extent possible (based on
-the value of the
-.OP tabstop
-option) and then using space characters as necessary.
-For commands inserting text into the middle of a line, any blank characters
-to the right of the cursor are discarded, and the first nonblank character
-to the right of the cursor is aligned as described above.
-.sp
-The indent characters are themselves somewhat special.
-If you do not enter more characters on the new line before moving to
-another line, or entering
-.LI <escape> ,
-the indent character will be deleted and the line will be empty.
-For example, if you enter
-.LI <carriage-return>
-twice in succession,
-the line created by the first
-.LI <carriage-return>
-will not have any characters in it,
-regardless of the indentation of the previous or subsequent line.
-.sp
-Indent characters also require that you enter additional erase characters
-to delete them.
-For example,
-if you have an indented line, containing only blanks, the first
-.LI <word-erase>
-character you enter will erase up to end of the indent characters,
-and the second will erase back to the beginning of the line.
-(Historically, only the
-.LI <control-D>
-key would erase the indent characters.
-Both the
-.LI <control-D>
-key and the usual erase keys work in
-.CO nvi .)
-In addition, if the cursor is positioned at the end of the indent
-characters, the keys
-.QT 0<control-D>
-will erase all of the indent characters for the current line,
-resetting the indentation level to 0.
-Similarly, the keys
-.QT ^<control-D>
-will erase all of the indent characters for the current line,
-leaving the indentation level for future created lines unaffected.
-.sp
-Finally, if the
-.OP autoindent
-option is set, the
-.CO S
-and
-.CO cc
-commands change from the first nonblank of the line to the end of the
-line, instead of from the beginning of the line to the end of the line.
-.KY autoprint
-.IP "autoprint, ap [off]"
-.CO Ex
-only.
-Cause the current line to be automatically displayed after the
-.CO ex
-commands
-.CO < ,
-.CO > ,
-.CO copy ,
-.CO delete ,
-.CO join ,
-.CO move ,
-.CO put ,
-.CO t ,
-.CO Undo ,
-and
-.CO undo .
-This automatic display is suppressed during
-.CO global
-and
-.CO v
-commands, and for any command where optional flags are used to explicitly
-display the line.
-.KY autowrite
-.IP "autowrite, aw [off]"
-If this option is set, the
-.CO vi
-.CO ! ,
-.CO ^^ ,
-.CO ^]
-and
-.CO <control-Z>
-commands, and the
-.CO ex
-.CO edit ,
-.CO next ,
-.CO rewind ,
-.CO stop ,
-.CO suspend ,
-.CO tag ,
-.CO tagpop ,
-and
-.CO tagtop
-commands automatically write the current file back to the current file name
-if it has been modified since it was last written.
-If the write fails, the command fails and goes no further.
-.sp
-Appending the optional force flag character
-.QT !
-to the
-.CO ex
-commands
-.CO next ,
-.CO rewind ,
-.CO stop ,
-.CO suspend ,
-.CO tag ,
-.CO tagpop ,
-and
-.CO tagtop
-stops the automatic write from being attempted.
-.sp
-(Historically, the
-.CO next
-command ignored the optional force flag.)
-Note, the
-.CO ex
-commands
-.CO edit ,
-.CO quit ,
-.CO shell ,
-and
-.CO xit
-are
-.i not
-affected by the
-.OP autowrite
-option.
-.sp
-The
-.OP autowrite
-option is ignored if the file is considered read-only for any reason.
-.\" I cannot get a double quote to print between the square brackets
-.\" to save my life. The ONLY way I've been able to get this to work
-.\" is with the .tr command.
-.tr Q"
-.ds ms backup [QQ]
-.KY backup
-.IP "\*(ms"
-.tr QQ
-If this option is set, it specifies a pathname used as a backup file,
-and, whenever a file is written, the file's current contents are copied
-to it.
-The pathname is
-.QT \&# ,
-.QT \&%
-and
-.QT \&!
-expanded.
-.sp
-If the first character of the pathname is
-.QT \&N ,
-a version number is appended to the pathname (and the
-.QT \&N
-character is then discarded).
-Version numbers are always incremented, and each backup file will have
-a version number one greater than the highest version number currently
-found in the directory.
-.sp
-Backup files must be regular files, owned by the real user ID of the
-user running the editor, and not accessible by any other user.
-.KY beautify
-.IP "beautify, bf [off]"
-If this option is set, all control characters that are not currently being
-specially interpreted, other than
-.LI <tab> ,
-.LI <newline> ,
-and
-.LI <form-feed> ,
-are
-discarded from commands read in by
-.CO ex
-from command files, and from input text entered to
-.CO vi
-(either into the file or to the colon command line).
-Text files read by
-.EV ex vi
-are
-.i not
-affected by the
-.OP beautify
-option.
-.KY cdpath
-.IP "cdpath [environment variable CDPATH, or current directory]"
-This option is used to specify a colon separated list of directories
-which are used as path prefixes for any relative path names used as
-arguments for the
-.CO cd
-command.
-The value of this option defaults to the value of the environmental
-variable
-.LI CDPATH
-if it is set, otherwise to the current directory.
-For compatibility with the POSIX 1003.2 shell, the
-.CO cd
-command does
-.i not
-check the current directory as a path prefix for relative path names
-unless it is explicitly specified.
-It may be so specified by entering an empty string or a
-.QT \&.
-character into the
-.LI CDPATH
-variable or the option value.
-.KY cedit
-.IP "cedit [no default]"
-This option adds the ability to edit the colon command-line history.
-This option is set to a string.
-Whenever the first character of that string is entered on the colon
-command line,
-you will enter a normal editing window on the collected commands that
-you've entered on the
-.CO vi
-colon command-line.
-You may then modify and/or execute the commands.
-All normal text editing is available,
-except that you cannot use
-.CO <control-W>
-to switch to an alternate screen.
-Entering a
-.CO <carriage-return>
-will execute the current line of the screen window as an ex command in
-the context of the screen from which you created the colon command-line
-screen,
-and you will then return to that screen.
-.sp
-Because of
-.CO vi \&'s
-parsing rules, it can be difficult to set the colon command-line edit
-character to the
-.LI <escape>
-character.
-To set it to
-.LI <escape> ,
-use
-.QT "set cedit=<literal-next><escape>" .
-.sp
-If the
-.OP cedit
-edit option is set to the same character as the
-.OP filec
-edit option,
-.CO vi
-will perform colon command-line editing if the character is entered as
-the first character of the line,
-otherwise,
-.CO vi
-will perform file name expansion.
-.KY columns
-.IP "columns, co [80]"
-The number of columns in the screen.
-Setting this option causes
-.EV ex vi
-to set (or reset) the environmental variable
-.LI COLUMNS .
-See the section entitled
-.QB "Sizing the Screen"
-more information.
-.KY comment
-.IP "comment [off]"
-.CO Vi
-only.
-If the first non-empty line of the file begins with the string
-.QT # ,
-.QT /\&*
-or
-.QT // ,
-this option causes
-.CO vi
-to skip to the end of that shell, C or C++ comment (probably a
-terribly boring legal notice) before displaying the file.
-.KY directory
-.IP "directory, dir [environment variable TMPDIR, or /tmp]"
-The directory where temporary files are created.
-The environmental variable
-.LI TMPDIR
-is used as the default value if it exists, otherwise
-.LI /tmp
-is used.
-.KY edcompatible
-.IP "edcompatible, ed [off]"
-Remember the values of the
-.QQ c
-and
-.QQ g
-suffixes to the
-.CO substitute
-commands, instead of initializing them as unset for each new
-command.
-Specifying pattern and replacement strings to the
-.CO substitute
-command unsets the
-.QQ c
-and
-.QQ g
-suffixes as well.
-.KY escapetime
-.IP "escapetime [1]"
-The 10th's of a second
-.EV ex vi
-waits for a subsequent key to complete an
-.LI <escape>
-key mapping.
-.KY errorbells
-.IP "errorbells, eb [off]"
-.CO Ex
-only.
-.CO Ex
-error messages are normally presented in inverse video.
-If that is not possible for the terminal, setting this option causes
-error messages to be announced by ringing the terminal bell.
-.KY exrc
-.IP "exrc, ex [off]"
-If this option is turned on in the EXINIT environment variables,
-or the system or $HOME startup files,
-the local startup files are read,
-unless they are the same as the system or $HOME startup files or
-fail to pass the standard permission checks.
-See the section entitled
-.QB "Startup Information"
-for more information.
-.KY extended
-.IP "extended [off]"
-This option causes all regular expressions to be treated as POSIX
-1003.2 Extended Regular Expressions (which are similar to historic
-.XR egrep 1
-style expressions).
-.KY filec
-.IP "filec [no default]"
-This option adds the ability to do shell expansion when entering input
-on the colon command line.
-This option is set to a string.
-Whenever the first character of that string is entered on the colon
-command line,
-the <blank> delimited string immediately before the cursor is expanded
-as if it were followed by a
-.LI \&*
-character, and file name expansion for the
-.CO ex
-edit command was done.
-If no match is found, the screen is flashed and text input resumed.
-If a single match results, that match replaces the expanded text.
-In addition, if the single match is for a directory, a
-.LI \&/
-character is appended and file completion is repeated.
-If more than a single match results,
-any unique prefix shared by the matches replaces the expanded text,
-the matches are displayed,
-and text input resumed.
-.sp
-Because of
-.CO vi \&'s
-parsing rules, it can be difficult to set the path completion character
-to two command values,
-.LI <escape>
-and
-.LI <tab> .
-To set it to
-.LI <escape> ,
-use
-.QT "set filec=<literal-next><escape>" .
-To set it to
-.LI <tab> ,
-use
-.QT "set filec=\e<tab>" .
-.sp
-If the
-.OP cedit
-edit option is set to the same character as the
-.OP filec
-edit option,
-.CO vi
-will perform colon command-line editing if the character is entered as
-the first character of the line,
-otherwise,
-.CO vi
-will perform file name expansion.
-.KY flash
-.IP "flash [on]"
-This option causes the screen to flash instead of beeping the keyboard,
-on error, if the terminal has the capability.
-.KY hardtabs
-.IP "hardtabs, ht [8]"
-This option defines the spacing between hardware tab settings, i.e.
-the tab expansion done by the operating system and/or the terminal
-itself.
-As
-.EV nex nvi
-never writes
-.LI <tab>
-characters to the terminal, unlike historic versions of
-.EV ex vi ,
-this option does not currently have any affect.
-.KY iclower
-.IP "iclower [off]"
-The
-.OP iclower
-edit option makes all Regular Expressions case-insensitive,
-as long as an upper-case letter does not appear in the search string.
-.KY ignorecase
-.IP "ignorecase, ic [off]"
-This option causes regular expressions, both in
-.CO ex
-commands and in searches,
-to be evaluated in a case-insensitive manner.
-.KY keytime
-.IP "keytime [6]"
-The 10th's of a second
-.EV ex vi
-waits for a subsequent key to complete a key mapping.
-.KY leftright
-.IP "leftright [off]"
-.CO Vi
-only.
-This option causes the screen to be scrolled left-right to view
-lines longer than the screen, instead of the traditional
-.CO vi
-screen interface which folds long lines at the right-hand margin
-of the terminal.
-.KY lines
-.IP "lines, li [24]"
-.CO Vi
-only.
-The number of lines in the screen.
-Setting this option causes
-.EV ex vi
-to set (or reset) the environmental variable
-.LI LINES .
-See the section entitled
-.QB "Sizing the Screen"
-for more information.
-.KY lisp
-.IP "lisp [off]"
-.CO Vi
-only.
-This option changes the behavior of the
-.CO vi
-.CO ( ,
-.CO ) ,
-.CO { ,
-.CO } ,
-.CO [[
-and
-.CO ]]
-commands to match the Lisp language.
-Also, the
-.OP autoindent
-option's behavior is changed to be appropriate for Lisp.
-.sp
-.i "This option is not yet implemented."
-.KY list
-.IP "list [off]"
-This option causes lines to be displayed in an unambiguous fashion.
-Specifically, tabs are displayed as control characters, i.e.
-.QT ^I ,
-and the ends of lines are marked with a
-.QT $
-character.
-.KY lock
-.IP "lock [on]"
-This option causes the editor to attempt to get an exclusive lock on
-any file being edited, read or written.
-Reading or writing a file that cannot be locked produces a warning
-message, but no other effect.
-Editing a file that cannot be locked results in a read only edit session,
-as if the
-.OP readonly
-edit option were set.
-.KY magic
-.IP "magic [on]"
-This option is on by default.
-Turning the
-.OP magic
-option off causes all regular expression characters except for
-.QT ^
-and
-.QT $ ,
-to be treated as ordinary characters.
-To re-enable characters individually, when the
-.OP magic
-option is off,
-precede them with a backslash
-.QT \e
-character.
-See the section entitled
-.QB "Regular Expressions and Replacement Strings"
-for more information.
-.KY matchtime
-.IP "matchtime [7]"
-.CO Vi
-only.
-The 10th's of a second
-.CO vi
-pauses on the matching character when the
-.OP showmatch
-option is set.
-.KY mesg
-.IP "mesg [on]"
-This option allows other users to contact you using the
-.XR talk 1
-and
-.XR write 1
-utilities, while you are editing.
-.EV Ex vi
-does not turn message on, i.e. if messages were turned off when the
-editor was invoked, they will stay turned off.
-This option only permits you to disallow messages for the edit session.
-See the
-.XR mesg 1
-utility for more information.
-.KY msgcat
-.IP "msgcat [./]"
-This option selects a message catalog to be used to display error and
-informational messages in a specified language.
-If the value of this option ends with a '/', it is treated as the name
-of a directory that contains a message catalog
-.QT "vi_XXXX" ,
-where
-.QT XXXX
-is the value of the
-.LI LANG
-environmental variable, if it's set, or the value of the
-.LI LC_MESSAGES
-environmental variable if it's not.
-If neither of those environmental variables are set,
-or if the option doesn't end in a '/',
-the option is treated as the full path name of the message catalog to use.
-.sp
-If any messages are missing from the catalog,
-the backup text (English) is used instead.
-.sp
-See the distribution file
-.LI catalog/README
-for additional information on building and installing message catalogs.
-.KY modelines
-.IP "modelines, modeline [off]"
-If the
-.OP modelines
-option is set,
-.EV ex vi
-has historically scanned the first and last five lines of each file as
-it is read for editing, looking for any
-.CO ex
-commands that have been placed in those lines.
-After the startup information has been processed, and before the user
-starts editing the file, any commands embedded in the file are executed.
-.sp
-Commands were recognized by the letters
-.QQ e
-or
-.QQ v
-followed by
-.QQ x
-or
-.QQ i ,
-at the beginning of a line or following a tab or space character,
-and followed by a
-.QQ : ,
-an
-.CO ex
-command, and another
-.QQ : .
-.sp
-This option is a security problem of immense proportions,
-and should not be used under any circumstances.
-.sp
-.i "This option will never be implemented."
-.\" I cannot get a double quote to print between the square brackets
-.\" to save my life. The ONLY way I've been able to get this to work
-.\" is with the .tr command.
-.tr Q"
-.ds ms noprint [QQ]
-.KY noprint
-.IP "\*(ms"
-.tr QQ
-Characters that are never handled as printable characters.
-By default, the C library function
-.XR isprint 3
-is used to determine if a character is printable or not.
-This edit option overrides that decision.
-.KY number
-.IP "number, nu [off]"
-Precede each line displayed with its current line number.
-.KY octal
-.IP "octal [off]"
-Display unknown characters as octal numbers
-.PQ "\e###" ,
-instead of the default
-hexadecimal
-.PQ "\ex##" .
-.KY open
-.IP "open [on]"
-.CO Ex
-only.
-If this option is not set, the
-.CO open
-and
-.CO visual
-commands are disallowed.
-.KY optimize
-.IP "optimize, opt [on]"
-.CO Vi
-only.
-Throughput of text is expedited by setting the terminal not to do automatic
-carriage returns when printing more than one (logical) line of output,
-greatly speeding output on terminals without addressable cursors when text
-with leading white space is printed.
-.sp
-.i "This option is not yet implemented."
-.KY paragraphs
-.IP "paragraphs, para [IPLPPPQPP LIpplpipbp]"
-.CO Vi
-only.
-Define additional paragraph boundaries for the
-.CO {
-and
-.CO }
-commands.
-The value of this option must be a character string consisting
-of zero or more character pairs.
-.sp
-In the text to be edited, the character string
-.LI "<newline>.<char-pair>" ,
-(where
-.LI <char-pair>
-is one of the character pairs in the option's value)
-defines a paragraph boundary.
-For example, if the option were set to
-.LI "LaA<space>##" ,
-then all of the following additional paragraph boundaries would be
-recognized:
-.sp
-.(l
-<newline>.La
-<newline>.A<space>
-<newline>.##
-.)l
-.KY path
-.IP "path []"
-The path option can be used to specify a <colon>-separated list of
-paths, similar to the
-.LI PATH
-environment variable in the shells.
-If this option is set,
-the name of the file to be edited is not an absolute pathname,
-the first component of the filename is not
-.QT \&.
-or
-.QT \&.. ,
-and the file to be edited doesn't exist in the current directory,
-the elements of the
-.OP path
-option are sequentially searched for a file of the specified name.
-If such a file is found, it is edited.
-.\" I cannot get a double quote to print between the square brackets
-.\" to save my life. The ONLY way I've been able to get this to work
-.\" is with the .tr command.
-.tr Q"
-.ds ms print [QQ]
-.KY print
-.IP "\*(ms"
-.tr QQ
-Characters that are always handled as printable characters.
-By default, the C library function
-.XR isprint 3
-is used to determine if a character is printable or not.
-This edit option overrides that decision.
-.KY prompt
-.IP "prompt [on]"
-.CO Ex
-only.
-This option causes
-.CO ex
-to prompt for command input with a
-.QT :
-character; when it is not set, no prompt is displayed.
-.KY readonly
-.IP "readonly, ro [off]"
-This option causes a force flag to be required to attempt to write the file.
-Setting this option is equivalent to using the
-.b \-R
-command line option,
-or executing the
-.CO vi
-program using the name
-.CO view .
-.sp
-The
-.OP readonly
-edit option is not usually persistent, like other edit options.
-If the
-.b \-R
-command line option is set,
-.CO vi
-is executed as
-.CO view ,
-or the
-.OP readonly
-edit option is explicitly set,
-all files edited in the screen will be marked readonly,
-and the force flag will be required to write them.
-However, if none of these conditions are true,
-or the
-.OP readonly
-edit option is explicitly unset,
-then the
-.OP readonly
-edit option will toggle based on the write permissions of the file currently
-being edited as of when it is loaded into the edit buffer.
-In other words, the
-.OP readonly
-edit option will be set if the current file lacks write permissions,
-and will not be set if the user has write permissions for the file.
-.KY recdir
-.IP "recdir [/var/tmp/vi.recover]"
-The directory where recovery files are stored.
-.sp
-If you change the value of
-.OP recdir ,
-be careful to choose a directory whose contents are not regularly
-deleted.
-Bad choices include directories in memory based filesystems,
-or
-.LI /tmp ,
-on most systems,
-as their contents are removed when the machine is rebooted.
-.sp
-Public directories like
-.LI /usr/tmp
-and
-.LI /var/tmp
-are usually safe, although some sites periodically prune old files
-from them.
-There is no requirement that you use a public directory,
-e.g. a sub-directory of your home directory will work fine.
-.sp
-Finally, if you change the value of
-.OP recdir ,
-you must modify the recovery script to operate in your chosen recovery
-area.
-.sp
-See the section entitled
-.QB "Recovery"
-for further information.
-.KY redraw
-.IP "redraw, re [off]"
-.CO Vi
-only.
-The editor simulates (using great amounts of output), an intelligent
-terminal on a dumb terminal (e.g. during insertions in
-.CO vi
-the characters to the right of the cursor are refreshed as each input
-character is typed).
-.sp
-.i "This option is not yet implemented."
-.KY remap
-.IP "remap [on]"
-If this option is set,
-it is possible to define macros in terms of other macros.
-Otherwise, each key is only remapped up to one time.
-For example, if
-.QT A
-is mapped to
-.QT B ,
-and
-.QT B
-is mapped to
-.QT C ,
-The keystroke
-.QT A
-will be mapped to
-.QT C
-if the
-.OP remap
-option is set, and to
-.QT B
-if it is not set.
-.KY report
-.IP "report [5]"
-Set the threshold of the number of lines that need to be changed or
-yanked before a message will be displayed to the user.
-For everything but the yank command, the value is the largest value
-about which the editor is silent, i.e. by default, 6 lines must be
-deleted before the user is notified.
-However, if the number of lines yanked is greater than
-.i "or equal to"
-the set value, it is reported to the user.
-.KY ruler
-.IP "ruler [off]"
-.CO Vi
-only.
-Display a row/column ruler on the colon command line.
-.KY scroll
-.IP "scroll, scr [(environment variable LINES - 1) / 2]"
-Set the number of lines scrolled by the
-.CO ex
-.CO <control-D>
-and
-.CO <end-of-file>
-commands.
-.sp
-Historically, the
-.CO ex
-.CO z
-command, when specified without a count, used two times the size of the
-scroll value; the POSIX 1003.2 standard specified the window size, which
-is a better choice.
-.KY searchincr
-.IP "searchincr [off]"
-The
-.OP searchincr
-edit option makes the search commands
-.CO \&/
-and
-.CO \&?
-incremental, i.e. the screen is updated and the cursor moves to the matching
-text as the search pattern is entered.
-If the search pattern is not found,
-the screen is beeped and the cursor remains on the colon-command line.
-Erasing characters from the search pattern backs the cursor up to the
-previous matching text.
-.KY sections
-.IP "sections, sect [NHSHH HUnhsh]"
-.CO Vi
-only.
-Define additional section boundaries for the
-.CO [[
-and
-.CO ]]
-commands.
-The
-.OP sections
-option should be set to a character string consisting of zero or
-more character pairs.
-In the text to be edited, the character string
-.LI "<newline>.<char-pair>" ,
-(where
-.LI <char-pair>
-is one of the character pairs in the option's value),
-defines a section boundary in the same manner that
-.OP paragraphs
-option boundaries are defined.
-.KY secure
-.IP "secure [off]"
-The
-.OP secure
-edit option turns off all access to external programs.
-This means that the versions of the
-.CO read
-and
-.CO write
-commands that filter text through other programs,
-the
-.CO vi
-.CO \&!
-and
-.CO <control-Z>
-commands,
-the
-.CO ex
-.CO \&! ,
-.CO script ,
-.CO shell ,
-.CO stop
-and
-.CO suspend
-commands and file name expansion will not be permitted.
-Once set,
-the
-.OP secure
-edit option may not be unset.
-.KY shell
-.IP "shell, sh [environment variable SHELL, or /bin/sh]"
-Select the shell used by the editor.
-The specified path is the pathname of the shell invoked by the
-.CO vi
-.CO !
-shell escape command and by the
-.CO ex
-.CO shell
-command.
-This program is also used to resolve any shell meta-characters in
-.CO ex
-commands.
-.\" I cannot get a double quote to print between the square brackets
-.\" to save my life. The ONLY way I've been able to get this to work
-.\" is with the .tr command.
-.tr Q"
-.ds ms shellmeta [~{[*?$`'Q\e]
-.KY shellmeta
-.IP "\*(ms"
-.tr QQ
-The set of characters that
-.CO ex
-checks for when doing file name expansion.
-If any of the specified characters are found in the file name arguments
-to the
-.CO ex
-commands,
-the arguments are expanded using the program defined by the
-.OP shell
-option.
-The default set of characters is a union of meta characters
-from the Version 7 and the Berkeley C shell.
-.KY shiftwidth
-.IP "shiftwidth, sw [8]"
-Set the autoindent and shift command indentation width.
-This width is used by the
-.OP autoindent
-option and by the
-.CO < ,
-.CO > ,
-and
-.CO shift
-commands.
-.KY showmatch
-.IP "showmatch, sm [off]"
-.CO Vi
-only.
-This option causes
-.CO vi ,
-when a
-.QT }
-or
-.QT )
-is entered, to briefly move the cursor the matching
-.QT {
-or
-.QT ( .
-See the
-.OP matchtime
-option for more information.
-.KY showmode
-.IP "showmode, smd [off]"
-.CO Vi
-only.
-This option causes
-.CO vi
-to display a string identifying the current editor mode on the colon
-command line.
-The string is preceded by an asterisk (``*'') if the file has been
-modified since it was last completely written,
-.KY sidescroll
-.IP "sidescroll [16]"
-.CO Vi
-only.
-Sets the number of columns that are shifted to the left or right,
-when
-.CO vi
-is doing left-right scrolling and the left or right margin is
-crossed.
-See the
-.OP leftright
-option for more information.
-.KY slowopen
-.IP "slowopen, slow [off]"
-This option affects the display algorithm used by
-.CO vi ,
-holding off display updating during input of new text to improve
-throughput when the terminal in use is slow and unintelligent.
-.sp
-.i "This option is not yet implemented."
-.KY sourceany
-.IP "sourceany [off]"
-If this option is turned on,
-.CO vi
-historically read startup files that were owned by someone other than
-the editor user.
-See the section entitled
-.QB "Startup Information"
-for more information.
-This option is a security problem of immense proportions,
-and should not be used under any circumstances.
-.sp
-.i "This option will never be implemented."
-.KY tabstop
-.IP "tabstop, ts [8]"
-This option sets tab widths for the editor display.
-.KY taglength
-.IP "taglength, tl [0]"
-This option sets the maximum number of characters that are considered
-significant in a tag name.
-Setting the value to 0 makes all of the characters in the tag name
-significant.
-.KY tags
-.IP "tags, tag [tags /var/db/libc.tags /sys/kern/tags]"
-Sets the list of tags files, in search order,
-which are used when the editor searches for a tag.
-.KY term
-.IP "term, ttytype, tty [environment variable TERM]"
-Set the terminal type.
-Setting this option causes
-.EV ex vi
-to set (or reset) the environmental variable
-.LI TERM .
-.KY terse
-.IP "terse [off]"
-This option has historically made editor messages less verbose.
-It has no effect in this implementation.
-See the
-.OP verbose
-option for more information.
-.KY tildeop
-.IP "tildeop [off]"
-Modify the
-.CO ~
-command to take an associated motion.
-.KY timeout
-.IP "timeout, to [on]"
-If this option is set,
-.EV ex vi
-waits for a specific period for a subsequent key to complete a key
-mapping (see the
-.OP keytime
-option).
-If the option is not set, the editor waits until enough keys are
-entered to resolve the ambiguity, regardless of how long it takes.
-.KY ttywerase
-.IP "ttywerase [off]"
-.CO Vi
-only.
-This option changes how
-.CO vi
-does word erase during text input.
-If this option is set, text is broken up into two classes,
-blank characters and nonblank characters.
-Changing from one class to another marks the end of a word.
-.KY verbose
-.IP "verbose [off]"
-.CO Vi
-only.
-.CO Vi
-historically bells the terminal for many obvious mistakes, e.g. trying
-to move past the left-hand margin, or past the end of the file.
-If this option is set, an error message is displayed for all errors.
-.KY w300
-.IP "w300 [no default]"
-.CO Vi
-only.
-Set the window size if the baud rate is less than 1200 baud.
-See the
-.OP window
-option for more information.
-.KY w1200
-.IP "w1200 [no default]"
-.CO Vi
-only.
-Set the window size if the baud rate is equal to 1200 baud.
-See the
-.OP window
-option for more information.
-.KY w9600
-.IP "w9600 [no default]"
-.CO Vi
-only.
-Set the window size if the baud rate is greater than 1200 baud.
-See the
-.OP window
-option for more information.
-.KY warn
-.IP "warn [on]"
-.CO Ex
-only.
-This option causes a warning message to the terminal if the file has
-been modified, since it was last written, before a
-.CO !
-command.
-.KY window
-.IP "window, w, wi [environment variable LINES - 1]"
-This option determines the default number of lines in a screenful,
-as displayed by the
-.CO z
-command.
-It also determines the number of lines scrolled by the
-.CO vi
-commands
-.CO <control-B>
-and
-.CO <control-F> ,
-and the default number of lines scrolled by the
-.CO vi
-commands
-.CO <control-D>
-and
-.CO <control-U> .
-The value of window can be unrelated to the real screen size,
-although it starts out as the number of lines on the screen.
-See the section entitled
-.QB "Sizing the Screen"
-for more information.
-Setting the value of the
-.OP window
-option is the same as using the
-.b \-w
-command line option.
-.sp
-If the value of the
-.OP window
-option (as set by the
-.OP window ,
-.OP w300 ,
-.OP w1200
-or
-.OP w9600
-options) is smaller than the actual size of the screen,
-large screen movements will result in displaying only that smaller
-number of lines on the screen.
-(Further movements in that same area will result in the screen being
-filled.)
-This can provide a performance improvement when viewing different
-places in one or more files over a slow link.
-.sp
-Resetting the window size does not reset the default number of lines
-scrolled by the
-.CO <control-D>
-and
-.CO <control-U>
-commands.
-.KY windowname
-.IP "windowname [off]"
-.CO Vi
-changes the name of the editor's icon/window to the current file name
-when it's possible and not destructive, i.e.,
-when the editor can restore it to its original value on exit or when
-the icon/window will be discarded as the editor exits.
-If the
-.OP windowname
-edit option is set,
-.CO vi
-will change the icon/window name even when it's destructive and the
-icon/window name will remain after the editor exits.
-(This is the case for
-.XR xterm 1 ).
-.KY wraplen
-.IP "wraplen, wl [0]"
-This option is identical to the
-.OP wrapmargin
-option, with the exception that it specifies the number of columns
-from the
-.i left
-margin before the line splits, not the right margin.
-.sp
-If both
-.OP wraplen
-and
-.OP wrapmargin
-are set, the
-.OP wrapmargin
-value is used.
-.KY wrapmargin
-.IP "wrapmargin, wm [0]"
-.CO Vi
-only.
-If the value of the
-.OP wrapmargin
-option is non-zero,
-.CO vi
-will split lines so that they end at least that number of columns
-before the right-hand margin of the screen.
-(Note, the value of
-.OP wrapmargin
-is
-.i not
-a text length.
-In a screen that is 80 columns wide, the command
-.QT ":set wrapmargin=8"
-attempts to keep the lines less than or equal to 72 columns wide.)
-.sp
-Lines are split at the previous whitespace character closest to the
-number.
-Any trailing whitespace characters before that character are deleted.
-If the line is split because of an inserted
-.LI <space>
-or
-.LI <tab>
-character, and you then enter another
-.LI <space>
-character, it is discarded.
-.sp
-If wrapmargin is set to 0,
-or if there is no blank character upon which to split the line,
-the line is not broken.
-.sp
-If both
-.OP wraplen
-and
-.OP wrapmargin
-are set, the
-.OP wrapmargin
-value is used.
-.KY wrapscan
-.IP "wrapscan, ws [on]"
-This option causes searches to wrap around the end or the beginning
-of the file, and back to the starting point.
-Otherwise, the end or beginning of the file terminates the search.
-.KY writeany
-.IP "writeany, wa [off]"
-If this option is set, file-overwriting checks that would usually be
-made before the
-.CO write
-and
-.CO xit
-commands, or before an automatic write (see the
-.OP autowrite
-option), are not made.
-This allows a write to any file, provided the file permissions allow it.
diff --git a/docs/USD.doc/vi.ref/spell.ok b/docs/USD.doc/vi.ref/spell.ok
deleted file mode 100644
index a7d95e35d03a..000000000000
--- a/docs/USD.doc/vi.ref/spell.ok
+++ /dev/null
@@ -1,414 +0,0 @@
-ABC
-Amir
-Autoindent
-Autoprint
-BRE's
-Bostic
-Bourne
-CDPATH
-CSCOPE
-Cscope
-DIRS
-DOUBLEQUOTE
-Dq
-Ds
-ERE's
-EXINIT
-Englar
-Ev
-FF
-Fa
-Fg
-FindScreen
-Fl
-Foregrounding
-HUnhsh
-IPLPPPQPP
-Kirkendall
-Korn
-LC
-LIpplpipbp
-LaA
-Li
-Lowercase
-MINUSSIGN
-Makefiles
-Mayoff
-NEX
-NEXINIT
-NHSHH
-NVI
-Neville
-Nex
-Nvi
-OS
-POSIX
-Perl
-PostScript
-QQ
-RE's
-README
-RECDIR
-Reference''USD:13
-SENDMAIL
-SIGHUP
-SIGWINCH
-SQUOTE
-Se
-Std
-Std1003.2
-Sven
-Sy
-TANDARDS
-TIOCGWINSZ
-TMPDIR
-TOC
-Tagnext
-Tagprev
-Tcl
-Tk
-Todo
-USD
-USD.doc
-USD:13
-UUNET
-Unmap
-VI
-Verdoolaege
-Vi
-Vx
-Whitespace
-XOFF
-XON
-XOptions
-XXCOLUMNS
-XXXX
-XXXXXX
-XXb
-ZZ
-ab
-abbrev
-abc
-ags
-ai
-al
-altwerase
-ap
-api
-ar
-arg
-args
-att
-autoindent
-autoprint
-autowrite
-aw
-backgrounded
-backgrounding
-bbrev
-berkeley
-bf
-bg
-bigword
-bigwords
-bostic
-bp
-brev
-bsd
-bugs.current
-c2w
-carat
-cd
-cdpath
-cdy
-cedit
-changelog
-chd
-chdir
-cmd
-co
-count1
-count2
-creens
-cs
-cs.berkeley.edu
-cscope
-ctags
-cw
-db
-dbopen
-dd
-def
-di
-dir
-dit
-docs
-eE
-eFlRsv
-eFlRv
-eL
-eU
-ead
-eb
-edcompatible
-edu
-ee
-egrep
-elete
-elp
-elvis
-email
-enum
-eof
-errorbells
-esc
-escapetime
-eset
-eu
-ex.cmd.roff
-exrc
-ext
-exu
-exusage
-fcntl
-fg
-fi
-filec
-filesystem
-filesystems
-foo
-foregrounded
-foregrounding
-ftp.cs.berkeley.edu
-ftp.uu.net
-gdb
-gdb.script
-getpwent
-gs
-gzip'd
-halfbyte
-hange
-hangup
-hardtabs
-ht
-html
-http
-ic
-iclower
-ifdef
-ignorecase
-ile
-ind
-initially
-ious
-ir
-iscntrl
-isprint
-ist
-ize
-keystroke
-keystrokes
-keytime
-leftright
-lhs
-li
-lib
-libc
-libc.tags
-lineNum
-lineNumber
-lobal
-lowercase
-lp
-luR
-matchtime
-mber
-mesg
-meta
-mk
-mkexrc
-modeful
-modeline
-modelines
-ms
-msgcat
-ndo
-nex
-nexrc
-nk
-nomagic
-nonblank
-nonoverlapping
-nooption
-noprint
-nsert
-nul
-nvi
-nvi.tar.Z
-nvi.tar.z
-nz
-oin
-onnections
-op
-ove
-para
-pathname
-pathnames
-pe
-perl
-perld
-ppend
-prev
-pu
-py
-rc
-rc.local
-readonly
-rec
-recdir
-recfile
-recover.XXXX
-recover.XXXXXX
-recover.c
-recover.script
-redist
-redistributable
-reimplementations
-remapmax
-remapped
-repl
-res
-rew
-rhs
-rint
-ript
-rk
-rl
-ro
-roff
-rsion
-sc
-sccs
-scr
-screeen
-screenId
-se
-searchincr
-sendmail
-set.opt.roff
-settable
-setuid
-sh
-shareware
-shellmeta
-shiftwidth
-showmatch
-showmode
-sidescroll
-slowopen
-sm
-smd
-sourceany
-sp
-spell.ok
-ssg
-st
-su
-sual
-svi
-sw
-ta
-tabstop
-taglength
-tagn
-tagnext
-tagp
-tagpop
-tagprev
-tagstring
-tagt
-tagtop
-tc
-tcl
-tclproc
-terminfo
-th
-th's
-tildeop
-tl
-tmp
-toolchest
-tpath
-tr
-ts
-ttytype
-ttywerase
-uR
-ubstitute
-ucb
-uffers
-uit
-una
-unabbrev
-unescaped
-unm
-unmap
-unsets
-uppercase
-urce
-usr
-uunet
-v
-var
-ve
-vi
-vi.0.ps
-vi.0.txt
-vi.1
-vi.XXXX
-vi.XXXXXX
-vi.cmd.roff
-vi.exrc
-vi.recover
-viAppendLine
-viDelLine
-viEndScreen
-viFindScreen
-viGetCursor
-viGetLine
-viGetMark
-viGetOpt
-viInsertLine
-viLastLine
-viMapKey
-viMsg
-viNewScreen
-viSetCursor
-viSetLine
-viSetMark
-viSetOpt
-viSwitchScreen
-viUnmMapKey
-vibackup
-virecovery
-viu
-viusage
-wa
-whitespace
-wi
-windowname
-wl
-wm
-wn
-wq
-wraplen
-wrapmargin
-wrapscan
-writeany
-ws
-www
-xaw
-xit
-xterm
-ya
-yy
diff --git a/docs/USD.doc/vi.ref/vi.cmd.roff b/docs/USD.doc/vi.ref/vi.cmd.roff
deleted file mode 100644
index 12030cd52b08..000000000000
--- a/docs/USD.doc/vi.ref/vi.cmd.roff
+++ /dev/null
@@ -1,3085 +0,0 @@
-.\" 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.
-.\"
-.\" @(#)vi.cmd.roff 8.49 (Berkeley) 8/17/96
-.\"
-.SH 1 "Vi Description"
-.pp
-.CO Vi
-takes up the entire screen to display the edited file,
-except for the bottom line of the screen.
-The bottom line of the screen is used to enter
-.CO ex
-commands, and for
-.CO vi
-error and informational messages.
-If no other information is being displayed,
-the default display can show the current cursor row and cursor column,
-an indication of whether the file has been modified,
-and the current mode of the editor.
-See the
-.OP ruler
-and
-.OP showmode
-options for more information.
-.pp
-Empty lines do not have any special representation on the screen,
-but lines on the screen that would logically come after the end of
-the file are displayed as a single tilde
-.PQ ~
-character.
-To differentiate between empty lines and lines consisting of only
-whitespace characters, use the
-.OP list
-option.
-Historically, implementations of
-.CO vi
-have also displayed some lines as single asterisk
-.PQ @
-characters.
-These were lines that were not correctly displayed, i.e. lines on the
-screen that did not correspond to lines in the file, or lines that did
-not fit on the current screen.
-.CO Nvi
-never displays lines in this fashion.
-.pp
-.CO Vi
-is a modeful editor, i.e. it has two modes,
-.QQ command
-mode and
-.QQ "text input"
-mode.
-When
-.CO vi
-first starts, it is in command mode.
-There are several commands that change
-.CO vi
-into text input mode.
-The
-.LI <escape>
-character is used to resolve the text input into the file,
-and exit back into command mode.
-In
-.CO vi
-command mode, the cursor is always positioned on the last column of
-characters which take up more than one column on the screen.
-In
-.CO vi
-text insert mode, the cursor is positioned on the first column of
-characters which take up more than one column on the screen.
-.pp
-When positioning the cursor to a new line and column,
-the type of movement is defined by the distance to the new cursor position.
-If the new position is close,
-the screen is scrolled to the new location.
-If the new position is far away,
-the screen is repainted so that the new position is on the screen.
-If the screen is scrolled,
-it is moved a minimal amount,
-and the cursor line will usually appear at the top or bottom of the screen.
-If the screen is repainted,
-the cursor line will appear in the center of the screen,
-unless the cursor is sufficiently close to the beginning or end of the file
-that this isn't possible.
-If the
-.OP leftright
-option is set, the screen may be scrolled or repainted in a horizontal
-direction as well as in a vertical one.
-.pp
-A major difference between the historical
-.CO vi
-presentation and
-.CO nvi
-is in the scrolling and screen oriented position commands,
-.CO <control-B> ,
-.CO <control-D> ,
-.CO <control-E> ,
-.CO <control-F> ,
-.CO <control-U> ,
-.CO <control-Y> ,
-.CO H ,
-.CO L
-and
-.CO M .
-In historical implementations of
-.CO vi ,
-these commands acted on physical (as opposed to logical, or screen)
-lines.
-For lines that were sufficiently long in relation to the size of the
-screen, this meant that single line scroll commands might repaint the
-entire screen, scrolling or screen positioning commands might not change
-the screen or move the cursor at all, and some lines simply could not
-be displayed, even though
-.CO vi
-would edit the file that contained them.
-In
-.CO nvi ,
-these commands act on logical, i.e. screen lines.
-You are unlikely to notice any difference unless you are editing files
-with lines significantly longer than a screen width.
-.pp
-.CO Vi
-keeps track of the currently
-.QQ "most attractive"
-cursor position.
-Each command description (for commands that alter the current cursor
-position),
-specifies if the cursor is set to a specific location in the line,
-or if it is moved to the
-.QQ "most attractive cursor position" .
-The latter means that the cursor is moved to the cursor position that
-is horizontally as close as possible to the current cursor position.
-If the current line is shorter than the cursor position
-.CO vi
-would select, the cursor is positioned on the last character in the line.
-(If the line is empty, the cursor is positioned on the first column
-of the line.)
-If a command moves the cursor to the most attractive position,
-it does not alter the current cursor position, and a subsequent
-movement will again attempt to move the cursor to that position.
-Therefore, although a movement to a line shorter than the currently
-most attractive position will cause the cursor to move to the end of
-that line, a subsequent movement to a longer line will cause the
-cursor to move back to the most attractive position.
-.pp
-In addition, the
-.CO $
-command makes the end of each line the most attractive cursor position
-rather than a specific column.
-.pp
-Each
-.CO vi
-command described below notes where the cursor ends up after it is
-executed.
-This position is described in terms of characters on the line, i.e.
-.QQ "the previous character" ,
-or,
-.QQ "the last character in the line" .
-This is to avoid needing to continually refer to on what part of the
-character the cursor rests.
-.pp
-The following words have special meaning for
-.CO vi
-commands.
-.KY "previous context"
-.IP "previous context"
-The position of the cursor before the command which caused the
-last absolute movement was executed.
-Each
-.CO vi
-command described in the next section that is considered an
-absolute movement is so noted.
-In addition, specifying
-.i any
-address to an
-.CO ex
-command is considered an absolute movement.
-.KY "motion"
-.IP "motion"
-A second
-.CO vi
-command can be used as an optional trailing argument to the
-.CO vi
-.CO \&< ,
-.CO \&> ,
-.CO \&! ,
-.CO \&c ,
-.CO \&d ,
-.CO \&y ,
-and (depending on the
-.OP tildeop
-option)
-.CO \&~
-commands.
-This command indicates the end of the region of text that's affected by
-the command.
-The motion command may be either the command character repeated (in
-which case it means the current line) or a cursor movement command.
-In the latter case, the region affected by the command is from the
-starting or stopping cursor position which comes first in the file,
-to immediately before the starting or stopping cursor position which
-comes later in the file.
-Commands that operate on lines instead of using beginning and ending
-cursor positions operate on all of the lines that are wholly or
-partially in the region.
-In addition, some other commands become line oriented depending on
-where in the text they are used.
-The command descriptions below note these special cases.
-.sp
-The following commands may all be used as motion components for
-.CO vi
-commands:
-.sp
-.ne 12v
-.ft C
-.TS
-r r r r.
-<control-A> <control-H> <control-J> <control-M>
-<control-N> <control-P> <space> $
-% '<character> ( )
-+ , - /
-0 ; ? B
-E F G H
-L M N T
-W [[ ]] ^
-\&_ `<character> b e
-f h j k
-l n t w
-{ | }
-.TE
-.ft R
-.sp
-The optional count prefix available for some of the
-.CO vi
-commands that take motion commands,
-or the count prefix available for the
-.CO vi
-commands that are used as motion components,
-may be included and is
-.i always
-considered part of the motion argument.
-For example, the commands
-.QT c2w
-and
-.QT 2cw
-are equivalent, and the region affected by the
-.CO c
-command is two words of text.
-In addition,
-if the optional count prefix is specified for both the
-.CO vi
-command and its motion component,
-the effect is multiplicative and is considered part of the motion argument.
-For example, the commands
-.QT 4cw
-and
-.QT 2c2w
-are equivalent, and the region affected by the
-.CO c
-command is four words of text.
-.KY "count"
-.IP "count"
-A positive number used as an optional argument to most commands,
-either to give a size or a position (for display or movement commands),
-or as a repeat count (for commands that modify text).
-The count argument is always optional and defaults to 1 unless otherwise
-noted in the command description.
-.sp
-When a
-.CO vi
-command synopsis shows both a
-.LI [buffer]
-and
-.LI [count] ,
-they may be presented in any order.
-.KY word
-.IP word
-Generally, in languages where it is applicable,
-.CO vi
-recognizes two kinds of words.
-First, a sequence of letters, digits and underscores,
-delimited at both ends by:
-characters other than letters, digits, or underscores,
-the beginning or end of a line, and the beginning or end of the file.
-Second, a sequence of characters other than letters, digits, underscores,
-or whitespace characters, delimited at both ends by: a letter, digit,
-underscore, or whitespace character,
-the beginning or end of a line, and the beginning or end of the file.
-For example, the characters
-.QT " !@#abc$%^ "
-contain three words:
-.QT "!@#" ,
-.QT "abc"
-and
-.QT "$%^" .
-.sp
-Groups of empty lines (or lines containing only whitespace characters)
-are treated as a single word.
-.KY "bigword"
-.IP "bigword"
-A set of non-whitespace characters preceded and followed by whitespace
-characters or the beginning or end of the file or line.
-For example, the characters
-.QT " !@#abc$%^ "
-contain one bigword:
-.QT "!@#abc$%^" .
-.sp
-Groups of empty lines (or lines containing only whitespace characters)
-are treated as a single bigword.
-.KY "paragraph"
-.IP "paragraph"
-An area of text that begins with either the beginning of a file,
-an empty line, or a section boundary, and continues until either
-an empty line, section boundary, or the end of the file.
-.sp
-Groups of empty lines (or lines containing only whitespace characters)
-are treated as a single paragraph.
-.sp
-Additional paragraph boundaries can be defined using the
-.OP paragraphs
-option.
-.KY "section"
-.IP "section"
-An area of text that starts with the beginning of the file or a line
-whose first character is an open brace
-.PQ {
-and continues until the next section or the end of the file.
-.sp
-Additional section boundaries can be defined using the
-.OP sections
-option.
-.KY "sentence"
-.IP "sentence"
-An area of text that begins with either the beginning of the file or the
-first nonblank character following the previous sentence, paragraph, or
-section boundary and continues until the end of the file or a period
-.PQ \&.
-exclamation point
-.PQ !
-or question mark
-.PQ ?
-character,
-followed by either an end-of-line or two whitespace characters.
-Any number of closing parentheses
-.PQ ) ,
-brackets
-.PQ ] ,
-double-quote
-.PQ """"
-or single quote
-.PQ '
-characters can appear between the period, exclamation point,
-or question mark and the whitespace characters or end-of-line.
-.sp
-Groups of empty lines (or lines containing only whitespace characters)
-are treated as a single sentence.
-.SH 1 "Vi Commands"
-.pp
-The following section describes the commands available in the command
-mode of the
-.CO vi
-editor.
-In each entry below, the tag line is a usage synopsis for the command
-character.
-In addition, the final line and column the cursor rests upon,
-and any options which affect the command are noted.
-.KY <control-A>
-.IP "[count] <control-A>"
-Search forward
-.LI count
-times for the current word.
-The current word begins at the first non-whitespace character on or
-after the current cursor position,
-and extends up to the next non-word character or the end of the line.
-The search is literal, i.e. no characters in the word have any special
-meaning in terms of Regular Expressions.
-It is an error if no matching pattern is found between the starting position
-and the end of the file.
-.sp
-The
-.CO <control-A>
-command is an absolute movement.
-The
-.CO <control-A>
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Set to the line where the word is found.
-.SP Column:
-Set to the first character of the word.
-.SP Options:
-Affected by the
-.OP ignorecase
-and
-.OP wrapscan
-options.
-.SE
-.KY <control-B>
-.IP "[count] <control-B>"
-Page backward
-.LI count
-screens.
-Two lines of overlap are maintained, if possible,
-by displaying the window starting at line
-.LI "(top_line - count * window_size) + 2" ,
-where
-.LI window_size
-is the value of the
-.OP window
-option.
-(In the case of split screens, this size is corrected to the
-current screen size.)
-It is an error if the movement is past the beginning of the file.
-.SS
-.SP Line:
-Set to the last line of text displayed on the screen.
-.SP Column:
-Set to the first nonblank character of the line.
-.SP Options:
-Affected by the
-.OP window
-option.
-.SE
-.KY <control-D>
-.IP "[count] <control-D>"
-Scroll forward
-.LI count
-lines.
-If
-.LI count
-is not specified, scroll forward the number of lines specified by the last
-.CO <control-D>
-or
-.CO <control-U>
-command.
-If this is the first
-.CO <control-D>
-or
-.CO <control-U>
-command,
-scroll forward half the number of lines in the screen.
-(In the case of split screens, the default scrolling distance is
-corrected to half the current screen size.)
-It is an error if the movement is past the end of the file.
-.SS
-.SP Line:
-Set to the current line plus the number of lines scrolled.
-.SP Column:
-Set to the first nonblank character of the line.
-.SP Options:
-None.
-.SE
-.KY <control-E>
-.IP "[count] <control-E>"
-Scroll forward
-.LI count
-lines, leaving the cursor on the current line and column, if possible.
-It is an error if the movement is past the end of the file.
-.SS
-.SP Line:
-Unchanged unless the current line scrolls off the screen,
-in which case it is set to the first line on the screen.
-.SP Column:
-Unchanged unless the current line scrolls off the screen,
-in which case it is set to the most attractive cursor position.
-.SP Options:
-None.
-.SE
-.KY <control-F>
-.IP "[count] <control-F>"
-Page forward
-.LI count
-screens.
-Two lines of overlap are maintained, if possible,
-by displaying the window starting at line
-.LI "top_line + count * window_size - 2" ,
-where
-.LI window_size
-is the value of the
-.OP window
-option.
-(In the case of split screens, this size is corrected to the
-current screen size.)
-It is an error if the movement is past the end of the file.
-.SS
-.SP Line:
-Set to the first line on the screen.
-.SP Column:
-Set to the first nonblank character of the current line.
-.SP Options:
-Affected by the
-.OP window
-option.
-.SE
-.KY <control-G>
-.IP "<control-G>"
-Display the file information.
-The information includes the current pathname, the current line,
-the number of total lines in the file, the current line as a percentage
-of the total lines in the file, if the file has been modified,
-was able to be locked, if the file's name has been changed,
-and if the edit session is read-only.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY <control-H>
-.IP "[count] <control-H>"
-.Ip "[count] h"
-Move the cursor back
-.LI count
-characters in the current line.
-It is an error if the cursor is on the first character in the line.
-.sp
-The
-.CO <control-H>
-and
-.CO h
-commands may be used as the motion component of other
-.CO vi
-commands,
-in which case any text copied into a buffer is character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the
-.LI "current - count"
-character, or, the first character in the line if
-.LI count
-is greater than or equal to the number of characters in the line
-before the cursor.
-.SP Options:
-None.
-.SE
-.KY <control-J>
-.IP "[count] <control-J>"
-.KY <control-N>
-.Ip "[count] <control-N>"
-.KY j
-.Ip "[count] j"
-Move the cursor down
-.LI count
-lines without changing the current column.
-It is an error if the movement is past the end of the file.
-.sp
-The
-.CO <control-J> ,
-.CO <control-N>
-and
-.CO j
-commands may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.SS
-.SP Line:
-Set to the current line plus
-.LI count .
-.SP Column:
-The most attractive cursor position.
-.SP Options:
-None.
-.SE
-.KY <control-L>
-.IP "<control-L>"
-.KY <control-R>
-.Ip "<control-R>"
-Repaint the screen.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY <control-M>
-.IP "[count] <control-M>"
-.KY +
-.Ip "[count] +"
-Move the cursor down
-.LI count
-lines to the first nonblank character of that line.
-It is an error if the movement is past the end of the file.
-.sp
-The
-.CO <control-M>
-and
-.CO +
-commands may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.SS
-.SP Line:
-Set to the current line plus
-.LI count .
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-None.
-.SE
-.KY <control-P>
-.IP "[count] <control-P>"
-.KY k
-.Ip "[count] k"
-Move the cursor up
-.LI count
-lines, without changing the current column.
-It is an error if the movement is past the beginning of the file.
-.sp
-The
-.CO <control-P>
-and
-.CO k
-commands may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.SS
-.SP Line:
-Set to the current line minus
-.LI count .
-.SP Column:
-The most attractive cursor position.
-.SP Options:
-None.
-.SE
-.KY <control-T>
-.IP "<control-T>"
-Return to the most recent tag context.
-The
-.CO <control-T>
-command is an absolute movement.
-.SS
-.SP Line:
-Set to the context of the previous tag command.
-.SP Column:
-Set to the context of the previous tag command.
-.SP Options:
-None.
-.SE
-.KY <control-U>
-.IP "[count] <control-U>"
-Scroll backward
-.LI count
-lines.
-If
-.LI count
-is not specified, scroll backward the number of lines specified by the
-last
-.CO <control-D>
-or
-.CO <control-U>
-command.
-If this is the first
-.CO <control-D>
-or
-.CO <control-U>
-command,
-scroll backward half the number of lines in the screen.
-(In the case of split screens, the default scrolling distance is
-corrected to half the current screen size.)
-It is an error if the movement is past the beginning of the file.
-.SS
-.SP Line:
-Set to the current line minus the amount scrolled.
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-None.
-.SE
-.KY <control-W>
-.IP "<control-W>"
-Switch to the next lower screen in the window, or, to the first
-screen if there are no lower screens in the window.
-.SS
-.SP Line:
-Set to the previous cursor position in the window.
-.SP Column:
-Set to the previous cursor position in the window.
-.SP Options:
-None.
-.SE
-.KY <control-Y>
-.IP "[count] <control-Y>"
-Scroll backward
-.LI count
-lines, leaving the current line and column as is, if possible.
-It is an error if the movement is past the beginning of the file.
-.SS
-.SP Line:
-Unchanged unless the current line scrolls off the screen,
-in which case it is set to the last line of text displayed
-on the screen.
-.SP Column:
-Unchanged unless the current line scrolls off the screen,
-in which case it is the most attractive cursor position.
-.SP Options:
-None.
-.SE
-.KY <control-Z>
-.IP "<control-Z>"
-Suspend the current editor session.
-If the file has been modified since it was last completely written,
-and the
-.OP autowrite
-option is set, the file is written before the editor session is
-suspended.
-If this write fails, the editor session is not suspended.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Unchanged.
-.SP Options:
-Affected by the
-.OP autowrite
-option.
-.SE
-.KY <escape>
-.IP "<escape>"
-Execute
-.CO ex
-commands or cancel partial commands.
-If an
-.CO ex
-command is being entered (e.g.
-.CO / ,
-.CO ? ,
-.CO :
-or
-.CO ! ),
-the command is executed.
-If a partial command has been entered, e.g.
-.QT "[0-9]*" ,
-or
-.QT "[0-9]*[!<>cdy]" ,
-the command is cancelled.
-Otherwise, it is an error.
-.SS
-.SP Line:
-When an
-.CO ex
-command is being executed, the current line is set as described for
-that command.
-Otherwise, unchanged.
-.SP Column:
-When an
-.CO ex
-command is being executed, the current column is set as described for
-that command.
-Otherwise, unchanged.
-.SP Options:
-None.
-.SE
-.KY <control-]>
-.IP "<control-]>"
-Push a tag reference onto the tag stack.
-The tags files (see the
-.OP tags
-option for more information) are searched for a tag matching the
-current word.
-The current word begins at the first non-whitespace character on or
-after the current cursor position,
-and extends up to the next non-word character or the end of the line.
-If a matching tag is found, the current file is discarded and the
-file containing the tag reference is edited.
-.sp
-If the current file has been modified since it was last completely
-written, the command will fail.
-The
-.CO <control-]>
-command is an absolute movement.
-.SS
-.SP Line:
-Set to the line containing the matching tag string.
-.SP Column:
-Set to the start of the matching tag string.
-.SP Options:
-Affected by the
-.OP tags
-and
-.OP taglength
-options.
-.SE
-.KY <control-^>
-.IP "<control-^>"
-Switch to the most recently edited file.
-.sp
-If the file has been modified since it was last completely written,
-and the
-.OP autowrite
-option is set, the file is written out.
-If this write fails, the command will fail.
-Otherwise, if the current file has been modified since it was last
-completely written, the command will fail.
-.SS
-.SP Line:
-Set to the line the cursor was on when the file was last edited.
-.SP Column:
-Set to the column the cursor was on when the file was last edited.
-.SP Options:
-Affected by the
-.OP autowrite
-option.
-.SE
-.KY <space>
-.IP "[count] <space>"
-.KY l
-.Ip "[count] l"
-Move the cursor forward
-.LI count
-characters without changing the current line.
-It is an error if the cursor is on the last character in the line.
-.sp
-The
-.CO <space>
-and
-.CO \&l
-commands may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-In addition, these commands may be used as the motion components
-of other commands when the cursor is on the last character in the
-line, without error.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the current character plus the next
-.LI count
-characters, or to the last character on the line if
-.LI count
-is greater than the number of characters in the line after the
-current character.
-.SP Options:
-None.
-.SE
-.KY !
-.IP "[count] ! motion shell-argument(s)<carriage-return>"
-Replace text with results from a shell command.
-Pass the lines specified by the
-.LI count
-and
-.LI motion
-arguments as standard input to the program named by the
-.OP shell
-option, and replace those lines with the output (both
-standard error and standard output) of that command.
-.sp
-After the motion is entered,
-.CO vi
-prompts for arguments to the shell command.
-.sp
-Within those arguments,
-.QT %
-and
-.QT #
-characters are expanded to the current and alternate pathnames,
-respectively.
-The
-.QT !
-character is expanded with the command text of the previous
-.CO !
-or
-.CO :!
-commands.
-(Therefore, the command
-.CO !<motion>!
-repeats the previous
-.CO !
-command.)
-The special meanings of
-.QT % ,
-.QT #
-and
-.QT !
-can be overridden by escaping them with a backslash.
-If no
-.CO !
-or
-.CO :!
-command has yet been executed,
-it is an error to use an unescaped
-.QT !
-character as a shell argument.
-The
-.CO !
-command does
-.i not
-do shell expansion on the strings provided as arguments.
-If any of the above expansions change the arguments the user entered,
-the command is redisplayed at the bottom of the screen.
-.sp
-.CO Vi
-then executes the program named by the
-.OP shell
-option, with a
-.b \-c
-flag followed by the arguments (which are bundled into a single argument).
-.sp
-The
-.CO !
-command is permitted in an empty file.
-.sp
-If the file has been modified since it was last completely written,
-the
-.CO !
-command will warn you.
-.SS
-.SP Line:
-The first line of the replaced text.
-.SP Column:
-The first column of the replaced text.
-.SP Options:
-Affected by the
-.OP shell
-option.
-.SE
-.KY #
-.IP "[count] # #|+|-"
-Increment or decrement the number referenced by the cursor.
-If the trailing character is a
-.LI \&+
-or
-.LI \&# ,
-the number is incremented by
-.LI count .
-If the trailing character is a
-.LI \&- ,
-the number is decremented by
-.LI count .
-.sp
-A leading
-.QT \&0X
-or
-.QT \&0x
-causes the number to be interpreted as a hexadecimal number.
-Otherwise, a leading
-.QT \&0
-causes the number to be interpreted as an octal number, unless a non-octal
-digit is found as part of the number.
-Otherwise, the number is interpreted as a decimal number, and may
-have a leading
-.LI \&+
-or
-.LI \&-
-sign.
-The current number begins at the first non-blank character at or after
-the current cursor position, and extends up to the end of the line or
-the first character that isn't a possible character for the numeric type.
-The format of the number (e.g. leading 0's, signs) is retained unless
-the new value cannot be represented in the previous format.
-.sp
-Octal and hexadecimal numbers, and the result of the operation, must fit
-into an
-.QT "unsigned long" .
-Similarly, decimal numbers and their result must fit into a
-.QT "signed long" .
-It is an error to use this command when the cursor is not positioned at
-a number.
-.sp
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the first character in the cursor number.
-.SP Options:
-None.
-.SE
-.KY $
-.IP "[count] $"
-Move the cursor to the end of a line.
-If
-.LI count
-is specified, the cursor moves down
-.LI "count - 1"
-lines.
-.sp
-It is not an error to use the
-.CO $
-command when the cursor is on the last character in the line or
-when the line is empty.
-.sp
-The
-.CO $
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented, unless the cursor is at, or before the first
-nonblank character in the line, in which case it is line oriented.
-It is not an error to use the
-.CO $
-command as a motion component when the cursor is on the last character
-in the line, although it is an error when the line is empty.
-.SS
-.SP Line:
-Set to the current line plus
-.LI count
-minus 1.
-.SP Column:
-Set to the last character in the line.
-.SP Options:
-None.
-.SE
-.KY %
-.IP %
-Move to the matching character.
-The cursor moves to the parenthesis or curly brace which
-.i matches
-the parenthesis or curly brace found at the current cursor position
-or which is the closest one to the right of the cursor on the line.
-It is an error to execute the
-.CO %
-command on a line without a parenthesis or curly brace.
-Historically, any
-.LI count
-specified to the
-.CO %
-command was ignored.
-.sp
-The
-.CO %
-command is an absolute movement.
-The
-.CO %
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented, unless the starting point of the region is at
-or before the first nonblank character on its line, and the ending
-point is at or after the last nonblank character on its line, in
-which case it is line oriented.
-.SS
-.SP Line:
-Set to the line containing the matching character.
-.SP Column:
-Set to the matching character.
-.SP Options:
-None.
-.SE
-.KY &
-.IP "&"
-Repeat the previous substitution command on the current line.
-.sp
-Historically, any
-.LI count
-specified to the
-.CO &
-command was ignored.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Unchanged if the cursor was on the last character in the line,
-otherwise, set to the first nonblank character in the line.
-.SP Options:
-Affected by the
-.OP edcompatible ,
-.OP extended ,
-.OP ignorecase
-and
-.OP magic
-options.
-.SE
-.KY SQUOTE<character>
-.IP \'<character>
-.KY `<character>
-.Ip `<character>
-Return to a context marked by the character
-.LI <character> .
-If
-.LI <character>
-is the
-.QT '
-or
-.QT `
-character, return to the previous context.
-If
-.LI <character>
-is any other character,
-return to the context marked by that character (see the
-.CO m
-command for more information).
-If the command is the
-.CO \'
-command, only the line value is restored,
-and the cursor is placed on the first nonblank character of that line.
-If the command is the
-.CO `
-command, both the line and column values are restored.
-.sp
-It is an error if the context no longer exists because of
-line deletion.
-(Contexts follow lines that are moved, or which are deleted
-and then restored.)
-.sp
-The
-.CO \'
-and
-.CO `
-commands are both absolute movements.
-They may be used as a motion component for other
-.CO vi
-commands.
-For the
-.CO \'
-command, any text copied into a buffer is line oriented.
-For the
-.CO `
-command,
-any text copied into a buffer is character oriented,
-unless it both starts and stops at the first character in the line,
-in which case it is line oriented.
-In addition, when using the
-.CO `
-command as a motion component,
-commands which move backward and started at the first character in the line,
-or move forward and ended at the first character in the line,
-are corrected to the last character of the line preceding the starting and
-ending lines, respectively.
-.SS
-.SP Line:
-Set to the line from the context.
-.SP Column:
-Set to the first nonblank character in the line, for the
-.CO \'
-command, and set to the context's column for the
-.CO `
-command.
-.SP Options:
-None.
-.SE
-.KY (
-.IP "[count] ("
-Back up
-.LI count
-sentences.
-.sp
-The
-.CO (
-command is an absolute movement.
-The
-.CO (
-command may be used as the motion component of other
-.CO vi
-commands,
-in which case any text copied into a buffer is character oriented,
-unless the starting and stopping points of the region are the first
-character in the line,
-in which case it is line oriented.
-If it is line oriented,
-the starting point of the region is adjusted to be the end of the line
-immediately before the starting cursor position.
-.SS
-.SP Line:
-Set to the line containing the beginning of the sentence.
-.SP Column:
-Set to the first nonblank character of the sentence.
-.SP Options:
-Affected by the
-.OP lisp
-option.
-.SE
-.KY )
-.IP "[count] )"
-Move forward
-.LI count
-sentences.
-.sp
-The
-.CO )
-command is an absolute movement.
-The
-.CO )
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented, unless the starting point of the region is the
-first character in the line, in which case it is line oriented.
-In the latter case, if the stopping point of the region is also
-the first character in the line, it is adjusted to be the end of the
-line immediately before it.
-.SS
-.SP Line:
-Set to the line containing the beginning of the sentence.
-.SP Column:
-Set to the first nonblank character of the sentence.
-.SP Options:
-Affected by the
-.OP lisp
-option.
-.SE
-.KY ,
-.IP "[count] ,"
-Reverse find character
-.LI count
-times.
-Reverse the last
-.CO F ,
-.CO f ,
-.CO T
-or
-.CO t
-command, searching the other way in the line,
-.LI count
-times.
-It is an error if a
-.CO F ,
-.CO f ,
-.CO T
-or
-.CO t
-command has not been performed yet.
-.sp
-The
-.CO ,
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the searched-for character for the
-.CO F
-and
-.CO f
-commands,
-before the character for the
-.CO t
-command
-and after the character for the
-.CO T
-command.
-.SP Options:
-None.
-.SE
-.KY MINUSSIGN
-.IP "[count] \-"
-Move to the first nonblank of the previous line,
-.LI count
-times.
-.sp
-It is an error if the movement is past the beginning of the file.
-.sp
-The
-.CO -
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.SS
-.SP Line:
-Set to the current line minus
-.LI count .
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-None.
-.SE
-.KY \&.
-.IP "[count] \&."
-Repeat the last
-.CO vi
-command that modified text.
-The repeated command may be a command and motion component combination.
-If
-.LI count
-is specified, it replaces
-.i both
-the count specified for the repeated command, and, if applicable, for
-the repeated motion component.
-If
-.LI count
-is not specified, the counts originally specified to the command being
-repeated are used again.
-.sp
-As a special case, if the
-.CO \.
-command is executed immediately after the
-.CO u
-command, the change log is rolled forward or backward, depending on
-the action of the
-.CO u
-command.
-.SS
-.SP Line:
-Set as described for the repeated command.
-.SP Column:
-Set as described for the repeated command.
-.SP Options:
-None.
-.SE
-.KY /RE/
-.IP "/RE<carriage-return>"
-.Ip "/RE/ [offset]<carriage-return>"
-.KY ?RE?
-.Ip "?RE<carriage-return>"
-.Ip "?RE? [offset]<carriage-return>"
-.KY N
-.Ip "N"
-.KY n
-.Ip "n"
-Search forward or backward for a regular expression.
-The commands beginning with a slash
-.PQ /
-character are forward searches, the commands beginning with a
-question mark
-.PQ ?
-are backward searches.
-.CO Vi
-prompts with the leading character on the last line of the screen
-for a string.
-It then searches forward or backward in the file for the next
-occurrence of the string, which is interpreted as a Basic Regular
-Expression.
-.sp
-The
-.CO /
-and
-.CO ?
-commands are absolute movements.
-They may be used as the motion components of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented, unless the search started and ended on
-the first column of a line, in which case it is line oriented.
-In addition, forward searches ending at the first character of a line,
-and backward searches beginning at the first character in the line,
-are corrected to begin or end at the last character of the previous line.
-(Note, forward and backward searches can occur for both
-.CO /
-and
-.CO ?
-commands, if the
-.OP wrapscan
-option is set.)
-.sp
-If an offset from the matched line is specified (i.e. a trailing
-.QT /
-or
-.QT ?
-character is followed by a signed offset), the buffer will always
-be line oriented (e.g.
-.QT /string/+0
-will always guarantee a line orientation).
-.sp
-The
-.CO N
-command repeats the previous search, but in the reverse direction.
-The
-.CO n
-command repeats the previous search.
-If either the
-.CO N
-or
-.CO n
-commands are used as motion components for the
-.CO !
-command, you will not be prompted for the text of the bang command,
-instead the previous bang command will be executed.
-.sp
-Missing RE's (e.g.
-.QT //<carriage-return> ,
-.QT /<carriage-return> ,
-.QT ??<carriage-return> ,
-or
-.QT ?<carriage-return>
-search for the last search RE, in the indicated direction.
-.sp
-Searches may be interrupted using the
-.LI <interrupt>
-character.
-.sp
-Multiple search patterns may be grouped together by delimiting
-them with semicolons and zero or more whitespace characters, e.g.
-.LI "/foo/ ; ?bar?"
-searches forward for
-.LI foo
-and then, from that location, backwards for
-.LI bar .
-When search patterns are grouped together in this manner,
-the search patterns are evaluated left to right with the
-final cursor position determined by the last search pattern.
-.sp
-It is also permissible to append a
-.CO z
-command to the search strings, e.g.
-.LI "/foo/ z."
-searches forward for the next occurrence of
-.LI foo ,
-and then positions that line in the middle of screen.
-.SS
-.SP Line:
-Set to the line in which the match occurred.
-.SP Column:
-Set to the first character of the matched string.
-.SP Options:
-Affected by the
-.OP edcompatible ,
-.OP extended ,
-.OP ignorecase ,
-.OP magic ,
-and
-.OP wrapscan
-options.
-.SE
-.KY 0
-.IP "0"
-Move to the first character in the current line.
-It is not an error to use the
-.CO 0
-command when the cursor is on the first character in the line,
-.sp
-The
-.CO 0
-command may be used as the motion component of other
-.CO vi
-commands,
-in which case it is an error if the cursor is on the first character
-in the line,
-and any text copied into a buffer is character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the first character in the line.
-.SP Options:
-None.
-.SE
-.KY :
-.IP ":"
-Execute an
-.CO ex
-command.
-.CO Vi
-prompts for an
-.CO ex
-command on the last line of the screen, using a colon
-.PQ :
-character.
-The command is terminated by a
-.LI <carriage-return> ,
-.LI <newline>
-or
-.LI <escape>
-character; all of these characters may be escaped by using a
-.LI "<literal-next>"
-character.
-The command is then executed.
-.sp
-If the
-.CO ex
-command writes to the screen,
-.CO vi
-will prompt the user for a
-.LI <carriage-return>
-before continuing
-when the
-.CO ex
-command finishes.
-Large amounts of output from the
-.CO ex
-command will be paged for the user, and the user prompted for a
-.LI <carriage-return>
-or
-.LI <space>
-key to continue.
-In some cases, a quit (normally a
-.QQ q
-character) or
-.LI <interrupt>
-may be entered to interrupt the
-.CO ex
-command.
-.sp
-When the
-.CO ex
-command finishes, and the user is prompted to resume visual mode,
-it is also possible to enter another
-.QT :
-character followed by another
-.CO ex
-command.
-.SS
-.SP Line:
-The current line is set as described for the
-.CO ex
-command.
-.SP Column:
-The current column is set as described for the
-.CO ex
-command.
-.SP Options:
-Affected as described for the
-.CO ex
-command.
-.SE
-.KY ;
-.IP "[count] ;"
-Repeat the last character find
-.LI count
-times.
-The last character find is one of the
-.CO F ,
-.CO f ,
-.CO T
-or
-.CO t
-commands.
-It is an error if a
-.CO F ,
-.CO f ,
-.CO T
-or
-.CO t
-command has not been performed yet.
-.sp
-The
-.CO ;
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the searched-for character for the
-.CO F
-and
-.CO f
-commands,
-before the character for the
-.CO t
-command
-and after the character for the
-.CO T
-command.
-.SP Options:
-None.
-.SE
-.KY <
-.IP "[count] < motion"
-.KY >
-.Ip "[count] > motion"
-Shift lines left or right.
-Shift the number of lines in the region specified by the
-.LI count
-and
-.LI motion
-left (for the
-.CO <
-command) or right (for the
-.CO >
-command) by the number of columns specified by the
-.OP shiftwidth
-option.
-Only whitespace characters are deleted when shifting left.
-Once the first character in the line no longer contains a whitespace
-character, the command will succeed,
-but the line will not be modified.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-Affected by the
-.OP shiftwidth
-option.
-.SE
-.KY @
-.IP "@ buffer"
-Execute a named buffer.
-Execute the named buffer as
-.CO vi
-commands.
-The buffer may include
-.CO ex
-commands, too, but they must be expressed as a
-.CO :
-command.
-If the buffer is line oriented,
-.LI <newline>
-characters are logically appended to each line of the buffer.
-If the buffer is character oriented,
-.LI <newline>
-characters are logically appended to all but the last line in the buffer.
-.sp
-If the buffer name is
-.QT @ ,
-or
-.QT * ,
-then the last buffer executed shall be used.
-It is an error to specify
-.QT @@
-or
-.QT @*
-if there were no previous buffer executions.
-The text of a buffer may contain a
-.CO @
-command,
-and it is possible to create infinite loops in this manner.
-(The
-.LI <interrupt>
-character may be used to interrupt the loop.)
-.SS
-.SP Line:
-The current line is set as described for the command(s).
-.SP Column:
-The current column is set as described for the command(s).
-.SP Options:
-None.
-.SE
-.KY A
-.IP "[count] A"
-Enter input mode, appending the text after the end of the line.
-If
-.LI count
-is specified, the text is repeatedly input
-.LI "count - 1"
-more times after input mode is exited.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY B
-.IP "[count] B"
-Move backward
-.LI count
-bigwords.
-Move the cursor backward to the beginning of a bigword by repeating the
-following algorithm: if the current position is at the beginning of a
-bigword or the character at the current position cannot be part of a bigword,
-move to the first character of the preceding bigword.
-Otherwise, move to the first character of the bigword at the current position.
-If no preceding bigword exists on the current line, move to the first
-character of the last bigword on the first preceding line that contains a
-bigword.
-.sp
-The
-.CO B
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Set to the line containing the word selected.
-.SP Column:
-Set to the first character of the word selected.
-.SP Options:
-None.
-.SE
-.KY C
-.IP "[buffer] [count] C"
-Change text from the current position to the end-of-line.
-If
-.LI count
-is specified, the input text replaces from the current position to
-the end-of-line, plus
-.LI "count - 1"
-subsequent lines.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY D
-.IP "[buffer] D"
-Delete text from the current position to the end-of-line.
-.sp
-It is not an error to execute the
-.CO D
-command on an empty line.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the character before the current character, or, column 1 if
-the cursor was on column 1.
-.SP Options:
-None.
-.SE
-.KY E
-.IP "[count] E"
-Move forward
-.LI count
-end-of-bigwords.
-Move the cursor forward to the end of a bigword by repeating the
-following algorithm: if the current position is the end of a
-bigword or the character at that position cannot be part of a bigword,
-move to the last character of the following bigword.
-Otherwise, move to the last character of the bigword at the current
-position.
-If no succeeding bigword exists on the current line,
-move to the last character of the first bigword on the next following
-line that contains a bigword.
-.sp
-The
-.CO E
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Set to the line containing the word selected.
-.SP Column:
-Set to the last character of the word selected.
-.SP Options:
-None.
-.SE
-.KY F
-.IP "[count] F <character>"
-Search
-.LI count
-times backward through the current line for
-.LI <character> .
-.sp
-The
-.CO F
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the searched-for character.
-.SP Options:
-None.
-.SE
-.KY G
-.IP "[count] G"
-Move to line
-.LI count ,
-or the last line of the file if
-.LI count
-not specified.
-.sp
-The
-.CO G
-command is an absolute movement.
-The
-.CO \&G
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.SS
-.SP Line:
-Set to
-.LI count ,
-if specified, otherwise, the last line.
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-None.
-.SE
-.KY H
-.IP "[count] H"
-Move to the screen line
-.LI "count - 1"
-lines below the top of the screen.
-.sp
-The
-.CO H
-command is an absolute movement.
-The
-.CO H
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.SS
-.SP Line:
-Set to the line
-.LI "count - 1"
-lines below the top of the screen.
-.SP Column:
-Set to the first nonblank character of the
-.i screen
-line.
-.SP Options:
-None.
-.SE
-.KY I
-.IP "[count] I"
-Enter input mode, inserting the text at the beginning of the line.
-If
-.LI count
-is specified, the text input is repeatedly input
-.LI "count - 1"
-more times.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-None.
-.SE
-.KY J
-.IP "[count] J"
-Join lines.
-If
-.LI count
-is specified,
-.LI count
-lines are joined; a minimum of two lines are always joined,
-regardless of the value of
-.LI count .
-.sp
-If the current line ends with a whitespace character, all whitespace
-is stripped from the next line.
-Otherwise, if the next line starts with a open parenthesis
-.PQ (
-do nothing.
-Otherwise, if the current line ends with a question mark
-.PQ ? ,
-period
-.PQ \&.
-or exclamation point
-.PQ ! ,
-insert two spaces.
-Otherwise, insert a single space.
-.sp
-It is not an error to join lines past the end of the file,
-i.e. lines that do not exist.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the character after the last character of the next-to-last
-joined line.
-.SP Options:
-None.
-.SE
-.KY L
-.IP "[count] L"
-Move to the screen line
-.LI "count - 1"
-lines above the bottom of the screen.
-.sp
-The
-.CO L
-command is an absolute movement.
-The
-.CO L
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.SS
-.SP Line:
-Set to the line
-.LI "count - 1"
-lines above the bottom of the screen.
-.SP Column:
-Set to the first nonblank character of the
-.i screen
-line.
-.SP Options:
-None.
-.SE
-.KY M
-.IP " M"
-Move to the screen line in the middle of the screen.
-.sp
-The
-.CO M
-command is an absolute movement.
-The
-.CO M
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.sp
-Historically, any
-.LI count
-specified to the
-.CO M
-command was ignored.
-.SS
-.SP Line:
-Set to the line in the middle of the screen.
-.SP Column:
-Set to the first nonblank character of the
-.i screen
-line.
-.SP Options:
-None.
-.SE
-.KY O
-.IP "[count] O"
-Enter input mode, appending text in a new line above the current line.
-If
-.LI count
-is specified, the text input is repeatedly input
-.LI "count - 1"
-more times.
-.sp
-Historically, any
-.LI count
-specified to the
-.CO O
-command was ignored.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY P
-.IP "[buffer] P"
-Insert text from a buffer.
-Text from the buffer (the unnamed buffer by default) is inserted
-before the current column or, if the buffer is line oriented,
-before the current line.
-.SS
-.SP Line:
-Set to the lowest numbered line insert,
-if the buffer is line oriented, otherwise unchanged.
-.SP Column:
-Set to the first nonblank character of the appended text,
-if the buffer is line oriented, otherwise, the last character
-of the appended text.
-.SP Options:
-None.
-.SE
-.KY Q
-.IP "Q"
-Exit
-.CO vi
-(or visual) mode and switch to
-.CO ex
-mode.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-No longer relevant.
-.SP Options:
-None.
-.SE
-.KY R
-.IP "[count] R"
-Enter input mode, replacing the characters in the current line.
-If
-.LI count
-is specified, the text input is repeatedly input
-.LI "count - 1"
-more times.
-.sp
-If the end of the current line is reached, no more characters are
-replaced and any further characters input are appended to the line.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY S
-.IP "[buffer] [count] S"
-Substitute
-.LI count
-lines.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY T
-.IP "[count] T <character>"
-Search backward,
-.LI count
-times,
-through the current line for the character
-.i after
-the specified
-.LI <character> .
-.sp
-The
-.CO T
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the character
-.i after
-the searched-for character.
-.SP Options:
-None.
-.SE
-.KY U
-.IP "U"
-Restore the current line to its state before the cursor last
-moved to it.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-The first character in the line.
-.SP Options:
-None.
-.SE
-.KY W
-.IP "[count] W"
-Move forward
-.LI count
-bigwords.
-Move the cursor forward to the beginning of a bigword by repeating the
-following algorithm: if the current position is within a bigword or the
-character at that position cannot be part of a bigword, move to the first
-character of the next bigword.
-If no subsequent bigword exists on the current line,
-move to the first character of the first bigword on the first following
-line that contains a bigword.
-.sp
-The
-.CO W
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-The line containing the word selected.
-.SP Column:
-The first character of the word selected.
-.SP Options:
-None.
-.SE
-.KY X
-.IP "[buffer] [count] X"
-Delete
-.LI count
-characters before the cursor.
-If the number of characters to be deleted is greater than or equal to
-the number of characters to the beginning of the line, all of the
-characters before the current cursor position, to the beginning of the
-line, are deleted.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the current character minus
-.LI count ,
-or the first character if count is greater than the number of
-characters in the line before the cursor.
-.SP Options:
-None.
-.SE
-.KY Y
-.IP "[buffer] [count] Y"
-Copy (or
-.QQ yank )
-.LI count
-lines into the specified buffer.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY ZZ
-.IP "ZZ"
-Write the file and exit
-.CO vi .
-The file is only written if it has been modified since the last
-complete write of the file to any file.
-.sp
-The
-.CO ZZ
-command will exit the editor after writing the file,
-if there are no further files to edit.
-Entering two
-.QQ quit
-commands (i.e.
-.CO wq ,
-.CO quit ,
-.CO xit
-or
-.CO ZZ )
-in a row will override this check and the editor will exit,
-ignoring any files that have not yet been edited.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY [[
-.IP "[count] [["
-Back up
-.LI count
-section boundaries.
-.sp
-The
-.CO [[
-command is an absolute movement.
-The
-.CO [[
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented, unless the starting position is column 0,
-in which case it is line oriented.
-.sp
-It is an error if the movement is past the beginning of the file.
-.SS
-.SP Line:
-Set to the previous line that is
-.LI count
-section boundaries back,
-or the first line of the file if no more section boundaries exist
-preceding the current line.
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-Affected by the
-.OP sections
-option.
-.SE
-.KY ]]
-.IP "[count] ]]"
-Move forward
-.LI count
-section boundaries.
-.sp
-The
-.CO ]]
-command is an absolute movement.
-The
-.CO ]]
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented, unless the starting position is column 0,
-in which case it is line oriented.
-.sp
-It is an error if the movement is past the end of the file.
-.SS
-.SP Line:
-Set to the line that is
-.LI count
-section boundaries forward,
-or to the last line of the file if no more section
-boundaries exist following the current line.
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-Affected by the
-.OP sections
-option.
-.SE
-.KY ^
-.IP "\&^"
-Move to first nonblank character on the current line.
-.sp
-The
-.CO ^
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the first nonblank character of the current line.
-.SP Options:
-None.
-.SE
-.KY _
-.IP "[count] _"
-Move down
-.LI "count - 1"
-lines, to the first nonblank character.
-The
-.CO _
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-line oriented.
-.sp
-It is not an error to execute the
-.CO _
-command when the cursor is on the first character in the line.
-.SS
-.SP Line:
-The current line plus
-.LI "count - 1" .
-.SP Column:
-The first nonblank character in the line.
-.SP Options:
-None.
-.SE
-.KY a
-.IP "[count] a"
-Enter input mode, appending the text after the cursor.
-If
-.LI count
-is specified, the text input is repeatedly input
-.LI "count - 1"
-more times.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY b
-.IP "[count] b"
-Move backward
-.LI count
-words.
-Move the cursor backward to the beginning of a word by repeating the
-following algorithm: if the current position is at the beginning of a word,
-move to the first character of the preceding word.
-Otherwise, the current position moves to the first character of the word
-at the current position.
-If no preceding word exists on the current line, move to the first
-character of the last word on the first preceding line that contains
-a word.
-.sp
-The
-.CO b
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Set to the line containing the word selected.
-.SP Column:
-Set to the first character of the word selected.
-.SP Options:
-None.
-.SE
-.KY c
-.IP "[buffer] [count] c motion"
-Change the region of text specified by the
-.LI count
-and
-.LI motion .
-If only part of a single line is affected, then the last character
-being changed is marked with a
-.QT $ .
-Otherwise, the region of text is deleted, and input mode is entered.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY d
-.IP "[buffer] [count] d motion"
-Delete the region of text specified by the
-.LI count
-and
-.LI motion .
-.SS
-.SP Line:
-Set to the line where the region starts.
-.SP Column:
-Set to the first character in the line after the last character in the
-region.
-If no such character exists, set to the last character before the region.
-.SP Options:
-None.
-.SE
-.KY e
-.IP "[count] e"
-Move forward
-.LI count
-end-of-words.
-Move the cursor forward to the end of a word by repeating the following
-algorithm: if the current position is the end of a word,
-move to the last character of the following word.
-Otherwise, move to the last character of the word at the current position.
-If no succeeding word exists on the current line, move to the last character
-of the first word on the next following line that contains a word.
-.sp
-The
-.CO e
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Set to the line containing the word selected.
-.SP Column:
-Set to the last character of the word selected.
-.SP Options:
-None.
-.SE
-.KY f
-.IP "[count] f <character>"
-Search forward,
-.LI count
-times, through the rest of the current line for
-.LI <character> .
-.sp
-The
-.CO f
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the searched-for character.
-.SP Options:
-None.
-.SE
-.KY i
-.IP "[count] i"
-Enter input mode, inserting the text before the cursor.
-If
-.LI count
-is specified, the text input is repeatedly input
-.LI "count - 1"
-more times.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY m
-.IP "m <character>"
-Save the current context (line and column) as
-.LI <character> .
-The exact position is referred to by
-.QT `<character> .
-The line is referred to by
-.QT '<character> .
-.sp
-Historically,
-.LI <character>
-was restricted to lower-case letters.
-.CO Nvi
-permits the use of any character.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Unchanged.
-.SP Options:
-None.
-.SE
-.KY o
-.IP "[count] o"
-Enter input mode, appending text in a new line under the current line.
-If
-.LI count
-is specified, the text input is repeatedly input
-.LI "count - 1"
-more times.
-.sp
-Historically, any
-.LI count
-specified to the
-.CO o
-command was ignored.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY p
-.IP "[buffer] p"
-Append text from a buffer.
-Text from the buffer (the unnamed buffer by default) is appended
-after the current column or, if the buffer is line oriented,
-after the current line.
-.SS
-.SP Line:
-Set to the first line appended, if the buffer is line oriented,
-otherwise unchanged.
-.SP Column:
-Set to the first nonblank character of the appended text if the buffer
-is line oriented, otherwise, the last character of the appended text.
-.SP Options:
-None.
-.SE
-.KY r
-.IP "[count] r <character>"
-Replace characters.
-The next
-.LI count
-characters in the line are replaced with
-.LI <character> .
-Replacing characters with
-.LI <newline>
-characters results in creating new, empty lines into the file.
-.sp
-If
-.LI <character>
-is
-.LI <escape> ,
-the command is cancelled.
-.SS
-.SP Line:
-Unchanged unless the replacement character is a
-.LI <newline> ,
-in which case it is set to the current line plus
-.LI "count - 1" .
-.SP Column:
-Set to the last character replaced,
-unless the replacement character is a
-.LI <newline> ,
-in which case the cursor is in column 1 of the last line inserted.
-.SP Options:
-None.
-.SE
-.KY s
-.IP "[buffer] [count] s"
-Substitute
-.LI count
-characters in the current line starting with the current character.
-.SS
-.SP Line:
-Set to the last line upon which characters were entered.
-.SP Column:
-Set to the last character entered.
-.SP Options:
-Affected by the
-.OP altwerase ,
-.OP autoindent ,
-.OP beautify ,
-.OP showmatch ,
-.OP ttywerase
-and
-.OP wrapmargin
-options.
-.SE
-.KY t
-.IP "[count] t <character>"
-Search forward,
-.LI count
-times, through the current line for the character immediately
-.i before
-.LI <character> .
-.sp
-The
-.CO t
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the character
-.i before
-the searched-for character.
-.SP Options:
-None.
-.SE
-.KY u
-.IP "u"
-Undo the last change made to the file.
-If repeated, the
-.CO u
-command alternates between these two states, and is its own inverse.
-When used after an insert that inserted text on more than one line,
-the lines are saved in the numeric buffers.
-.sp
-The
-.CO \&.
-command, when used immediately after the
-.CO u
-command, causes the change log to be rolled forward or backward,
-depending on the action of the
-.CO u
-command.
-.SS
-.SP Line:
-Set to the position of the first line changed, if the reversal affects
-only one line or represents an addition or change; otherwise, the line
-preceding the deleted text.
-.SP Column:
-Set to the cursor position before the change was made.
-.SP Options:
-None.
-.SE
-.KY w
-.IP "[count] w"
-Move forward
-.LI count
-words.
-Move the cursor forward to the beginning of a word by repeating the
-following algorithm: if the current position is at the
-beginning of a word, move to the first character of the next word.
-If no subsequent word exists on the current line, move to the first
-character of the first word on the first following line that contains
-a word.
-.sp
-The
-.CO w
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-.SS
-.SP Line:
-Set to the line containing the word selected.
-.SP Column:
-Set to the first character of the word selected.
-.SP Options:
-None.
-.SE
-.KY x
-.IP "[buffer] [count] x"
-Delete
-.LI count
-characters.
-The deletion is at the current character position.
-If the number of characters to be deleted is greater than or equal to
-the number of characters to the end of the line, all of the characters
-from the current cursor position to the end of the line are deleted.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Unchanged unless the last character in the line is deleted and the cursor
-is not already on the first character in the line, in which case it is
-set to the previous character.
-.SP Options:
-None.
-.SE
-.KY y
-.IP "[buffer] [count] y motion"
-Copy (or
-.QQ yank )
-the text region specified by the
-.LI count
-and
-.LI motion ,
-into a buffer.
-.SS
-.SP Line:
-Unchanged, unless the region covers more than a single line,
-in which case it is set to the line where the region starts.
-.SP Column:
-Unchanged, unless the region covers more than a single line,
-in which case it is set to the character were the region starts.
-.SP Options:
-None.
-.SE
-.KY z
-.IP "[count1] z [count2] type"
-Redraw the screen with a window
-.LI count2
-lines long, with line
-.LI count1
-placed as specified by the
-.LI type
-character.
-If
-.LI count1
-is not specified, it defaults to the current line.
-If
-.LI count2
-is not specified, it defaults to the current window size.
-.sp
-The following
-.LI type
-characters may be used:
-.SS
-.SP +
-If
-.LI count1
-is specified, place the line
-.LI count1
-at the top of the screen.
-Otherwise, display the screen after the current screen, similarly to the
-.CO <control-F>
-command.
-.SP <carriage-return>
-Place the line
-.LI count1
-at the top of the screen.
-.SP \&.
-Place the line
-.LI count1
-in the center of the screen.
-.SP \-
-Place the line
-.LI count1
-at the bottom of the screen.
-.SP ^
-If
-.LI count1
-is specified, place the line that is at the top of the screen
-when
-.LI count1
-is at the bottom of the screen, at the bottom of the screen,
-i.e. display the screen before the screen before
-.LI count1 .
-Otherwise, display the screen before the current screen, similarly to the
-.CO <control-B>
-command.
-.SE
-.SS
-.SP Line:
-Set to
-.LI count1
-unless
-.LI count1
-is not specified and the
-.LI type
-character was either
-.QT ^
-or
-.QT + ,
-in which case it is set to the line before the first line on the
-previous screen or the line after the last line on the previous
-screen, respectively.
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-None.
-.SE
-.KY {
-.IP "[count] {"
-Move backward
-.LI count
-paragraphs.
-.sp
-The
-.CO {
-command is an absolute movement.
-The
-.CO {
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented, unless the starting character is the first
-character on its line, in which case it is line oriented.
-.SS
-.SP Line:
-Set to the line containing the beginning of the previous paragraph.
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-Affected by the
-.OP paragraph
-option.
-.SE
-.KY |
-.IP "[count] |"
-Move to a specific
-.i column
-position on the current line.
-.sp
-The
-.CO |
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented.
-It is an error to use the
-.CO |
-command as a motion component and for the cursor not to move.
-.SS
-.SP Line:
-Unchanged.
-.SP Column:
-Set to the character occupying the column position identified by
-.LI count ,
-if the position exists in the line.
-If the column length of the current line is less than
-.LI count ,
-the cursor is moved to the last character in the line.
-.SP Options:
-None.
-.SE
-.KY }
-.IP "[count] }"
-Move forward
-.LI count
-paragraphs.
-.sp
-The
-.CO }
-command is an absolute movement.
-The
-.CO }
-command may be used as the motion component of other
-.CO vi
-commands, in which case any text copied into a buffer is
-character oriented, unless the starting character is at or
-before any nonblank characters in its line,
-in which case it is line oriented.
-.SS
-.SP Line:
-Set to the line containing the beginning of the next paragraph.
-.SP Column:
-Set to the first nonblank character in the line.
-.SP Options:
-Affected by the
-.OP paragraph
-option.
-.SE
-.KY ~
-.IP "[count] ~"
-Reverse the case of the next
-.LI count
-character(s).
-This is the historic semantic for the
-.CO ~
-command and it is only in effect if the
-.OP tildeop
-option is not set.
-.sp
-Lowercase alphabetic characters are changed to uppercase,
-and uppercase characters are changed to lowercase.
-No other characters are affected.
-.sp
-Historically, the
-.CO ~
-command did not take an associated count, nor did it move past the
-end of the current line.
-As it had no associated motion it was difficult to change the case
-of large blocks of text.
-In
-.CO nvi ,
-if the cursor is on the last character of a line, and there are
-more lines in the file, the cursor moves to the next line.
-.sp
-It is not an error to specify a count larger than the number of
-characters between the cursor and the end of the file.
-.SS
-.SP Line:
-Set to the line of the character after
-.LI count
-characters, or, end of file.
-.SP Column:
-Set to the character after
-.LI count
-characters, or, end-of-file.
-.SP Options:
-Affected by the
-.OP tildeop
-option.
-.SE
-.KY ~
-.IP "[count] ~ motion"
-Reverse the case of the characters in a text region specified by the
-.LI count
-and
-.LI motion .
-Only in effect if the
-.OP tildeop
-option is set.
-.sp
-Lowercase characters are changed to uppercase,
-and uppercase characters are changed to lowercase.
-No other characters are affected.
-.SS
-.SP Line:
-Set to the line of the character after the last character in the region.
-.SP Column:
-Set to the character after the last character in the region.
-.SP Options:
-Affected by the
-.OP tildeop
-option.
-.SE
-.KY <interrupt>
-.IP "<interrupt>"
-Interrupt the current operation.
-Many of the potentially long-running
-.CO vi
-commands may be interrupted using the terminal interrupt character.
-These operations include searches, file reading and writing, filter
-operations and map character expansion.
-Interrupts are also enabled when running commands outside of
-.CO vi .
-.sp
-If the
-.LI <interrupt>
-character is used to interrupt while entering an
-.CO ex
-command, the command is aborted, the cursor returns to its previous
-position, and
-.CO vi
-remains in command mode.
-.sp
-Generally, if the
-.LI <interrupt>
-character is used to interrupt any
-operation, any changes made before the interrupt are left in place.
-.SS
-.SP Line:
-Dependent on the operation being interrupted.
-.SP Column:
-Dependent on the operation being interrupted.
-.SP Options:
-None.
-.SH 1 "Vi Text Input Commands"
-.pp
-The following section describes the commands available in the text
-input mode of the
-.CO vi
-editor.
-.pp
-Historically,
-.CO vi
-implementations only permitted the characters inserted on the current
-line to be erased.
-In addition, only the
-.LI <control-D>
-erase character and the
-.QT 0<control-D>
-and
-.QT ^<control-D>
-erase strings could erase autoindent characters.
-(Autoindent characters include both the characters inserted automatically
-at the beginning of an input line as well as characters inserted using the
-.LI <control-T>
-command.)
-This implementation permits erasure to continue past the beginning
-of the current line, and back to where text input mode was entered.
-In addition, autoindent characters may be erased using the standard
-erase characters.
-For the line and word erase characters, reaching the autoindent
-characters forms a
-.QQ soft
-boundary, denoting the end of the current word or line erase.
-Repeating the word or line erase key will erase the autoindent characters.
-.pp
-Historically,
-.CO vi
-always used
-.LI <control-H>
-and
-.LI <control-W>
-as character and word erase characters, respectively, regardless of
-the current terminal settings.
-This implementation accepts, in addition to these two characters,
-the current terminal characters for those operations.
-.KY <nul>
-.IP "<nul>"
-If the first character of the input is a
-.LI <nul> ,
-the previous input is replayed, as if just entered.
-.KY <control-D>
-.IP "<control-D>"
-If the previous character on the line was an autoindent character,
-erase characters to move the cursor back to the column immediately
-after the previous (1-based) column which is a multiple of the
-.OP shiftwidth
-edit option.
-This may result in any number of
-.LI <tab>
-and
-.LI <space>
-characters preceding the cursor being changed.
-.sp
-Otherwise, if the
-.OP autoindent
-option is set and the user is entering the first character in the line,
-.LI <control-D>
-is ignored.
-Otherwise, a literal
-.LI <control-D>
-character is entered.
-.KY ^<control-D>
-.IP "^<control-D>"
-If the previous character on the line was an autoindent character,
-erase all of the autoindent characters on the line.
-In addition, the autoindent level is reset to 0.
-.KY 0<control-D>
-.IP "0<control-D>"
-If the previous character on the line was an autoindent character,
-erase all of the autoindent characters on the line.
-The autoindent level is not altered.
-.KY <control-T>
-.IP "<control-T>"
-Insert sufficient
-.LI <tab>
-and
-.LI <space>
-characters to move the cursor forward to the column immediately
-after the next (1-based) column which is a multiple of the
-.OP shiftwidth
-edit option.
-This may result in any number of
-.LI <tab>
-and
-.LI <space>
-characters preceding the cursor being changed.
-.sp
-Historically,
-.CO vi
-did not permit the
-.LI <control-T>
-command to be used unless the cursor was at the first column of a new
-line or it was preceded only by autoindent characters.
-.CO Nvi
-permits it to be used at any time during insert mode.
-.KY <erase>
-.IP <erase>
-.KY <control-H>
-.Ip <control-H>
-Erase the last character.
-.KY "<literal-next>"
-.IP "<literal-next>"
-Quote the next character.
-The next character will not be mapped (see the
-.CO map
-command for more information)
-or interpreted specially.
-A carat
-.PQ ^
-character will be displayed immediately as a placeholder,
-but will be replaced by the next character.
-.KY <escape>
-.IP <escape>
-If on the colon command line, and the
-.OP filec
-edit option is set, behave as described for that option.
-Otherwise, if on the colon command line,
-execute the command.
-Otherwise, if not on the colon command line,
-resolve all text input into the file, and return to command mode.
-.KY "<line erase>"
-.IP "<line erase>"
-Erase the current line.
-.KY "<control-W>"
-.IP "<control-W>"
-.KY "<word erase>"
-.Ip "<word erase>"
-Erase the last word.
-The definition of word is dependent on the
-.OP altwerase
-and
-.OP ttywerase
-options.
-.KY "<control-X>"
-.IP "<control-X>[0-9A-Fa-f]+"
-Insert a character with the specified hexadecimal value into the text.
-The value is delimited by any non-hexadecimal character or the input
-of the maximum number of characters that can be translated into a single
-character value.
-.KY <interrupt>
-.IP "<interrupt>"
-Interrupt text input mode, returning to command mode.
-If the
-.LI <interrupt>
-character is used to interrupt inserting text into the file,
-it is as if the
-.LI <escape>
-character was used; all text input up to the interruption is
-resolved into the file.
diff --git a/docs/USD.doc/vi.ref/vi.ref b/docs/USD.doc/vi.ref/vi.ref
deleted file mode 100644
index 12a483f1edb1..000000000000
--- a/docs/USD.doc/vi.ref/vi.ref
+++ /dev/null
@@ -1,1840 +0,0 @@
-.\" Copyright (c) 1994
-.\" The Regents of the University of California. All rights reserved.
-.\" Copyright (c) 1994, 1995, 1996
-.\" Keith Bostic. All rights reserved.
-.\"
-.\" This document may not be republished without written permission from
-.\" Keith Bostic.
-.\"
-.\" See the LICENSE file for redistribution information.
-.\"
-.\" @(#)vi.ref 8.88 (Berkeley) 10/19/96
-.\"
-.\" $FreeBSD$
-.\"
-.so ref.so
-.tp
-.(l C
-.ps 12
-.ft B
-Vi/Ex Reference Manual
-.ft
-.ps
-.sp
-.i "Keith Bostic"
-.sp
-Computer Science Division
-Department of Electrical Engineering and Computer Science
-University of California, Berkeley
-Berkeley, California 94720
-.sp 1
-.)l
-.sp 3
-.(l C
-.i Abstract
-.)l
-.(q
-.pp
-This document is the reference guide for the 4.4BSD
-implementations of
-.EV nex nvi ,
-which are implementations of the historic Berkeley
-.EV ex vi
-editors.
-.)q
-.sp 3
-.(l C
-.i Licensing
-.)l
-.sp
-.lp
-Copyright (c) 1991, 1992, 1993, 1994
-.ti +5
-The Regents of the University of California. All Rights Reserved.
-.lp
-Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996
-.ti +5
-Keith Bostic. All Rights Reserved.
-.sp
-.pp
-The vi program is freely redistributable. You are welcome to copy,
-modify and share it with others under the conditions listed in the
-LICENSE file. If any company (not individual!) finds vi sufficiently
-useful that you would have purchased it, or if any company wishes to
-redistribute it, contributions to the authors would be appreciated.
-.bp 2
-.(l C
-.i Acknowledgements
-.)l
-.sp
-.(q
-.pp
-Bruce Englar encouraged the early development of the historic
-.EV ex vi
-editor.
-Peter Kessler helped bring sanity to version 2's command layout.
-Bill Joy wrote versions 1 and 2.0 through 2.7,
-and created the framework that users see in the present editor.
-Mark Horton added macros and other features and made
-.EV ex vi
-work on a large number of terminals and Unix systems.
-.pp
-.CO Nvi
-is originally derived from software contributed to the University of
-California, Berkeley by Steve Kirkendall, the author of the
-.CO vi
-clone
-.CO elvis .
-.pp
-IEEE Standard Portable Operating System Interface for Computer
-Environments (POSIX) 1003.2 style Regular Expression support was
-done by Henry Spencer.
-.pp
-The curses library was originally done by Ken Arnold.
-Scrolling and reworking for
-.CO nvi
-was done by Elan Amir.
-.pp
-George Neville-Neil added the Tcl interpreter,
-and Sven Verdoolaege added the Perl interpreter.
-.pp
-Rob Mayoff added Cscope support.
-.pp
-The Institute of Electrical and Electronics Engineers has
-given us permission to reprint portions of their documentation.
-Portions of this document are reprinted and reproduced from
-IEEE Std 1003.2-1992, IEEE Standard Portable Operating
-System Interface for Computer Environments (POSIX),
-copyright 1992 by the Institute of Electrical and Electronics
-Engineers, Inc.
-.pp
-The financial support of UUNET Communications Services is gratefully
-acknowledged.
-.)q
-.sy echo -n >index
-.oh 'Vi/Ex Reference''USD:13-%'
-.eh 'USD:13-%''Vi/Ex Reference'
-.bp 4
-.SH 1 Description
-.pp
-.CO Vi
-is a screen oriented text editor.
-.CO Ex
-is a line-oriented text editor.
-.CO Ex
-and
-.CO vi
-are different interfaces to the same program,
-and it is possible to switch back and forth during an edit session.
-.CO View
-is the equivalent of using the
-.b \-R
-(read-only) option of
-.CO vi .
-.pp
-This reference manual is the one provided with the
-.EV nex nvi
-versions of the
-.EV ex vi
-text editors.
-.EV Nex nvi
-are intended as bug-for-bug compatible replacements for the original
-Fourth Berkeley Software Distribution (4BSD)
-.EV ex vi
-programs.
-This reference manual is accompanied by a traditional-style manual page.
-That manual page describes the functionality found in
-.EV ex vi
-in far less detail than the description here.
-In addition, it describes the system interface to
-.EV ex vi ,
-e.g. command line options, session recovery, signals,
-environmental variables, and similar things.
-.pp
-This reference is intended for users already familiar with
-.EV ex vi .
-Anyone else should almost certainly read a good tutorial on the
-editor first.
-If you are in an unfamiliar environment,
-and you absolutely have to get work done immediately,
-see the section entitled
-.QB "Fast Startup"
-in the manual page.
-It is probably enough to get you started.
-.pp
-There are a few features in
-.EV nex nvi
-that are not found in historic versions of
-.EV ex vi .
-Some of the more interesting of those features are briefly described
-in the next section, entitled
-.QB "Additional Features" .
-For the rest of this document,
-.EV nex nvi
-is used only when it is necessary to distinguish it from the historic
-implementations of
-.EV ex vi .
-.pp
-Future versions of this software will be periodically made available
-by anonymous ftp, and can be retrieved from
-.LI ftp.cs.berkeley.edu ,
-in the directory
-.LI ucb/4bsd .
-.SH 1 "Additional Features in Nex/Nvi"
-.pp
-There are a few features in
-.EV nex nvi
-that are not found in historic versions of
-.EV ex vi .
-Some of the more interesting of these are as follows:
-.IP "8-bit clean data, large lines, files"
-.EV Nex nvi
-will edit any format file.
-Line lengths are limited by available memory,
-and file sizes are limited by available disk space.
-The
-.CO vi
-text input mode command
-.CO <control-X>
-can insert any possible character value into the text.
-.IP "Background and foreground screens"
-The
-.CO bg
-command backgrounds the current screen, and the
-.CO fg
-command foregrounds backgrounded screens.
-The
-.CO display
-command can be used to list the background screens.
-.IP "Command Editing"
-You can enter a normal editing window on the collected commands that
-you've entered on the
-.CO vi
-colon command-line,
-and then modify and/or execute the commands.
-See the
-.OP cedit
-edit option for more information.
-.IP "Displays"
-The
-.CO display
-command can be used to display the current buffers, the backgrounded
-screens, and the tags stack.
-.IP "Extended Regular Expressions"
-The
-.CO extended
-option causes Regular Expressions to be interpreted as as Extended
-Regular Expressions, (i.e. \fIegrep\fP(1) style Regular Expressions).
-.IP "File Name Completion"
-It is possible to do file name completion and file name displays when
-entering commands on the
-.CO vi
-colon command-line.
-See the
-.OP filec
-option for more information.
-.IP "Infinite undo"
-Changes made during an edit session may be rolled backward and forward.
-A
-.CO \&.
-command immediately after a
-.CO u
-command continues either forward or backward depending on whether the
-.CO u
-command was an undo or a redo.
-.IP "Left-right scrolling"
-The
-.CO leftright
-option causes
-.CO nvi
-to do left-right screen scrolling, instead of the traditional
-.CO vi
-line wrapping.
-.IP "Message Catalogs"
-It is possible to display informational and error messages in different
-languages by providing a catalog of messages.
-See the
-.OP msgcat
-option and the file
-.LI "catalog/README"
-for more information.
-.IP "Incrementing numbers"
-The
-.CO \&#
-command increments or decrements the number referenced by the cursor.
-.IP "Previous file"
-The
-.CO previous
-command edits the previous file from the argument list.
-.IP "Scripting languages"
-The
-.CO ":pe[rl] cmd" ,
-.CO ":perld[o] cmd"
-and
-.CO ":tc[l] cmd"
-commands execute Perl and Tcl/Tk commands, respectively,
-on lines from the edit buffer.
-See the
-.QB "Scripting Languages"
-section and the specific commands for more information.
-.\".IP "Shell screens"
-.\"The
-.\".CO ":sc[ript] [file ...]"
-.\"command runs a shell in the screen.
-.\"Editing is unchanged, with the exception that a \fC<carriage-return>\fP
-.\"enters the current line (stripped of any prompt) as input to the
-.\"shell.
-.IP "Split screens"
-The
-.CO Edit ,
-.CO Ex ,
-.CO Next ,
-.CO Previous ,
-.CO Tag
-and
-.CO Visual
-(in
-.CO vi
-mode) commands divide the screen into multiple editing regions and
-then perform their normal function in a new screen area.
-The
-.CO <control-W>
-command rotates between the foreground screens.
-The
-.CO resize
-command can be used to grow or shrink a particular screen.
-.IP "Tag stacks"
-Tags are now maintained in a stack.
-The
-.CO <control-T>
-command returns to the previous tag location.
-The
-.CO tagpop
-command returns to the most recent tag location by default, or,
-optionally to a specific tag number in the tag stack,
-or the most recent tag from a specified file.
-The
-.CO display
-command can be used to list the tags stack.
-The
-.CO tagtop
-command returns to the top of the tag stack.
-.IP "Usage information"
-The
-.CO exusage
-and
-.CO viusage
-commands provide usage information for all of the
-.CO ex
-and
-.CO vi
-commands by default, or, optionally, for a specific command or key.
-.IP "Word search"
-The
-.CO <control-A>
-command searches for the word referenced by the cursor.
-.SH 1 "Startup Information"
-.pp
-.EV Ex vi
-interprets one of two possible environmental variables and reads up to
-three of five possible files during startup.
-The variables and files are expected to contain
-.CO ex
-commands, not
-.CO vi
-commands.
-In addition, they are interpreted
-.i before
-the file to be edited is read, and therefore many
-.CO ex
-commands may not be used.
-Generally, any command that requires output to the screen or that
-needs a file upon which to operate, will cause an error if included
-in a startup file or environmental variable.
-.pp
-Because the
-.CO ex
-command set supported by
-.EV nex nvi
-is a superset of the command set supported by historical implementations of
-.CO ex ,
-.EV nex nvi
-can use the startup files created for the historical implementations,
-but the converse may not be true.
-.pp
-If the
-.b \-s
-(the historic \- option)
-is specified, or if standard input is redirected from a file,
-all environmental variables and startup files are ignored.
-.pp
-Otherwise, startup files and environmental variables are handled
-in the following order:
-.np
-The file
-.LI /etc/vi.exrc
-is read,
-as long as it is owned by root or the effective user ID of the user.
-.np
-The environmental variable
-.LI NEXINIT
-(or the variable
-.LI EXINIT ,
-if
-.LI NEXINIT
-is not set) is interpreted.
-.np
-If neither
-.LI NEXINIT
-or
-.LI EXINIT
-was set, and the
-.LI HOME
-environmental variable is set, the file
-.LI $HOME/.nexrc
-(or the file
-.LI $HOME/.exrc ,
-if
-.LI $HOME/.nexrc
-does not exist) is read,
-as long as the effective user ID of the user is root or is the same as
-the owner of the file.
-.sp
-When the $HOME directory is being used for both
-.EV nex nvi
-and an historic implementation of
-.EV ex vi ,
-a possible solution is to put
-.EV nex nvi
-specific commands in the
-.LI \&.nexrc
-file, along with a
-.CO ":source $HOME/.exrc"
-command to read in the commands common to both implementations.
-.np
-If the
-.OP exrc
-option was turned on by one of the previous startup information
-sources, the file
-.LI \&.nexrc
-(or the file
-.LI \&.exrc ,
-if
-.LI \&.nexrc
-does not exist) is read, as long as the effective user ID of the user
-is the same as the owner of the file.
-.pp
-No startup file is read if it is writable by anyone other than its owner.
-.pp
-It is not an error for any of the startup environmental variables or files
-not to exist.
-.pp
-Once all environmental variables are interpreted,
-and all startup files are read,
-the first file to be edited is read in (or a temporary file is created).
-Then, any commands specified using the
-.b \-c
-option are executed, in the context of that file.
-.SH 1 "Recovery"
-.pp
-There is no recovery program for
-.EV nex nvi ,
-nor does
-.EV nex nvi
-run setuid.
-Recovery files are created readable and writable by the owner only.
-Users may recover any file which they can read,
-and the superuser may recover any edit session.
-.pp
-Edit sessions are backed by files in the directory named by the
-.OP recdir
-option (the directory
-.LI /var/tmp/vi.recover
-by default), and are named
-.QC vi.XXXXXX ,
-where
-.QC XXXXXX
-is a number related to the process ID.
-When a file is first modified,
-a second recovery file containing an email message for the user is created,
-and is named
-.QC recover.XXXXXX ,
-where, again,
-.QC XXXXXX
-is associated with the process ID.
-Both files are removed at the end of a normal edit session,
-but will remain if the edit session is abnormally terminated
-or the user runs the
-.CO ex
-.CO preserve
-command.
-.pp
-The
-.OP recdir
-option may be set in either the user's or system's startup information,
-changing the recovery directory.
-(Note, however, that if a memory based file system is used as the backup
-directory, each system reboot will delete all of the recovery files!
-The same caution applies to directories such as
-.LI /tmp
-which are cleared of their contents by a system reboot, or
-.LI /usr/tmp
-which is periodically cleared of old files on many systems.)
-.pp
-The recovery directory should be owned by root, or at least by a pseudo-user.
-In addition, if directory
-.QQ sticky-bit
-semantics are available, the directory should have the sticky-bit
-set so that files may only be removed by their owners.
-The recovery directory must be read, write, and executable by any user,
-i.e. mode 1777.
-.pp
-If the recovery directory does not exist,
-.EV ex vi
-will attempt to create it.
-This can result in the recovery directory being owned by a normal user,
-which means that that user will be able to remove other user's recovery
-and backup files.
-This is annoying, but is not a security issue as the user cannot
-otherwise access or modify the files.
-.pp
-The recovery file has all of the necessary information in it to enable the
-user to recover the edit session.
-In addition, it has all of the necessary email headers for
-.XR sendmail 8 .
-When the system is rebooted, all of the files in
-.LI /var/tmp/vi.recover
-named
-.QC recover.XXXXXX
-should be sent to their owners, by email, using the
-.b \-t
-option of
-.CO sendmail
-(or a similar mechanism in other mailers).
-If
-.EV ex vi
-receives a hangup (SIGHUP) signal, or the user executes the
-.CO ex
-.CO preserve
-command,
-.EV ex vi
-will automatically email the recovery information to the user.
-.pp
-If your system does not have the
-.CO sendmail
-utility (or a mailer program which supports its interface)
-the source file
-.LI nvi/common/recover.c
-will have to be modified to use your local mail delivery programs.
-Note, if
-.EV nex nvi
-is changed to use another mailer,
-it is important to remember that the owner of the file given to
-the mailer is the
-.EV nex nvi
-user, so nothing in the file should be trusted as it may have been
-modified in an effort to compromise the system.
-.pp
-Finally, the owner execute bit is set on backup files when they are
-created, and unset when they are first modified, e.g. backup files
-that have no associated email recovery file will have this bit set.
-(There is also a small window where empty files can be created and
-not yet have this bit set.
-This is due to the method in which the files are created.)
-Such files should be deleted when the system reboots.
-.pp
-A simple way to do this cleanup is to run the Bourne shell script
-.CO recover ,
-from your
-.LI /etc/rc.local
-(or other system startup) file.
-The script should work with the historic Bourne shell,
-a POSIX 1003.2 shell or the Korn shell.
-The
-.CO recover
-script is installed as part of the
-.EV nex nvi
-installation process.
-.pp
-Consult the manual page for details on recovering preserved or
-aborted editing sessions.
-.SH 1 "Sizing the Screen"
-.pp
-The size of the screen can be set in a number of ways.
-.EV Ex vi
-takes the following steps until values are obtained for both the
-number of rows and number of columns in the screen.
-.np
-If the environmental variable
-.LI LINES
-exists,
-it is used to specify the number of rows in the screen.
-.np
-If the environmental variable
-.LI COLUMNS
-exists,
-it is used to specify the number of columns in the screen.
-.np
-The TIOCGWINSZ
-.XR ioctl 2
-is attempted on the standard error file descriptor.
-.np
-The termcap entry (or terminfo entry on System V machines)
-is checked for the
-.QQ li
-entry (rows) and the
-.QQ co
-entry (columns).
-.np
-The number of rows is set to 24, and the number of columns is set to 80.
-.pp
-If a window change size signal (SIGWINCH) is received,
-the new window size is retrieved using the TIOCGWINSZ
-.XR ioctl 2
-call, and all other information is ignored.
-.SH 1 "Character Display"
-.pp
-In both
-.CO ex
-and
-.CO vi
-printable characters as defined by
-.XR isprint 3
-are displayed using the local character set.
-.pp
-Non-printable characters, for which
-.XR iscntrl 3
-returns true, and which are less than octal \e040,
-are displayed as the string
-.QT ^<character> ,
-where
-.LI <character>
-is the character that is the original character's value offset from the
-.QT @
-character.
-For example, the octal character \e001 is displayed as
-.QT ^A .
-If
-.XR iscntrl 3
-returns true for the octal character \e177,
-it is displayed as the string
-.QT ^? .
-All other characters are displayed as either hexadecimal values,
-in the form
-.QT "0x<high-halfbyte> ... 0x<low-halfbyte>" ,
-or as octal values, in the form
-.QT "\e<high-one-or-two-bits> ... \e<low-three-bits>" .
-The display of unknown characters is based on the value of the
-.OP octal
-option.
-.pp
-In
-.CO vi
-command mode, the cursor is always positioned on the last column of
-characters which take up more than one column on the screen.
-In
-.CO vi
-text input mode, the cursor is positioned on the first column of
-characters which take up more than one column on the screen.
-.SH 1 "Multiple Screens"
-.pp
-.CO Nvi
-supports multiple screens by dividing the window into regions.
-It also supports stacks of screens by permitting the user to change
-the set of screens that are currently displayed.
-.pp
-The
-.CO Edit ,
-.CO Ex ,
-.CO Fg ,
-.CO Next ,
-.CO Previous ,
-.CO Tag
-and
-.CO Visual
-(in
-.CO vi
-mode)
-commands divide the current screen into two regions of approximately
-equal size and then perform their usual action in a new screen area.
-If the cursor is in the lower half of the screen, the screen will split
-up, i.e. the new screen will be above the old one.
-If the cursor is in the upper half of the screen, the new screen will be
-below the old one.
-.pp
-When more than one screen is editing a file, changes in any screen are
-reflected in all other screens editing the same file.
-Exiting a screen without saving any changes (or explicitly discarding
-them) is permitted until the last screen editing the file is exited,
-at which time the changes must be saved or discarded.
-.pp
-The
-.CO resize
-command permits resizing of individual screens.
-Screens may be grown, shrunk or set to an absolute number of rows.
-.pp
-The
-.CO ^W
-command is used to switch between screens.
-Each
-.CO ^W
-moves to the next lower screen in the window, or to the first screen
-in the window if there are no lower screens.
-.pp
-The
-.CO bg
-command
-.QQ backgrounds
-the current screen.
-The screen disappears from the window,
-and the rows it occupied are taken over by a neighboring screen.
-It is an error to attempt to background the only screen in the window.
-.pp
-The
-.CO "display screens"
-command displays the names of the files associated with the current
-backgrounded screens in the window.
-.pp
-The
-.CO "fg [file]"
-command moves the specified screen from the list of backgrounded screens
-to the foreground.
-If no file argument is specified, the first screen on the list is
-foregrounded.
-By default,
-foregrounding consists of backgrounding the current screen,
-and replacing its space in the window with the foregrounded screen.
-.pp
-Capitalizing the first letter of the command, i.e.
-.CO Fg ,
-will foreground the backgrounded screen in a new screen instead of
-swapping it with the current screen.
-.pp
-If the last foregrounded screen in the window is exited,
-and there are backgrounded screens,
-the first screen on the list of backgrounded screens takes over the window.
-.SH 1 "Tags, Tag Stacks, and Cscope"
-.pp
-.CO Nvi
-supports the historic
-.CO vi
-tag command
-.CO <control-]> ,
-and the historic
-.CO ex
-tag command
-.CO tag .
-These commands change the current file context to a new location,
-based on information found in the
-.LI tags
-files.
-If you are unfamiliar with these commands,
-you should review their description in the
-.CO ex
-and
-.CO vi
-commands section of this manual.
-For additional information on tags files,
-see the discussion of the
-.OP tags
-edit option and the system
-.XR ctags 1
-manual page.
-.pp
-In addition,
-.CO nvi
-supports the notion of
-.QQ "tags stacks" ,
-using the
-.CO <control-T>
-command.
-The
-.CO <control-T>
-command returns the user to the previous context, i.e.,
-the last place from which a
-.CO <control-]>
-or
-.CO "tag"
-command was entered.
-These three commands provide the basic functionality which allows you
-to use
-.CO vi
-to review source code in a structured manner.
-.pp
-.CO Nvi
-also provides two other basic
-.CO ex
-commands for tag support:
-.CO tagpop
-and
-.CO tagtop .
-The
-.CO tagpop
-command is identical to the
-.CO <control-T>
-command,
-with the additional functionality that you may specify that modifications
-to the current file are to be discarded.
-This cannot be done using the
-.CO <control-T>
-command.
-The
-.CO tagtop
-command discards all of the contexts that have been pushed onto the tag
-stack, returning to the context from which the first
-.CO <control-]>
-or
-.CO tag
-command was entered.
-.pp
-The historic
-.XR ctags 1
-tags file format supports only a single location per tag,
-normally the function declaration or structure or string definition.
-More sophisticated source code tools often provide multiple locations
-per tag, e.g.,
-a list of the places from which a function is called or a string
-definition is used.
-An example of this functionality is the System V source code tool,
-.CO cscope .
-.sp
-.CO Cscope
-creates a database of information on source code files,
-and supports a query language for that information as described in the
-.XR cscope 1
-manual page.
-.CO Nvi
-contains an interface to the
-.CO cscope
-query language which permits you to query
-.CO cscope
-and then sequentially step through the locations in the sources files which
-.CO cscope
-returns.
-There are two
-.CO nvi
-commands which support this ability to step through multiple locations.
-They are the
-.CO ex
-commands
-.CO tagnext
-and
-.CO tagprev .
-The
-.CO tagnext
-command moves to the next location for the current tag.
-The
-.CO tagprev
-command moves to the previous location for the current tag.
-(See the
-.CO tagnext
-and
-.CO tagprev
-command discussion in the
-.CO ex
-commands section of this manual for more information.)
-At any time during this sequential walk,
-you may use the
-.CO <control-]> ,
-.CO tag
-or
-.CO cscope
-commands to move to a new tag context, and then use the
-.CO <control-T>
-or
-.CO tagpop
-commands to return and continue stepping through the locations for this
-tag.
-This is similar to the previous model of a simple tag stack,
-except that each entry in the tag stack may have more than one file context
-that is of interest.
-.pp
-Although there is no widely distributed version of
-.XR ctags 1
-that creates tags files with multiple locations per tag,
-.CO nvi
-has been written to understand the obvious extension to the historic
-tags file format, i.e., more than a single line in the tags file with
-the same initial tag name.
-If you wish to extend your
-.CO ctags
-implementation or other tool with which you build tags files,
-this extension should be simple and will require no changes to
-.CO nvi .
-.pp
-The
-.CO nvi
-and
-.CO cscope
-interface is based on the new
-.CO ex
-command
-.CO cscope ,
-which has five subcommands:
-.CO add ,
-.CO find ,
-.CO help ,
-.CO kill
-and
-.CO reset .
-The subcommand
-.CO find
-itself has eight subcommands:
-.CO \&c ,
-.CO \&d ,
-.CO \&e ,
-.CO \&f ,
-.CO \&g ,
-.CO \&i ,
-.CO \&s
-and
-.CO \&t .
-.pp
-.IP "cs[cope] a[dd] file"
-The
-.CO add
-command attaches to the specified
-.CO cscope
-database.
-The file name is expanded using the standard filename expansions.
-If
-.CO file
-is a directory, the file
-.QQ cscope.out
-in that directory is used as the database.
-.pp
-After
-.CO nvi
-attaches to a new database,
-all subsequent
-.CO cscope
-queries will be asked of that database.
-The result of any single query is the collection of response to the query
-from all of the attached databases.
-.sp
-If the
-.QQ CSCOPE_DIRS
-environmental variable is set when
-.CO nvi
-is run,
-it is expected to be a <colon> or <blank>-separated list of
-.CO cscope
-databases or directories containing
-.CO cscope
-databases, to which the user wishes to attach.
-.IP ":cs[cope] f[ind] c|d|e|f|g|i|s|t buffer|pattern"
-The
-.CO find
-command is the
-.CO cscope
-query command for
-.CO nvi .
-For this command,
-.CO nvi
-queries all attached
-.CO cscope
-databases for the pattern.
-If the pattern is a double-quote character followed by a valid buffer
-name (e.g.,
-.LI """<character>" ),
-then the contents of the named buffer are used as the pattern.
-Otherwise, the pattern is a Regular Expression.
-.sp
-The
-.CO 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.
-.sp
-File names returned by the
-.CO cscope
-query, if not absolute paths, are searched for relative to the directory
-where the
-.CO cscope
-database is located.
-In addition, if the file
-.QQ cscope.tpath
-appears in the same directory as the
-.CO cscope
-database,
-it is expected to contain a colon-separated list of directory names
-where files referenced by its associated
-.CO cscope
-database may be found.
-.sp
-The
-.CO find
-subcommand is one of the following:
-.SS
-.SP \&c
-Find callers of the name.
-.SP \&d
-Find all function calls made from name.
-.SP \&e
-Find pattern.
-.SP \&f
-Find files with name as substring.
-.SP \&g
-Find definition of name.
-.SP \&i
-Find files #including name.
-.SP \&s
-Find all uses of name.
-.SP \&t
-Find assignments to name.
-.SE
-.IP ":cs[cope] h[elp] [command]"
-List the
-.CO cscope
-commands,
-or optionally list usage help for any single
-.CO cscope
-command.
-.IP ":display c[onnections]"
-Display the list of
-.CO cscope
-databases to which
-.CO nvi
-is currently connected.
-.IP ":cs[cope] k[ill] #"
-Disconnect from a specific
-.CO cscope
-database.
-The connection number is the one displayed by the
-.CO ex
-.CO "display connections"
-command.
-.IP ":cs[cope] r[eset]"
-Disconnect from all attached
-.CO cscope
-databases.
-.pp
-Cscope is not freely redistributable software,
-but is fairly inexpensive and easily available.
-To purchase a copy of
-.CO cscope ,
-see http://www.att.com/ssg/products/toolchest.html.
-.SH 1 "Regular Expressions and Replacement Strings"
-.pp
-Regular expressions are used in line addresses,
-as the first part of the
-.CO ex
-.CO substitute ,
-.CO global ,
-and
-.CO v
-commands, and in search patterns.
-.pp
-The regular expressions supported by
-.EV ex vi
-are, by default, the Basic Regular Expressions (BRE's) described in the
-IEEE POSIX Standard 1003.2.
-The
-.OP extended
-option causes all regular expressions to be interpreted as the Extended
-Regular Expressions (ERE's) described by the same standard.
-(See
-.XR re_format 7
-for more information.)
-Generally speaking, BRE's are the Regular Expressions found in
-.XR ed 1
-and
-.XR grep 1 ,
-and ERE's are the Regular Expressions found in
-.XR egrep 1 .
-.pp
-The following is not intended to provide a description of Regular
-Expressions.
-The information here only describes strings and characters which
-have special meanings in the
-.EV ex vi
-version of RE's,
-or options which change the meanings of characters that normally
-have special meanings in RE's.
-.np
-An empty RE (e.g.
-.QT //
-or
-.QT ??
-is equivalent to the last RE used.
-.np
-The construct
-.QT \e<
-matches the beginning of a word.
-.np
-The construct
-.QT \e>
-matches the end of a word.
-.np
-The character
-.QT ~
-matches the replacement part of the last
-.CO substitute
-command.
-.pp
-When the
-.OP magic
-option is
-.i not
-set, the only characters with special meanings are a
-.QT ^
-character at the beginning of an RE, a
-.QT $
-character at the end of an RE, and the escaping character
-.QT \e .
-The characters
-.QT \&. ,
-.QT * ,
-.QT [
-and
-.QT ~
-are treated as ordinary characters unless preceded by a
-.QT \e ;
-when preceded by a
-.QT \e
-they regain their special meaning.
-.pp
-Replacement strings are the second part of a
-.CO substitute
-command.
-.pp
-The character
-.QT &
-(or
-.QT \e&
-if the
-.OP magic
-option is
-.i not
-set) in the replacement string stands for the text matched by the RE
-that is being replaced.
-The character
-.QT ~
-(or
-.QT \e~
-if the
-.OP magic
-option is
-.i not
-set) stands for the replacement part of the previous
-.CO substitute
-command.
-It is only valid after a
-.CO substitute
-command has been performed.
-.pp
-The string
-.QT \e# ,
-where
-.QT #
-is an integer value from 1 to 9, stands for the text matched by
-the portion of the RE enclosed in the
-.QT # 'th
-set of escaped parentheses, e.g.
-.QT \e(
-and
-.QT \e) .
-For example,
-.QT "s/abc\e(.*\e)def/\e1/"
-deletes the strings
-.QT abc
-and
-.QT def
-from the matched pattern.
-.pp
-The strings
-.QT \el ,
-.QT \eu ,
-.QT \eL
-and
-.QT \eU
-can be used to modify the case of elements in the replacement string.
-The string
-.QT \el
-causes the next character to be converted to lowercase;
-the string
-.QT \eu
-behaves similarly, but converts to uppercase
-(e.g.
-.LI s/abc/\eU&/
-replaces the string
-.LI abc
-with
-.LI ABC ).
-The string
-.QT \eL
-causes characters up to the end of the string or the next occurrence
-of the strings
-.QT \ee
-or
-.QT \eE
-to be converted to lowercase;
-the string
-.QT \eU
-behaves similarly, but converts to uppercase.
-.pp
-If the entire replacement pattern is
-.QT % ,
-then the last replacement pattern is used again.
-.pp
-In
-.CO vi ,
-inserting a
-.LI <control-M>
-into the replacement string will cause
-the matched line to be split into two lines at that point.
-(The
-.LI <control-M>
-will be discarded.)
-.SH 1 "Scripting Languages"
-.pp
-The
-.CO nvi
-editor currently supports two scripting languages, Tcl/Tk and Perl.
-(Note that Perl4 isn't sufficient, and that the Perl5 used must be
-version 5.002 or later.
-See the
-.QB "Building Nvi"
-section for more information.
-.pp
-The scripting language interface is still being worked on,
-therefore the following information is probably incomplete,
-probably wrong in cases, and likely to change.
-See the
-.LI perl_api
-and
-.LI tcl_api
-source directories for more information.
-As a quick reference, the following function calls are provided for
-both the Perl and Tcl interfaces.
-The Perl interface uses a slightly different naming convention,
-e.g. ``viFindScreen'' is named ``VI::FindScreen''.
-.IP "viFindScreen file"
-Return the
-.LI "screenId" associated with
-.LI file .
-.IP "viAppendLine screenId lineNumber text"
-Append
-.LI text
-as a new line after line number
-.LI lineNumber ,
-in the screen
-.LI screenId .
-.IP "viDelLine screenId lineNum"
-Delete the line
-.LI lineNumber
-from the screen
-.LI screenId .
-.IP "viGetLine screenId lineNumber"
-Return the line
-.LI lineNumber
-from the screen
-.LI screenId .
-.IP "viInsertLine screenId lineNumber text"
-Insert
-.LI text
-as a new line before line number
-.LI lineNumber
-in the screen
-.LI screenId .
-.IP "viLastLine screenId"
-Return the line number of the last line in the screen
-.LI screenId .
-.IP "viSetLine screenId lineNumber text"
-Change the line
-.LI lineNumber
-in the screen
-.LI screenId
-to match the specified
-.LI text .
-.IP "viGetMark screenId mark"
-Return the current line and column for the specified
-.LI mark
-from the screen
-.LI screenId .
-.IP "viSetMark screenId mark line column"
-Set the specified
-.LI mark
-to be at line
-.LI line ,
-column
-.LI column ,
-in the screen
-.LI screenId .
-.IP "viGetCursor screenId"
-Return the current line and column for the cursor in the screen
-.LI screenId .
-.IP "viSetCursor screenId line column"
-Set the cursor in the screen
-.LI screenId
-to the specified
-.LI line
-and
-.LI column .
-.IP "viMsg screenId text"
-Display the specified
-.LI text
-as a vi message in the screen
-.LI screenId .
-.IP "viNewScreen screenId [file]"
-Create a new screen.
-.IP "viEndScreen screenId"
-Exit the screen
-.LI screenId .
-.IP "viSwitchScreen screenId screenId"
-Switch from the screen
-.LI screenId
-to the screen
-.LI screenId .
-.IP "viMapKey screenId key tclproc"
-Map the specified
-.LI key
-in the screen
-.LI screenId
-to the Tcl procedure
-.LI tclproc .
-.IP "viUnmMapKey screenId key"
-Unmap the specified
-.LI key
-in the screen
-.LI screenId
-.IP "viGetOpt screenId option"
-Return the value of the specified
-.LI option
-from the screen
-.LI screenId .
-.IP "viSetOpt screenId command"
-Set one or more options in the screen
-.LI screenId .
-.SH 1 "General Editor Description"
-.pp
-When
-.CO ex
-or
-.CO vi
-are executed,
-the text of a file is read (or a temporary file is created),
-and then all editing changes happen within the context of the
-copy of the file.
-.i "No changes affect the actual file until the file is written out" ,
-either using a write command or another command which is affected by the
-.OP autowrite
-option.
-.pp
-All files are locked (using the
-.XR flock 2
-or
-.XR fcntl 2
-interfaces) during the edit session,
-to avoid inadvertently making modifications to multiple copies of the file.
-If a lock cannot be obtained for a file because it is locked by another
-process, the edit session is read-only (as if the
-.OP readonly
-option or the
-.b \-R
-flag had been specified).
-If a lock cannot be obtained for other reasons, the edit session will
-continue, but the file status information
-(see the
-.CO <control-G>
-command) will reflect this fact.
-.pp
-Both
-.CO ex
-and
-.CO vi
-are modeful editors, i.e. they have two modes,
-.QQ command
-mode and
-.QQ "text input"
-mode.
-The former is intended to permit you to enter commands which modifies
-already existing text.
-The latter is intended to permit you to enter new text.
-When
-.CO ex
-first starts running, it is in command mode, and usually displays a prompt
-(see the
-.OP prompt
-option for more information).
-The prompt is a single colon
-.PQ :
-character.
-There are three commands that switch
-.CO ex
-into text input mode:
-.CO append ,
-.CO change
-and
-.CO insert .
-Once in input mode, entering a line containing only a single period
-.PQ \&.
-ends text input mode and returns to command mode,
-where the prompt is redisplayed.
-.pp
-When
-.CO vi
-first starts running, it is in command mode as well.
-There are eleven commands that switch
-.CO vi
-into text input mode:
-.CO A ,
-.CO a ,
-.CO C ,
-.CO c ,
-.CO I ,
-.CO i ,
-.CO O ,
-.CO o ,
-.CO R ,
-.CO S
-and
-.CO s .
-Once in input mode, entering an
-.LI <escape>
-character ends text input mode and returns to command mode.
-.pp
-.EV Ex vi
-present three different interfaces to editing a file.
-.CO Ex
-presents a line oriented interface.
-.CO Vi
-presents a full screen display oriented interface,
-also known as
-.QQ "visual mode" .
-In addition, there is a third mode,
-.QQ "open mode" ,
-which is line oriented,
-but supports cursor movement and editing within the displayed line,
-similarly to visual mode.
-Open mode is not yet implemented in
-.CO nvi .
-.pp
-The following words have special meanings in both the
-.CO ex
-and
-.CO vi
-command descriptions:
-.KY <interrupt>
-.IP <interrupt>
-The interrupt character is used to interrupt the current operation.
-Normally
-.LI <control-C> ,
-whatever character is set for the current terminal is used.
-.KY "<literal-next>"
-.IP "<literal-next>"
-The literal next character is used to escape the subsequent character
-from any special meaning.
-This character is always
-.LI <control-V> .
-If the terminal is not set up to do XON/XOFF flow control,
-then
-.LI <control-Q>
-is used to mean literal next as well.
-.KY "current pathname"
-.IP "current pathname"
-The pathname of the file currently being edited by vi.
-When the percent character
-.PQ %
-appears in a file name entered as part of an
-.CO ex
-command argument, it is replaced by the current pathname.
-(The
-.QT %
-character can be escaped by preceding it with a backslash.)
-.KY "alternate pathname"
-.IP "alternate pathname"
-The name of the last file name mentioned in an
-.CO ex
-command, or,
-the previous current pathname if the last file mentioned
-becomes the current file.
-When the hash mark character
-.PQ #
-appears in a file name entered as part of an
-.CO ex
-command argument, it is replaced by the alternate pathname.
-(The
-.QT #
-character can be escaped by preceding it with a backslash.)
-.KY buffer
-.IP buffer
-One of a number of named areas for saving copies of text.
-Commands that change or delete text can save the changed or deleted
-text into a specific buffer, for later use, if the command allows
-it (i.e. the
-.CO ex
-.CO change
-command cannot save the changed text in a named buffer).
-Buffers are named with a single character, preceded by a double quote,
-e.g.
-.LI """<character>"
-in
-.CO vi
-and
-without the double quote, e.g.
-.LI <character> ,
-in
-.CO ex .
-(The double quote isn't necessary for
-.CO ex
-because buffers names are denoted by their position in the command line.)
-Historic implementations of
-.EV ex vi
-limited
-.LI <character>
-to the alphanumeric characters;
-.EV nex nvi
-permits the use of any character without another meaning in the position
-where a buffer name is expected.
-.sp
-Buffers named by uppercase characters are the same as buffers
-named by lowercase characters, e.g. the buffer named by the
-English character
-.QT A
-is the same as the buffer named by the character
-.QT a ,
-with the exception that, if the buffer contents are being changed (as
-with a text deletion or
-.CO vi
-.CO change
-command), the text is
-.i appended
-to the buffer, instead of replacing the current contents.
-.sp
-The buffers named by the numeric characters (in English,
-.QT 1
-through
-.QT 9 ),
-are special.
-If a region of text including characters from more than one line,
-or a single line of text specified by using a line-oriented motion,
-is changed or deleted in the file using the
-.CO vi
-.CO change
-or
-.CO delete
-commands, a copy of the text is placed into the numeric buffer
-.QT 1 ,
-regardless of the user specifying another buffer in which to save it.
-In addition, there are a few commands which, when used as a
-.LI motion
-with the
-.CO vi
-.CO change
-and
-.CO delete
-commands,
-.i always
-copy the specified region of text into the numeric buffers regardless
-of the region including characters from more than one line.
-These commands are:
-.sp
-.ne 3v
-.ft C
-.TS
-r r r r.
-<control-A> % ( )
-`<character> / ? N
-n { }
-.TE
-.ft R
-.sp
-Before this copy is done, the previous contents of buffer
-.QT 1
-are moved into buffer
-.QT 2 ,
-.QT 2
-into buffer
-.QT 3 ,
-and so on.
-The contents of buffer
-.QT 9
-are discarded.
-In
-.CO vi ,
-text may be explicitly stored into the numeric buffers.
-In this case, the buffer rotation described above occurs before the
-replacement of the buffer's contents.
-The numeric buffers are only available in
-.LI visual
-and
-.LI open
-modes,
-and are not accessible by
-.CO ex
-in any way, although changed and deleted text is still stored there
-while in
-.CO ex
-mode.
-.sp
-When a
-.CO vi
-command synopsis shows both a
-.LI [buffer]
-and a
-.LI [count] ,
-they may be presented in any order.
-.sp
-Finally, all buffers are either
-.QQ line
-or
-.QQ character
-oriented.
-All
-.CO ex
-commands which store text into buffers are line oriented.
-Some
-.CO vi
-commands which store text into buffers are line oriented,
-and some are character oriented; the description for each applicable
-.CO vi
-command notes whether text copied into buffers using the command
-is line or character oriented.
-In addition, the
-.CO vi
-command
-.CO "display buffers"
-displays the current orientation for each buffer.
-Generally, the only importance attached to this orientation is that
-if the buffer is subsequently inserted into the text, line oriented
-buffers create new lines for each of the lines they contain, and
-character oriented buffers create new lines for any lines
-.i other
-than the first and last lines they contain.
-The first and last lines are inserted into the text at the current
-cursor position, becoming part of the current line.
-If there is more than one line in the buffer, however, the current
-line itself will be split.
-.KY "unnamed buffer"
-.IP "unnamed buffer"
-The unnamed buffer is a text storage area which is used by commands
-that use or operate on a buffer when no buffer is specified by the user.
-If the command stores text into a buffer,
-the text is stored into the unnamed buffer even if a buffer is also
-specified by the user.
-It is not possible to append text to the unnamed buffer.
-If text is appended to a named buffer,
-the named buffer contains both the old and new text,
-while the unnamed buffer contains only the new text.
-There is no way to explicitly reference the unnamed buffer.
-.sp
-Historically, the contents of the unnamed buffer were discarded by many
-different commands, even ones that didn't store text into it.
-.EV Nex nvi
-never discards the contents of the unnamed buffer until new text
-replaces them.
-.KY whitespace
-.IP whitespace
-The characters <tab> and <space>.
-.KY "<carriage-return>"
-.IP "<carriage-return>"
-The character represented by an ASCII
-.LI <control-M> .
-This character is almost always treated identically to a
-.LI <newline>
-character, but differs in that it can be escaped into the file text or
-into a command.
-.KY <newline>
-.IP <newline>
-The character represented by an ASCII
-.LI <control-J> .
-This character is almost always treated identically to a
-.LI <control-M>
-character, but differs in that it cannot be escaped into the file text or
-into a command.
-.oh 'Vi/Ex Reference (Vi Commands)''USD:13-%'
-.eh 'USD:13-%''Vi/Ex Reference (Vi Commands)'
-.so vi.cmd.roff
-.oh 'Vi/Ex Reference''USD:13-%'
-.eh 'USD:13-%''Vi/Ex Reference'
-.SH 1 "Ex Addressing"
-.pp
-Addressing in
-.CO ex
-(and when
-.CO ex
-commands are executed from
-.CO vi )
-relates to the current line.
-In general, the current line is the last line affected by a command.
-The exact effect on the current line is discussed under the description
-of each command.
-When the file contains no lines, the current line is zero.
-.pp
-Addresses are constructed by one or more of the following methods:
-.np
-The address
-.QT \&.
-refers to the current line.
-.np
-The address
-.QT $
-refers to the last line of the file.
-.np
-The address
-.QT N ,
-where
-.LI N
-is a positive number, refers to the N-th line of the file.
-.np
-The address
-.QT '<character>
-or
-.QT `<character>
-refers to the line marked with the name
-.LI <character> .
-(See the
-.CO k
-or
-.CO m
-commands for more information on how to mark lines.)
-.np
-A regular expression (RE) enclosed by slashes
-.PQ /
-is an address,
-and it refers to the first line found by searching forward from the line
-.i after
-the current line toward the end of the file, and stopping at the
-first line containing a string matching the RE.
-(The trailing slash can be omitted at the end of the command line.)
-.sp
-If no RE is specified, i.e. the pattern is
-.QT // ,
-the last RE used in any command is used in the search.
-.sp
-If the
-.OP extended
-option is set, the RE is handled as an extended RE, not a basic RE.
-If the
-.OP wrapscan
-option is set, the search wraps around to the beginning of the file
-and continues up to and including the current line, so that the entire
-file is searched.
-.sp
-The form
-.QT \e/
-is accepted for historic reasons,
-and is identical to
-.QT // .
-.np
-An RE enclosed in question marks
-.PQ ?
-addresses the first line found by searching backward from the line
-.i preceding
-the current line, toward the beginning of the file and stopping at the
-first line containing a string matching the RE.
-(The trailing question mark can be omitted at the end of a command line.)
-.sp
-If no RE is specified, i.e. the pattern is
-.QT ?? ,
-the last RE used in any command is used in the search.
-.sp
-If the
-.OP extended
-option is set, the RE is handled as an extended RE, not a basic RE.
-If the
-.OP wrapscan
-option is set, the search wraps around from the beginning of the file to
-the end of the file and continues up to and including the current line,
-so that the entire file is searched.
-.sp
-The form
-.QT \e?
-is accepted for historic reasons, and is identical to
-.QT ?? .
-.np
-An address followed by a plus sign
-.PQ +
-or a minus sign
-.PQ -
-followed by a number is an offset address and refers to the address
-plus (or minus) the indicated number of lines.
-If the address is omitted, the addition or subtraction is done with
-respect to the current line.
-.np
-An address of
-.QT +
-or
-.QT \-
-followed by a number is an offset from the current line.
-For example,
-.QT \-5
-is the same as
-.QT \&.\-5 .
-.np
-An address ending with
-.QT +
-or
-.QT -
-has 1 added to or subtracted from the address, respectively.
-As a consequence of this rule and of the previous rule, the address
-.QT \-
-refers to the line preceding the current line.
-Moreover, trailing
-.QT +
-and
-.QT \-
-characters have a cumulative effect.
-For example,
-.QT ++\-++
-refers to the current line plus 3.
-.np
-A percent sign
-.PQ %
-is equivalent to the address range
-.QT 1,$ .
-.pp
-.CO Ex
-commands require zero, one, or two addresses.
-It is an error to specify an address to a command which requires zero
-addresses.
-.pp
-If the user provides more than the expected number of addresses to any
-.CO ex
-command, the first addresses specified are discarded.
-For example,
-.QT 1,2,3,5 print
-prints lines 3 through 5, because the
-.CO print
-command only takes two addresses.
-.pp
-The addresses in a range are separated from each other by a comma
-.PQ ,
-or a semicolon
-.PQ ; .
-In the latter case, the current line
-.PQ \&.
-is set to the first address, and only then is the second address calculated.
-This feature can be used to determine the starting line for forward and
-backward searches (see rules (5) and (6) above).
-The second address of any two-address sequence corresponds to a line that
-follows, in the file, the line corresponding to the first address.
-The first address must be less than or equal to the second address.
-The first address must be greater than or equal to the first line of the
-file, and the last address must be less than or equal to the last line
-of the file.
-.oh 'Vi/Ex Reference (Ex Commands)''USD:13-%'
-.eh 'USD:13-%''Vi/Ex Reference (Ex Commands)'
-.so ex.cmd.roff
-.oh 'Vi/Ex Reference (Options)''USD:13-%'
-.eh 'USD:13-%''Vi/Ex Reference (Options)'
-.so set.opt.roff
-.oh 'Vi/Ex Reference''USD:13-%'
-.eh 'USD:13-%''Vi/Ex Reference'
-.bp
-.SH 1 Index
-.lp
-.2c +0.5i 3
-.ta \n($luR
-.nf
-.so index.so
-.fi
-.\" Force the TOC to an odd page, in case it's a duplex printer.
-.if o .bp
-.bp 3
-.1c
-.ce 1
-\fB\s+2Table of Contents\s0\fP
-.sp
-.xp
diff --git a/docs/USD.doc/vitut/Makefile b/docs/USD.doc/vitut/Makefile
deleted file mode 100644
index 3d4aca0a64e6..000000000000
--- a/docs/USD.doc/vitut/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-# @(#)Makefile 8.7 (Berkeley) 8/18/96
-
-MACROS= -ms
-ROFF= groff
-TBL= tbl
-
-all: vitut.ps summary.ps viapwh.ps
-
-vitut.ps: vi.in vi.chars
- ${TBL} vi.in vi.chars | ${ROFF} ${MACROS} > $@
- chmod 444 $@
-
-summary.ps: vi.summary
- ${TBL} vi.summary | ${ROFF} ${MACROS} > $@
- chmod 444 $@
-
-viapwh.ps: vi.apwh.ms
- ${TBL} vi.apwh.ms | ${ROFF} ${MACROS} > $@
- chmod 444 $@
-
-clean:
- rm -f vitut.ps summary.ps viapwh.ps
diff --git a/docs/USD.doc/vitut/vi.apwh.ms b/docs/USD.doc/vitut/vi.apwh.ms
deleted file mode 100644
index 6b0763055ca9..000000000000
--- a/docs/USD.doc/vitut/vi.apwh.ms
+++ /dev/null
@@ -1,1081 +0,0 @@
-.\" 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. 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.
-.\"
-.\" @(#)vi.apwh.ms 8.2 (Berkeley) 8/18/96
-.\"
-.nr LL 6.5i
-.nr FL 6.5i
-.TL
-Vi Command & Function Reference
-.AU CB 2675
-Alan P.W. Hewett
-.sp
-Revised for version 2.12 by Mark Horton
-.CB
-.NH 1
-Author's Disclaimer
-.LP
-This document does not claim to be 100% complete. There are a
-few commands listed in the original document that I was unable
-to test either because I do not speak \fBlisp\fR, because they
-required programs we don't have, or because I wasn't able to make
-them work. In these cases I left the command out. The commands
-listed in this document have been tried and are known to work.
-It is expected that prospective users of this document will read
-it once to get the flavor of everything that \fBvi\fR can do
-and then use it as a reference document. Experimentation is
-recommended. If you don't understand a command, try it and
-see what happens.
-.LP
-[Note: In revising this document, I have attempted to make it
-completely reflect version 2.12 of
-.B vi .
-It does not attempt to document the VAX version (version 3),
-but with one or two exceptions (wrapmargin, arrow keys)
-everything said about 2.12 should apply to 3.1.
-.I "Mark Horton" ]
-.NH 1
-Notation
-.LP
-\fB[option]\fR is used to denote optional parts of a command.
-Many \fBvi\fR commands have an optional count. \fB[cnt]\fR
-means that an optional number may precede the command to
-multiply or iterate the command.
-\fB{variable item}\fR is used to denote parts of the command
-which must appear, but can take a number of different values.
-\fB<character [-character]>\fR means that the character or
-one of the characters in the range described between the
-two angle brackets is to be typed.
-For example \fB<esc>\fR means
-the \fBescape\fR key is to be typed. \fB<a-z>\fR means that a
-lower case letter is to be typed. \fB^<character>\fR means that
-the character is to be typed as a \fBcontrol\fR character, that is,
-with the \fB<cntl>\fR key held down while simultaneously typing
-the specified character. In this document control characters will
-be denoted using the \fIupper case\fR character, but
-^<uppercase chr> and ^<lowercase chr> are equivalent. That is, for
-example, \fB<^D>\fR is equal to \fB<^d>\fR.
-The most common character abbreviations
-used in this list are as follows:
-.VL 8
-.IP <esc> 8
-escape, octal 033
-.IP <cr> 8
-carriage return, ^M, octal 015
-.IP <lf> 8
-linefeed ^J, octal 012
-.IP <nl> 8
-newline, ^J, octal 012 (same as linefeed)
-.IP <bs> 8
-backspace, ^H, octal 010
-.IP <tab> 8
-tab, ^I, octal 011
-.IP <bell> 8
-bell, ^G, octal 07
-.IP <ff> 8
-formfeed, ^L, octal 014
-.IP <sp> 8
-space, octal 040
-.IP <del> 8
-delete, octal 0177
-.LE
-.sp 1
-.NH 1
-Basics
-.LP
-To run \fBvi\fR the shell variable \fBTERM\fR must be defined and
-exported to your environment.
-How you do this depends on which shell you are using.
-You can tell which shell you have by the character it
-prompts you for commands with.
-The Bourne shell prompts with `$', and the C shell prompts with `%'.
-For these examples, we will suppose
-that you are using an HP 2621 terminal, whose termcap name is ``2621''.
-.NH 2
-Bourne Shell
-.LP
-To manually set your terminal type to 2621 you would type:
-.DS
-TERM=2621
-export TERM
-.DE
-.PP
-There are various ways of having this automatically or
-semi-automatically done when you log in.
-Suppose you usually dial in on a 2621.
-You want to tell this to the machine, but still have it
-work when you use a hardwired terminal.
-The recommended way, if you have the
-.B tset
-program, is to use the sequence
-.DS
-tset \-s \-d 2621 > tset$$
-\&. tset$$
-rm tset$$
-.DE
-in your .login (for csh) or the same thing using `.' instead of `source'
-in your .profile (for sh).
-The above line says that if you are dialing in you are on a 2621,
-but if you are on a hardwired terminal it figures out your terminal
-type from an on-line list.
-.NH 2
-The C Shell
-.LP
-To manually set your terminal type to 2621 you would type:
-.DS
-setenv TERM 2621
-.DE
-.PP
-There are various ways of having this automatically or
-semi-automatically done when you log in.
-Suppose you usually dial in on a 2621.
-You want to tell this to the machine, but still have it
-work when you use a hardwired terminal.
-The recommended way, if you have the
-.B tset
-program, is to use the sequence
-.DS
-tset \-s \-d 2621 > tset$$
-source tset$$
-rm tset$$
-.DE
-in your .login.*
-.FS
-* On a version 6 system
-without environments, the invocation of tset
-is simpler, just add the line ``tset \-d 2621''
-to your .login or .profile.
-.FE
-The above line says that if you are dialing in you are on a 2621,
-but if you are on a hardwired terminal it figures out your terminal
-type from an on-line list.
-.NH 1
-Normal Commands
-.LP
-\fBVi\fR is a visual editor with a window on the file. What
-you see on the screen is \fBvi\fR's current notion of
-what your file will contain,
-(at this point in the file),
-when it is written out.
-Most commands do not cause any change in the screen until the
-complete command is typed. Should you get confused while
-typing a command, you can abort the command by typing an
-<del> character. You will know you are back to command level
-when you hear a <bell>. Usually typing an <esc> will produce the
-same result. When \fBvi\fR gets an improperly formatted command
-it rings the <bell>.
-Following are the \fBvi\fR commands broken down by function.
-.NH 2
-Entry and Exit
-.LP
-To enter
-.B vi
-on a particular
-.I file ,
-type
-.DS
-\fBvi\fP \fIfile\fP
-.DE
-The file will be read in and the cursor will be placed at the beginning
-of the first line.
-The first screenfull of the file will be displayed on the terminal.
-.PP
-To get out of the editor, type
-.DS
-ZZ
-.DE
-If you are in some special mode, such as input mode
-or the middle of a multi-keystroke command, it may
-be necessary to type <esc> first.
-.NH 2
-Cursor and Page Motion
-.LP
-.VL 16
-.B NOTE:
-The arrow keys (see the next four commands)
-on certain kinds of terminals will not work with the
-PDP-11 version of vi. The control versions or the hjkl versions will
-work on any terminal. Experienced users prefer the hjkl keys because
-they are always right under their fingers. Beginners often prefer
-the arrow keys, since they do not require memorization of which hjkl
-key is which.
-The mnemonic value of hjkl is clear from looking at the keyboard of an adm3a.
-.sp
-.IP "[cnt]<bs> or [cnt]h or [cnt]\(<-" 16
-.br
-Move the cursor to the left one character. Cursor stops at the left
-margin of the page.
-If cnt is given, these commands move that many spaces.
-.IP "[cnt]^N or [cnt]j or [cnt]\(da or [cnt]<lf>" 16
-.br
-Move down one line.
-Moving off the screen scrolls the window to force a new line
-onto the screen.
-Mnemonic: \fBN\fRext
-.IP "[cnt]^P or [cnt]k or [cnt]\(ua" 16
-.br
-Move up one line.
-Moving off the top of the screen forces new text onto the screen.
-Mnemonic: \fBP\fRrevious
-.IP "[cnt]<sp> or [cnt]l or [cnt]\(->" 16
-.br
-Move to the right one character.
-Cursor will not go beyond the end of the line.
-.IP [cnt]- 16
-Move the cursor up the screen to the beginning of the next line.
-Scroll if necessary.
-.IP "[cnt]+ or [cnt]<cr>" 16
-.sp 1
-Move the cursor down the screen to the beginning of the next line.
-Scroll up if necessary.
-.IP "[cnt]$" 16
-Move the cursor to the end of the line.
-If there is a count, move to the end of the line "cnt" lines
-forward in the file.
-.IP "^" 16
-Move the cursor to the beginning of the first word on the line.
-.IP "0" 16
-Move the cursor to the left margin of the current line.
-.IP "[cnt]|" 16
-Move the cursor to the column specified by the count. The default is
-column zero.
-.IP "[cnt]w" 16
-Move the cursor to the beginning of the next word. If there
-is a count, then move forward that many words and
-position the cursor at the beginning of the word.
-Mnemonic: next-\fBw\fRord
-.IP "[cnt]W" 16
-Move the cursor to the beginning of the next word which follows
-a "white space" (<sp>,<tab>, or <nl>). Ignore other punctuation.
-.IP "[cnt]b" 16
-Move the cursor to the preceding word. Mnemonic: \fBb\fRackup-word
-.IP "[cnt]B" 16
-Move the cursor to the preceding word that is separated from the
-current word by a "white space" (<sp>,<tab>, or <nl>).
-.IP "[cnt]e" 16
-Move the cursor to the end of the current word or the end of the
-"cnt"'th word hence. Mnemonic: \fBe\fRnd-of-word
-.IP "[cnt]E" 16
-Move the cursor to the end of the current word which is delimited by
-"white space" (<sp>,<tab>, or <nl>).
-.IP "[line number]G" 16
-.br
-Move the cursor to the line specified. Of particular use are the
-sequences "1G" and "G", which move the cursor to the beginning and
-the end of the file respectively. Mnemonic: \fBG\fRo-to
-.LP
-.B NOTE:
-The next four commands (^D, ^U, ^F, ^B)
-are not true motion commands, in that they
-cannot be used as the object of commands such as delete or change.
-.IP "[cnt]^D" 16
-Move the cursor down in the file by "cnt" lines (or the last "cnt"
-if a new count isn't given. The initial default is half a page.) The
-screen is simultaneously scrolled up. Mnemonic: \fBD\fRown
-.IP "[cnt]^U" 16
-Move the cursor up in the file by "cnt" lines. The screen is simultaneously
-scrolled down. Mnemonic: \fBU\fRp
-.IP "[cnt]^F" 16
-Move the cursor to the next page. A count moves that many pages.
-Two lines of the previous page are kept on the screen for continuity if
-possible. Mnemonic: \fBF\fRorward-a-page
-.IP "[cnt]^B" 16
-Move the cursor to the previous page. Two lines of the current page
-are kept if possible. Mnemonic: \fBB\fRackup-a-page
-.IP "[cnt](" 16
-Move the cursor to the beginning of the next sentence.
-A sentence is defined as ending with a ".", "!", or "?"
-followed by two spaces or a <nl>.
-.IP "[cnt])" 16
-Move the cursor backwards to the beginning of a sentence.
-.IP "[cnt]}" 16
-Move the cursor to the beginning of the next paragraph. This command
-works best inside \fBnroff\fR documents. It understands two sets of
-\fBnroff\fR macros, \fB\-ms\fR and \fB\-mm\fR, for which the
-commands ".IP", ".LP", ".PP", ".QP", "P", as well as the nroff command ".bp"
-are considered to be paragraph delimiters.
-A blank line also delimits a paragraph.
-The \fBnroff\fR macros that it accepts as paragraph delimiters is
-adjustable. See \fBparagraphs\fR under the \fBSet Commands\fR section.
-.IP "[cnt]{" 16
-Move the cursor backwards to the beginning of a paragraph.
-.IP "]]" 16
-Move the cursor to the next "section", where a section is defined by
-two sets of \fBnroff\fR macros, \fB\-ms\fR and \fB\-mm\fR, in which
-".NH", ".SH", and ".H" delimit a section. A line beginning with a <ff><nl>
-sequence, or a line beginning with a "{" are also considered to
-be section delimiters. The last option makes it
-useful for finding the beginnings of C functions.
-The \fBnroff\fR macros that are used for section delimiters can be adjusted.
-See \fBsections\fR under the \fBSet Commands\fR section.
-.IP "[[" 16
-Move the cursor backwards to the beginning of a section.
-.IP "%" 16
-Move the cursor to the matching parenthesis
-or brace. This is very useful in C or lisp code. If the
-cursor is sitting on a \fB( ) {\fR or \fB}\fR the cursor
-is moved to the matching character at the other end of the
-section. If the cursor is not sitting on a brace or a
-parenthesis, \fBvi\fR searches forward until it finds one
-and then jumps to the match mate.
-.IP "[cnt]H" 16
-If there is no count move the cursor to the top left position on the screen.
-If there is a count, then move the cursor to the beginning of the line
-"cnt" lines from the top of the screen. Mnemonic: \fBH\fRome
-.IP "[cnt]L" 16
-If there is no count move the cursor to the beginning
-of the last line on the screen.
-If there is a count, then move the cursor to the beginning of the line
-"cnt" lines from the bottom of the screen. Mnemonic: \fBL\fRast
-.IP "M" 16
-Move the cursor to the beginning of the middle line on the screen.
-Mnemonic: \fBM\fRiddle
-.IP "m<a-z>" 16
-This command does not move the cursor, but it \fBmarks\fR the place
-in the file and the character "<a-z>" becomes the label for referring
-to this location in the file. See the next two commands. Mnemonic:
-\fBm\fRark
-.B NOTE:
-The mark command is not a motion, and cannot be used as the target
-of commands such as delete.
-.IP "\(aa<a-z>" 16
-Move the cursor to the beginning of the line that is marked with the label
-"<a-z>".
-.IP "\(ga<a-z>" 16
-Move the cursor to the exact position on the line that was marked with
-with the label "<a-z>".
-.IP "\(aa\(aa" 16
-Move the cursor back to the beginning of the line where it was before the
-last "non-relative" move. A "non-relative" move is something such as a
-search or a jump to a specific line in the file, rather than moving the
-cursor or scrolling the screen.
-.IP "\(ga\(ga" 16
-Move the cursor back to the exact spot on the line where it was located
-before the last "non-relative" move.
-.LE
-.NH 2
-Searches
-.LP
-The following commands allow you to search for items in a file.
-.VL 16
-.IP [cnt]f{chr} 16
-.sp 1
-Search forward on the line for the next or "cnt"'th occurrence of
-the character "chr". The cursor is placed \fBat\fR the character
-of interest. Mnemonic: \fBf\fRind character
-.IP [cnt]F{chr} 16
-.sp 1
-Search backwards on the line for the next or "cnt"'th occurrence of
-the character "chr". The cursor is placed \fBat\fR the character
-of interest.
-.IP [cnt]t{chr} 16
-.sp 1
-Search forward on the line for the next or "cnt"'th occurrence of
-the character "chr". The cursor is placed \fBjust preceding\fR
-the character of interest. Mnemonic: move cursor up \fBt\fRo character
-.IP [cnt]T{chr} 16
-.sp 1
-Search backwards on the line for the next or "cnt"'th occurrence of
-the character "chr". The cursor is placed \fBjust preceding\fR
-the character of interest.
-.IP "[cnt];" 16
-Repeat the last "f", "F", "t" or "T" command.
-.IP "[cnt]," 16
-Repeat the last "f", "F", "t" or "T" command, but in the opposite
-search direction. This is useful if you overshoot.
-.IP "[cnt]/[string]/<nl>" 16
-.br
-Search forward for the next occurrence of "string".
-Wrap around at the end of the file
-does occur.
-The final \fB</>\fR is not required.
-.IP "[cnt]?[string]?<nl>" 16
-.br
-Search backwards for the next occurrence of "string". If a count is
-specified, the count becomes the new window size. Wrap around at the beginning
-of the file does occur.
-The final \fB<?>\fR is not required.
-.IP n 16
-Repeat the last /[string]/ or ?[string]? search. Mnemonic: \fBn\fRext
-occurrence.
-.IP N 16
-Repeat the last /[string]/ or ?[string]? search, but in the reverse
-direction.
-.IP ":g/[string]/[editor command]<nl>" 16
-.sp 1
-Using the \fB:\fR syntax it is possible to do global searches ala the
-standard UNIX "ed" editor.
-.LE
-.NH 2
-Text Insertion
-.LP
-The following commands allow for the insertion of text. All multicharacter
-text insertions are terminated with an <esc> character.
-The last change
-can always be \fBundone\fR by typing a \fBu\fR.
-The text insert in insertion mode can contain newlines.
-.VL 16
-.IP a{text}<esc> 16
-Insert text immediately following the cursor position.
-Mnemonic: \fBa\fRppend
-.IP A{text}<esc> 16
-Insert text at the end of the current line.
-Mnemonic: \fBA\fRppend
-.IP i{text}<esc> 16
-Insert text immediately preceding the cursor position.
-Mnemonic: \fBi\fRnsert
-.IP I{text}<esc> 16
-Insert text at the beginning of the current line.
-.IP o{text}<esc> 16
-Insert a new line after the line on which the cursor appears and
-insert text there. Mnemonic: \fBo\fRpen new line
-.IP O{text}<esc> 16
-Insert a new line preceding the line on which the cursor appears
-and insert text there.
-.LE
-.NH 2
-Text Deletion
-.LP
-The following commands allow the user to delete text in various ways.
-All changes can always be \fBundone\fR by typing the \fBu\fR command.
-.VL 16
-.IP "[cnt]x" 16
-Delete the character or characters starting at the cursor position.
-.IP "[cnt]X" 16
-Delete the character or characters starting at the character preceding
-the cursor position.
-.IP "D" 16
-Deletes the remainder of the line starting at the cursor.
-Mnemonic: \fBD\fRelete the rest of line
-.IP "[cnt]d{motion}" 16
-.br
-Deletes one or more occurrences of the specified motion.
-Any motion from sections 4.1 and 4.2 can be used here.
-The d can be stuttered (e.g. [cnt]dd) to delete cnt lines.
-.LE
-.NH 2
-Text Replacement
-.LP
-The following commands allow the user to simultaneously delete and
-insert new text. All such actions can be \fBundone\fR by typing
-\fBu\fR following the command.
-.VL 16
-.IP "r<chr>" 16
-Replaces the character at the current cursor position with <chr>. This
-is a one character replacement. No <esc> is required for termination.
-Mnemonic: \fBr\fReplace character
-.IP "R{text}<esc>" 16
-Starts overlaying the characters on the screen with whatever you type.
-It does not stop until an <esc> is typed.
-.IP "[cnt]s{text}<esc>" 16
-Substitute for "cnt" characters beginning at the current cursor
-position. A "$" will appear at the position in the text where the
-"cnt"'th character appears so you will know how much you are erasing.
-Mnemonic: \fBs\fRubstitute
-.IP "[cnt]S{text}<esc>" 16
-Substitute for the entire current line (or lines). If no count is given,
-a "$" appears at the end of the current line. If a count of more than
-1 is given, all the lines to be replaced are deleted before the insertion
-begins.
-.IP "[cnt]c{motion}{text}<esc>" 16
-.br
-Change the specified "motion" by replacing it with the
-insertion text. A "$" will appear at the end of the last item
-that is being deleted unless the deletion involves whole lines.
-Motion's can be any motion from sections 4.1 or 4.2.
-Stuttering the c (e.g. [cnt]cc) changes cnt lines.
-.LE
-.NH 2
-Moving Text
-.LP
-\fBVi\fR provides a number of ways of moving chunks of text around.
-There are nine buffers into which each piece of text which is deleted
-or "yanked" is put in addition to the "undo" buffer.
-The most recent deletion or yank is in the "undo" buffer and also
-usually in buffer
-1, the next most recent in buffer 2, and so forth. Each new deletion
-pushes down all the older deletions. Deletions older than 9
-disappear. There is also
-a set of named registers, a-z, into which text can optionally
-be placed. If any delete or replacement type command is preceded
-by \fB"<a-z>\fR, that named buffer will contain the text deleted
-after the command is executed. For example, \fB"a3dd\fR will delete
-three lines starting at the current line and put them in buffer \fB"a\fR.*
-.FS
-* Referring to an upper case letter as a buffer name (A-Z) is the
-same as referring to the lower case letter, except that text placed
-in such a buffer is appended to it instead of replacing it.
-.FE
-There are two more basic commands and
-some variations useful in getting and putting text into a file.
-.VL 16
-.IP ["<a-z>][cnt]y{motion} 16
-.sp 1
-Yank the specified item or "cnt" items and put in the "undo" buffer or
-the specified buffer. The variety of "items" that can be yanked
-is the same as those that can be deleted with the "d" command or
-changed with the "c" command. In the same way that "dd" means
-delete the current line and "cc" means replace the current line,
-"yy" means yank the current line.
-.IP ["<a-z>][cnt]Y 16
-Yank the current line or the "cnt" lines starting from the current
-line. If no buffer is specified, they will go into the "undo" buffer,
-like any delete would. It is equivalent to "yy".
-Mnemonic: \fBY\fRank
-.IP ["<a-z>]p 16
-Put "undo" buffer or the specified buffer down \fBafter\fR the cursor.
-If whole lines were yanked or deleted into the buffer, then they will be
-put down on the line following the line the cursor is on. If
-something else was deleted, like a word or sentence, then it will
-be inserted immediately following the cursor.
-Mnemonic: \fBp\fRut buffer
-.IP
-It should be noted that text in the named buffers remains there when you
-start editing a new file with the \fB:e file<esc>\fR command. Since
-this is so, it is possible to copy or delete text from one file and
-carry it over to another file in the buffers.
-However, the undo buffer and the ability to undo are lost when
-changing files.
-.IP ["<a-z>]P 16
-Put "undo" buffer or the specified buffer down \fBbefore\fR the cursor.
-If whole lines where yanked or deleted into the buffer, then they will be
-put down on the line preceding the line the cursor is on. If
-something else was deleted, like a word or sentence, then it will
-be inserted immediately preceding the cursor.
-.IP [cnt]>{motion} 16
-The shift operator will right shift all the text from the line on which
-the cursor is located to the line where the \fBmotion\fR is located.
-The text is shifted by one \fBshiftwidth\fR. (See section 6.)
-\fB>>\fR means right shift the current line or lines.
-.IP [cnt]<{motion} 16
-The shift operator will left shift all the text from the line on which
-the cursor is located to the line where the \fBitem\fR is located.
-The text is shifted by one \fBshiftwidth\fR. (See section 6.)
-\fB<<\fR means left shift the current line or lines.
-Once the line has reached the left margin it is not further affected.
-.IP [cnt]={motion} 16
-Prettyprints the indicated area according to
-.B lisp
-conventions.
-The area should be a lisp s-expression.
-.LE
-.NH 2
-Miscellaneous Commands
-.LP
-\fBVi\fR has a number of miscellaneous commands that are very
-useful. They are:
-.VL 16
-.IP ZZ 16
-This is the normal way to exit from vi.
-If any changes have been made, the file is written out.
-Then you are returned to the shell.
-.IP ^L 16
-Redraw the current screen. This is useful if someone "write"s you
-while you are in "vi" or if for any reason garbage gets onto the
-screen.
-.IP ^R 16
-On dumb terminals, those not having the "delete line" function
-(the vt100 is such a terminal), \fBvi\fR saves redrawing the
-screen when you delete a line by just marking the line with an
-"@" at the beginning and blanking the line. If you want to
-actually get rid of the lines marked with "@" and see what the
-page looks like, typing a ^R will do this.
-.IP \s+4.\s0 16
-"Dot" is a particularly useful command. It repeats the last
-text modifying command. Therefore you can type a command once and
-then to another place and repeat it by just typing ".".
-.IP u 16
-Perhaps the most important command in the editor,
-u undoes the last command that changed the buffer.
-Mnemonic: \fBu\fRndo
-.IP U 16
-Undo all the text modifying commands performed on the current line
-since the last time you moved onto it.
-.IP [cnt]J 16
-Join the current line and the following line. The <nl> is deleted
-and the two lines joined, usually with a space between the
-end of the first line and the beginning of what was the second
-line. If the first line ended with a "period", then two spaces
-are inserted.
-A count joins the next cnt lines.
-Mnemonic: \fBJ\fRoin lines
-.IP Q 16
-Switch to \fBex\fR editing mode.
-In this mode \fBvi\fR will behave very much like \fBed\fR.
-The editor in this mode will operate on single lines normally and
-will not attempt to keep the "window" up to date.
-Once in this mode it is also possible to switch to the \fBopen\fR
-mode of editing. By entering the command \fB[line number]open<nl>\fR
-you enter this mode. It is similar to the normal visual mode
-except the window is only \fBone\fR line long.
-Mnemonic: \fBQ\fRuit visual mode
-.IP ^] 16
-An abbreviation for a tag command.
-The cursor should be positioned at the beginning of a word.
-That word is taken as a tag name, and the tag with that
-name is found as if it had been typed in a :tag command.
-.IP [cnt]!{motion}{UNIX\ cmd}<nl> 16
-.br
-Any UNIX filter
-(e.g. command that reads the standard input and outputs something
-to the standard output) can be sent a section of the current file and
-have the output of the command replace the original text. Useful
-examples are programs like \fBcb\fR, \fBsort\fR, and
-\fBnroff\fR. For instance, using \fBsort\fR it would be possible to
-sort a section of the current file into a new list.
-Using \fB!!\fR means take a line or lines starting at the line the
-cursor is currently on and pass them to the UNIX command.
-.B NOTE:
-To just escape to the shell for one command,
-use :!{cmd}<nl>, see section 5.
-.IP z{cnt}<nl> 16
-This resets the current window size to "cnt" lines and redraws the screen.
-.LE
-.NH 2
-Special Insert Characters
-.LP
-There are some characters that have special meanings during
-insert modes. They are:
-.VL 16
-.IP ^V 16
-During inserts, typing a ^V allows you to quote control characters
-into the file. Any character typed after the ^V will be inserted
-into the file.
-.IP [^]^D\ or\ [0]^D 16
-<^D> without any argument backs up one \fBshiftwidth\fR. This is necessary
-to remove indentation that was inserted by the \fBautoindent\fR feature.
-^<^D> temporarily removes all the autoindentation, thus placing the cursor
-at the left margin. On the next line, the previous indent level will be
-restored. This is useful for putting "labels" at the left margin.
-0<^D> says remove all autoindents and stay that way. Thus the cursor
-moves to the left margin and stays there on successive lines until
-<tab>'s are typed. As with the <tab>, the <^D> is only effective before
-any other "non-autoindent" controlling characters are typed.
-Mnemonic: \fBD\fRelete a shiftwidth
-.IP ^W 16
-If the cursor is sitting on a word, <^W> moves the cursor back to the beginning
-of the word, thus erasing the word from the insert.
-Mnemonic: erase \fBW\fRord
-.IP <bs> 16
-The backspace always serves as an erase during insert modes in addition
-to your normal "erase" character. To insert a <bs> into your file, use
-the <^V> to quote it.
-.LE
-.NH 1
-\fB:\fR Commands
-.LP
-Typing a ":" during command mode causes \fBvi\fR to put the cursor at
-the bottom on the screen in preparation for a command. In the
-":" mode, \fBvi\fR can be given most \fBed\fR commands. It is
-also from this mode that you exit from \fBvi\fR or switch to different
-files. All commands of this variety are terminated by a <nl>, <cr>,
-or <esc>.
-.VL 16
-.IP ":w[!] [file]" 16
-Causes \fBvi\fR to write out the current text to the disk. It is
-written to the file you are editing unless "file" is supplied. If
-"file" is supplied, the write is directed to that file instead. If
-that file already exists, \fBvi\fR will not perform the write unless
-the "!" is supplied indicating you
-.I really
-want to destroy the older copy of the file.
-.IP :q[!] 16
-Causes \fBvi\fR to exit. If you have modified the file you are
-looking at currently and haven't written it out, \fBvi\fR will
-refuse to exit unless the "!" is supplied.
-.IP ":e[!] [+[cmd]] [file]" 16
-.sp 1
-Start editing a new file called "file" or start editing the current
-file over again. The command ":e!" says "ignore the changes I've made
-to this file and start over from the beginning". It is useful if
-you really mess up the file. The optional "+" says instead of starting
-at the beginning, start at the "end", or,
-if "cmd" is supplied, execute "cmd" first.
-Useful cases of this are where cmd is "n" (any integer) which starts
-at line number n,
-and "/text", which searches for "text" and starts at the line where
-it is found.
-.IP "^^" 16
-Switch back to the place you were before your last tag command.
-If your last tag command stayed within the file, ^^ returns to that tag.
-If you have no recent tag command, it will return to the
-same place in the previous file that it was showing when you switched
-to the current file.
-.IP ":n[!]" 16
-Start editing the next file in the argument list. Since \fBvi\fR
-can be called with multiple file names, the ":n" command tells it to
-stop work on the current file and switch to the next file. If the
-current file was modifies, it has to be written out before the ":n"
-will work or else the "!" must be supplied, which says discard the
-changes I made to the current file.
-.IP ":n[!] file [file file ...]" 16
-.sp
-Replace the current argument list with a new list of files and start
-editing the first file in this new list.
-.IP ":r file" 16
-Read in a copy of "file" on the line after the cursor.
-.IP ":r !cmd" 16
-Execute the "cmd" and take its output and put it into the file after
-the current line.
-.IP ":!cmd" 16
-Execute any UNIX shell command.
-.IP ":ta[!] tag" 16
-.B Vi
-looks in the file named
-.B tags
-in the current directory.
-.B Tags
-is a file of lines in the format:
-.sp 1
-.ti +8
-tag filename \fBvi\fR-search-command
-.sp 1
-If \fBvi\fR finds the tag you specified in the \fB:ta\fR command,
-it stops editing the current file if necessary and if the current file is
-up to date on the disk and switches to the file specified and uses the
-search pattern specified to find the "tagged" item of interest. This
-is particularly useful when editing multi-file C programs such as the
-operating system. There is a program called \fBctags\fR which will
-generate an appropriate \fBtags\fR file for C and f77
-programs so that by saying
-\fB:ta function<nl>\fR you will be switched to that function.
-It could also be useful when editing multi-file documents, though the
-\fBtags\fR file would have to be generated manually.
-.LE
-.NH 1
-Special Arrangements for Startup
-.PP
-\fBVi\fR takes the value of \fB$TERM\fR and looks up the characteristics
-of that terminal in the file \fB/etc/termcap\fR.
-If you don't know \fBvi\fR's name for the terminal you are working
-on, look in \fB/etc/termcap\fR.
-.PP
-When \fBvi\fR starts, it attempts to read the variable EXINIT
-from your environment.*
-If that exists, it takes the values in it as the default values
-for certain of its internal constants. See the section on "Set Values"
-for further details.
-If EXINIT doesn't exist you will get all the normal defaults.
-.FS
-* On version 6 systems
-Instead of EXINIT, put the startup commands in the file .exrc
-in your home directory.
-.FE
-.PP
-Should you inadvertently hang up the phone while inside
-.B vi ,
-or should the computer crash,
-all may not be lost.
-Upon returning to the system, type:
-.DS
-vi \-r file
-.DE
-This will normally recover the file. If there is more than one
-temporary file for a specific file name, \fBvi\fR recovers the
-newest one. You can get an older version by recovering the
-file more than once.
-The command "vi -r" without a file name gives you the list of files
-that were saved in the last system crash
-(but
-.I not
-the file just saved when the phone was hung up).
-.NH 1
-Set Commands
-.LP
-\fBVi\fR has a number of internal variables and switches which can be
-set to achieve special affects.
-These options come in three forms, those that are switches, which toggle
-from off to on and back, those that require a numeric value, and those
-that require an alphanumeric string value.
-The toggle options are set by a command of the form:
-.DS
-:set option<nl>
-.DE
-and turned off with the command:
-.DS
-:set nooption<nl>
-.DE
-Commands requiring a value are set with a command of the form:
-.DS
-:set option=value<nl>
-.DE
-To display the value of a specific option type:
-.DS
-:set option?<nl>
-.DE
-To display only those that you have changed type:
-.DS
-:set<nl>
-.DE
-and to display the long table of all the settable parameters and
-their current values type:
-.DS
-:set all<nl>
-.DE
-.PP
-Most of the options have a long form and an abbreviation. Both are
-listed in the following table as well as the normal default value.
-.PP
-To arrange to have values other than the default used every time you
-enter
-.B vi ,
-place the appropriate
-.B set
-command in EXINIT in your environment, e.g.
-.DS
-EXINIT='set ai aw terse sh=/bin/csh'
-export EXINIT
-.DE
-or
-.DS
-setenv EXINIT 'set ai aw terse sh=/bin/csh'
-.DE
-for
-.B sh
-and
-.B csh ,
-respectively.
-These are usually placed in your .profile or .login.
-If you are running a system without environments (such as version 6)
-you can place the set command in the file .exrc in your home
-directory.
-.VL 16
-.IP autoindent\ ai 16
-Default: noai Type: toggle
-.br
-When in autoindent mode, vi helps you indent code by starting each
-line in the same column as the preceding line.
-Tabbing to the right with <tab> or <^T> will move this boundary to
-the right, and it can be moved to the left with <^D>.
-.IP autoprint\ ap 16
-Default: ap Type: toggle
-.br
-Causes the current line to be printed after each ex text modifying command.
-This is not of much interest in the normal \fBvi\fR visual mode.
-.IP autowrite\ aw 16
-Default: noaw type: toggle
-.br
-Autowrite causes an automatic write to be done if there are unsaved
-changes before certain commands which change files or otherwise
-interact with the outside world.
-These commands are :!, :tag, :next, :rewind, ^^, and ^].
-.IP beautify\ bf 16
-Default: nobf Type: toggle
-.br
-Causes all control characters except <tab>, <nl>, and <ff> to be discarded.
-.IP directory\ dir 16
-Default: dir=/tmp Type: string
-.br
-This is the directory in which \fBvi\fR puts its temporary file.
-.IP errorbells\ eb 16
-Default: noeb Type: toggle
-.br
-Error messages are preceded by a <bell>.
-.IP hardtabs\ ht 16
-Default: hardtabs=8 Type: numeric
-.br
-This option contains the value of hardware tabs in your terminal, or
-of software tabs expanded by the Unix system.
-.IP ignorecase\ ic 16
-Default: noic Type: toggle
-.br
-All upper case characters are mapped to lower case in regular expression
-matching.
-.IP lisp 16
-Default: nolisp Type: toggle
-.br
-Autoindent for \fBlisp\fR code. The commands \fB( ) [[\fR and \fB]]\fR
-are modified appropriately to affect s-expressions and functions.
-.IP list 16
-Default: nolist Type: toggle
-.br
-All printed lines have the <tab> and <nl> characters displayed visually.
-.IP magic 16
-Default: magic Type: toggle
-.br
-Enable the metacharacters for matching. These include \fB. * < > [string]
-[^string]\fR and \fB[<chr>-<chr>]\fR.
-.IP number\ nu 16
-Default: nonu Type: toggle
-.br
-Each line is displayed with its line number.
-.IP open 16
-Default: open Type: toggle
-.br
-When set, prevents entering open or visual modes from ex or edit.
-Not of interest from vi.
-.IP optimize\ opt 16
-Default: opt Type: toggle
-.br
-Basically of use only when using the \fBex\fR capabilities. This
-option prevents automatic <cr>s from taking place,
-and speeds up output of indented lines,
-at the expense of losing typeahead on some versions of UNIX.
-.IP paragraphs\ para 16
-Default: para=IPLPPPQPP\ bp Type: string
-.br
-Each pair of characters in the string indicate \fBnroff\fR macros
-which are to be treated as the beginning of a paragraph for the
-\fB{\fR and \fB}\fR commands. The default string is for the \fB-ms\fR
-and \fB-mm\fR macros.
-To indicate one letter \fBnroff\fR macros, such as \fB.P\fR or \fB.H\fR,
-quote a space in for the second character position. For example:
-.sp 1
-.ti +8
-:set paragraphs=P\e bp<nl>
-.sp 1
-would cause \fBvi\fR to consider \fB.P\fR and \fB.bp\fR as paragraph
-delimiters.
-.IP prompt 16
-Default: prompt Type: toggle
-.br
-In
-.B ex
-command mode the prompt character \fB:\fR will be printed when
-\fBex\fR is waiting for a command. This is not of interest from vi.
-.IP redraw 16
-Default: noredraw Type: toggle
-.br
-On dumb terminals, force the screen to always be up to date,
-by sending great amounts of output. Useful only at high speeds.
-.IP report 16
-Default: report=5 Type: numeric
-.br
-This sets the threshold for the number of lines modified. When
-more than this number of lines are modified, removed, or yanked,
-\fBvi\fR will report the number of lines changed at the bottom of
-the screen.
-.IP scroll 16
-Default: scroll={1/2 window} Type: numeric
-.br
-This is the number of lines that the screen scrolls up or down when
-using the <^U> and <^D> commands.
-.IP sections 16
-Default: sections=SHNHH HU Type: string
-.br
-Each two character pair of this string specify \fBnroff\fR macro names
-which are to be treated as the beginning of a section by the
-\fB]]\fR and \fB[[\fR commands. The default string is for the \fB-ms\fR
-and \fB-mm\fR macros.
-To enter one letter \fBnroff\fR macros, use a quoted space as the
-second character.
-See \fBparagraphs\fR for a fuller explanation.
-.IP shell\ sh 16
-Default: sh=from environment SHELL or /bin/sh Type: string
-.br
-This is the name of the \fBsh\fR to be used for "escaped" commands.
-.IP shiftwidth\ sw 16
-Default: sw=8 Type: numeric
-.br
-This is the number of spaces that a <^T> or <^D> will move over for
-indenting, and the amount < and > shift by.
-.IP showmatch\ sm 16
-Default: nosm Type: toggle
-.br
-When a \fB)\fR or \fB}\fR is typed, show the matching \fB(\fR or \fB{\fR
-by moving the cursor to it for one second if it is on the current screen.
-.IP slowopen\ slow 16
-Default: terminal dependent Type: toggle
-.br
-On terminals that are slow and unintelligent, this option prevents the
-updating of the screen some of the time to improve speed.
-.IP tabstop\ ts 16
-Default: ts=8 Type: numeric
-.br
-<tab>s are expanded to boundaries that are multiples of this value.
-.IP taglength\ tl 16
-Default: tl=0 Type: numeric
-.br
-If nonzero, tag names are only significant to this many characters.
-.IP term 16
-Default: (from environment \fBTERM\fP, else dumb) Type: string
-.br
-This is the terminal and controls the visual displays. It cannot be
-changed when in "visual" mode,
-you have to Q to command mode, type a
-set term command, and do ``vi.'' to get back into visual.
-Or exit vi, fix $TERM, and reenter.
-The definitions that drive a particular
-terminal type are found in the file \fB/etc/termcap\fR.
-.IP terse 16
-Default: terse Type: toggle
-.br
-When set, the error diagnostics are short.
-.IP warn 16
-Default: warn Type: toggle
-.br
-The user is warned if she/he tries to escape to
-the shell without writing out the current changes.
-.IP window 16
-Default: window={8 at 600 baud or less, 16 at 1200 baud, and screen
-size \- 1 at 2400 baud or more} Type: numeric
-.br
-This is the number of lines in the window whenever \fBvi\fR must redraw
-an entire screen. It is useful to make this size smaller if you are
-on a slow line.
-.IP w300,\ w1200,\ w9600
-.br
-These set window, but only within the corresponding speed ranges.
-They are useful in an EXINIT to fine tune window sizes.
-For example,
-.DS
-set w300=4 w1200=12
-.DE
-causes a 4 lines window at speed up to 600 baud, a 12 line window at 1200
-baud, and a full screen (the default) at over 1200 baud.
-.IP wrapscan\ ws 16
-Default: ws Type: toggle
-.br
-Searches will wrap around the end of the file when is option is set. When
-it is off, the search will terminate when it reaches the end or the
-beginning of the file.
-.IP wrapmargin\ wm 16
-Default: wm=0 Type: numeric
-.br
-\fBVi\fR will automatically insert a <nl> when it finds a natural
-break point (usually a <sp> between words) that occurs within
-"wm" spaces of the right margin.
-Therefore with "wm=0" the option is off. Setting it to 10 would
-mean that any time you are within 10 spaces of the right margin
-\fBvi\fR would be looking for a <sp> or <tab> which it could
-replace with a <nl>. This is convenient for people who forget
-to look at the screen while they type.
-(In version 3, wrapmargin behaves more like nroff, in that the
-boundary specified by the distance from the right edge of the screen
-is taken as the rightmost edge of the area where a break is allowed,
-instead of the leftmost edge.)
-.IP writeany\ wa 16
-Default: nowa Type: toggle
-.br
-\fBVi\fR normally makes a number of checks before it writes out a file.
-This prevents the user from inadvertently destroying a file. When the
-"writeany" option is enabled, \fBvi\fR no longer makes these checks.
-.LE
diff --git a/docs/USD.doc/vitut/vi.chars b/docs/USD.doc/vitut/