Upgrade to vi 1.03 (first step - doc still remains).
authorJordan K. Hubbard <jkh@FreeBSD.org>
Mon, 24 Jan 1994 23:45:23 +0000 (23:45 +0000)
committerJordan K. Hubbard <jkh@FreeBSD.org>
Mon, 24 Jan 1994 23:45:23 +0000 (23:45 +0000)
usr.bin/vi/cut.c
usr.bin/vi/main.c
usr.bin/vi/svi/svi_line.c
usr.bin/vi/term.c
usr.bin/vi/vi.1

index 1638296..5a9b292 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)cut.c      8.19 (Berkeley) 1/11/94";
+static char sccsid[] = "@(#)cut.c      8.20 (Berkeley) 1/23/94";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -98,7 +98,8 @@ cut(sp, ep, cbp, namep, fm, tm, flags)
            LF_ISSET(CUT_LINEMODE) ? " LINE MODE" : "");
 #endif
        if (cbp == NULL) {
            LF_ISSET(CUT_LINEMODE) ? " LINE MODE" : "");
 #endif
        if (cbp == NULL) {
-               if (LF_ISSET(CUT_DELETE) && fm->lno != tm->lno) {
+               if (LF_ISSET(CUT_DELETE) &&
+                   (LF_ISSET(CUT_LINEMODE) || fm->lno != tm->lno)) {
                        (void)cb_rotate(sp);
                        name = '1';
                        goto defcb;
                        (void)cb_rotate(sp);
                        name = '1';
                        goto defcb;
index 26d9983..3413a47 100644 (file)
@@ -38,7 +38,7 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     8.63 (Berkeley) 1/11/94";
+static char sccsid[] = "@(#)main.c     8.65 (Berkeley) 1/23/94";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -200,11 +200,16 @@ main(argc, argv)
        if (snapshot)
                F_SET(gp, G_SNAPSHOT);
 
        if (snapshot)
                F_SET(gp, G_SNAPSHOT);
 
-       /* Build and initialize the first/current screen. */
+       /*
+        * Build and initialize the first/current screen.  This is a bit
+        * tricky.  If an error is returned, we may or may not have a
+        * screen structure.  If we have a screen structure, put it on a
+        * display queue so that the error messages get displayed.
+        */
        if (screen_init(NULL, &sp, flags)) {
        if (screen_init(NULL, &sp, flags)) {
-               if (sp == NULL)
-                       goto err2;
-               goto err1;
+               if (sp != NULL)
+                       CIRCLEQ_INSERT_HEAD(&__global_list->dq, sp, q);
+               goto err;
        }
        sp->saved_vi_mode = saved_vi_mode;
        CIRCLEQ_INSERT_HEAD(&__global_list->dq, sp, q);
        }
        sp->saved_vi_mode = saved_vi_mode;
        CIRCLEQ_INSERT_HEAD(&__global_list->dq, sp, q);
@@ -220,13 +225,12 @@ main(argc, argv)
        }
 
        if (set_window_size(sp, 0, 0))  /* Set the window size. */
        }
 
        if (set_window_size(sp, 0, 0))  /* Set the window size. */
-               goto err1;
-
+               goto err;
        if (opts_init(sp))              /* Options initialization. */
        if (opts_init(sp))              /* Options initialization. */
-               goto err1;
-       if (readonly)
+               goto err;
+       if (readonly)                   /* Global read-only bit. */
                O_SET(sp, O_READONLY);
                O_SET(sp, O_READONLY);
-       if (silent) {
+       if (silent) {                   /* Ex batch mode. */
                O_CLR(sp, O_AUTOPRINT);
                O_CLR(sp, O_PROMPT);
                O_CLR(sp, O_VERBOSE);
                O_CLR(sp, O_AUTOPRINT);
                O_CLR(sp, O_PROMPT);
                O_CLR(sp, O_VERBOSE);
@@ -238,7 +242,7 @@ main(argc, argv)
                if (strtol(optarg, &p, 10) < 0 || *p)
                        errx(1, "illegal window size -- %s", optarg);
                (void)snprintf(path, sizeof(path), "window=%s", optarg);
                if (strtol(optarg, &p, 10) < 0 || *p)
                        errx(1, "illegal window size -- %s", optarg);
                (void)snprintf(path, sizeof(path), "window=%s", optarg);
-               a.bp = path;
+               a.bp = (CHAR_T *)path;
                a.len = strlen(path);
                b.bp = NULL;
                b.len = 0;
                a.len = strlen(path);
                b.bp = NULL;
                b.len = 0;
@@ -251,11 +255,11 @@ main(argc, argv)
 
        /* Keymaps, special keys, must follow option initializations. */
        if (term_init(sp))
 
        /* Keymaps, special keys, must follow option initializations. */
        if (term_init(sp))
-               goto err1;
+               goto err;
 
 #ifdef DIGRAPHS
        if (digraph_init(sp))           /* Digraph initialization. */
 
 #ifdef DIGRAPHS
        if (digraph_init(sp))           /* Digraph initialization. */
-               goto err1;
+               goto err;
 #endif
 
        /*
 #endif
 
        /*
@@ -280,7 +284,7 @@ main(argc, argv)
                    (p = getenv("EXINIT")) != NULL)
                        if ((p = strdup(p)) == NULL) {
                                msgq(sp, M_SYSERR, NULL);
                    (p = getenv("EXINIT")) != NULL)
                        if ((p = strdup(p)) == NULL) {
                                msgq(sp, M_SYSERR, NULL);
-                               goto err1;
+                               goto err;
                        } else {
                                (void)ex_icmd(sp, NULL, p, strlen(p));
                                free(p);
                        } else {
                                (void)ex_icmd(sp, NULL, p, strlen(p));
                                free(p);
@@ -323,15 +327,15 @@ main(argc, argv)
 
        /* Use a tag file or recovery file if specified. */
        if (tag_f != NULL && ex_tagfirst(sp, tag_f))
 
        /* Use a tag file or recovery file if specified. */
        if (tag_f != NULL && ex_tagfirst(sp, tag_f))
-               goto err1;
+               goto err;
        else if (rec_f != NULL && rcv_read(sp, rec_f))
        else if (rec_f != NULL && rcv_read(sp, rec_f))
-               goto err1;
+               goto err;
 
        /* Append any remaining arguments as file names. */
        if (*argv != NULL)
                for (; *argv != NULL; ++argv)
                        if (file_add(sp, NULL, *argv, 0) == NULL)
 
        /* Append any remaining arguments as file names. */
        if (*argv != NULL)
                for (; *argv != NULL; ++argv)
                        if (file_add(sp, NULL, *argv, 0) == NULL)
-                               goto err1;
+                               goto err;
 
        /*
         * If no recovery or tag file, get an EXF structure.
 
        /*
         * If no recovery or tag file, get an EXF structure.
@@ -340,9 +344,9 @@ main(argc, argv)
        if (tag_f == NULL && rec_f == NULL) {
                if ((frp = file_first(sp)) == NULL &&
                    (frp = file_add(sp, NULL, NULL, 1)) == NULL)
        if (tag_f == NULL && rec_f == NULL) {
                if ((frp = file_first(sp)) == NULL &&
                    (frp = file_add(sp, NULL, NULL, 1)) == NULL)
-                       goto err1;
+                       goto err;
                if (file_init(sp, frp, NULL, 0))
                if (file_init(sp, frp, NULL, 0))
-                       goto err1;
+                       goto err;
        }
 
        /* Set up the argument pointer. */
        }
 
        /* Set up the argument pointer. */
@@ -387,25 +391,25 @@ main(argc, argv)
        if (excmdarg != NULL)
                if (IN_EX_MODE(sp)) {
                        if (term_push(sp, excmdarg, strlen(excmdarg), 0, 0))
        if (excmdarg != NULL)
                if (IN_EX_MODE(sp)) {
                        if (term_push(sp, excmdarg, strlen(excmdarg), 0, 0))
-                               goto err1;
+                               goto err;
                } else if (IN_VI_MODE(sp)) {
                        if (term_push(sp, "\n", 1, 0, 0))
                } else if (IN_VI_MODE(sp)) {
                        if (term_push(sp, "\n", 1, 0, 0))
-                               goto err1;
+                               goto err;
                        if (term_push(sp, excmdarg, strlen(excmdarg), 0, 0))
                        if (term_push(sp, excmdarg, strlen(excmdarg), 0, 0))
-                               goto err1;
+                               goto err;
                        if (term_push(sp, ":", 1, 0, 0))
                        if (term_push(sp, ":", 1, 0, 0))
-                               goto err1;
+                               goto err;
                }
                
        /* Vi reads from the terminal. */
        if (!F_ISSET(gp, G_ISFROMTTY) && !F_ISSET(sp, S_EX)) {
                msgq(sp, M_ERR, "Vi's standard input must be a terminal.");
                }
                
        /* Vi reads from the terminal. */
        if (!F_ISSET(gp, G_ISFROMTTY) && !F_ISSET(sp, S_EX)) {
                msgq(sp, M_ERR, "Vi's standard input must be a terminal.");
-               goto err1;
+               goto err;
        }
 
        for (;;) {
                if (sp->s_edit(sp, sp->ep))
        }
 
        for (;;) {
                if (sp->s_edit(sp, sp->ep))
-                       goto err2;
+                       goto err;
 
                /*
                 * Edit the next screen on the display queue, or, move
 
                /*
                 * Edit the next screen on the display queue, or, move
@@ -427,34 +431,29 @@ main(argc, argv)
                switch (F_ISSET(sp, S_SCREENS)) {
                case S_EX:
                        if (sex_screen_init(sp))
                switch (F_ISSET(sp, S_SCREENS)) {
                case S_EX:
                        if (sex_screen_init(sp))
-                               goto err2;
+                               goto err;
                        break;
                case S_VI_CURSES:
                        if (svi_screen_init(sp))
                        break;
                case S_VI_CURSES:
                        if (svi_screen_init(sp))
-                               goto err2;
+                               goto err;
                        break;
                case S_VI_XAW:
                        if (xaw_screen_init(sp))
                        break;
                case S_VI_XAW:
                        if (xaw_screen_init(sp))
-                               goto err2;
+                               goto err;
                        break;
                default:
                        abort();
                }
        }
 
                        break;
                default:
                        abort();
                }
        }
 
-       /*
-        * Two error paths.  The first means that something failed before
-        * we called a screen routine.  Swap the message pointers between
-        * the SCR and the GS, so messages get displayed.  The second is
-        * something failed in a screen.  NOTE: sp may be GONE when the
-        * screen returns, so only the gp can be trusted.
-        */
        eval = 0;
        eval = 0;
-       if (0) {
-err1:          gp->msgq.lh_first = sp->msgq.lh_first;
-err2:          eval = 1;
-       }
+       if (0)
+err:           eval = 1;
 
 
+       /*
+        * NOTE: sp may be GONE when the screen returns, so only
+        * the gp can be trusted.
+        */
        gs_end(gp);
 
        /*
        gs_end(gp);
 
        /*
@@ -473,9 +472,8 @@ err2:               eval = 1;
         * other systems mess up characters typed after the quit command to
         * vi but before vi actually exits.
         */
         * other systems mess up characters typed after the quit command to
         * vi but before vi actually exits.
         */
-       if (F_ISSET(gp, G_ISFROMTTY) &&
-           tcsetattr(STDIN_FILENO, TCSADRAIN, &gp->original_termios))
-               err(1, "tcsetattr");
+       if (F_ISSET(gp, G_ISFROMTTY))
+               (void)tcsetattr(STDIN_FILENO, TCSADRAIN, &gp->original_termios);
        exit(eval);
 }
 
        exit(eval);
 }
 
index 80d736d..2370a0f 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)svi_line.c 8.16 (Berkeley) 12/23/93";
+static char sccsid[] = "@(#)svi_line.c 8.18 (Berkeley) 1/22/94";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -200,6 +200,8 @@ svi_line(sp, ep, smp, yp, xp)
                offset_in_line = smp->c_sboff;
                offset_in_char = smp->c_scoff;
                p = &p[offset_in_line];
                offset_in_line = smp->c_sboff;
                offset_in_char = smp->c_scoff;
                p = &p[offset_in_line];
+               if (skip_screens != 0)
+                       cols_per_screen = sp->cols;
        } else if (smp != HMAP &&
            SMAP_CACHE(tsmp = smp - 1) && tsmp->lno == smp->lno) {
                if (tsmp->c_eclen != tsmp->c_ecsize) {
        } else if (smp != HMAP &&
            SMAP_CACHE(tsmp = smp - 1) && tsmp->lno == smp->lno) {
                if (tsmp->c_eclen != tsmp->c_ecsize) {
@@ -214,6 +216,8 @@ svi_line(sp, ep, smp, yp, xp)
                smp->c_sboff = offset_in_line;
                smp->c_scoff = offset_in_char;
                p = &p[offset_in_line];
                smp->c_sboff = offset_in_line;
                smp->c_scoff = offset_in_char;
                p = &p[offset_in_line];
+               if (skip_screens != 0)
+                       cols_per_screen = sp->cols;
        } else {
                offset_in_line = 0;
                offset_in_char = 0;
        } else {
                offset_in_line = 0;
                offset_in_char = 0;
@@ -382,7 +386,7 @@ svi_number(sp, ep)
        SMAP *smp;
        recno_t lno;
        size_t oldy, oldx;
        SMAP *smp;
        recno_t lno;
        size_t oldy, oldx;
-       char *p, nbuf[10];
+       char *lp, *p, nbuf[10];
 
        /*
         * Try and avoid getting the last line in the file, by getting the
 
        /*
         * Try and avoid getting the last line in the file, by getting the
@@ -397,8 +401,7 @@ svi_number(sp, ep)
         * The problem is that file_lline will lie, and tell us that the
         * info line is the last line in the file.
         */
         * The problem is that file_lline will lie, and tell us that the
         * info line is the last line in the file.
         */
-       if ((p = file_gline(sp, ep, TMAP->lno - 1, NULL)) != NULL)
-               lno = TMAP->lno + 1;
+       lp = file_gline(sp, ep, TMAP->lno + 1, NULL);
 
        getyx(stdscr, oldy, oldx);
        for (smp = HMAP; smp <= TMAP; ++smp) {
 
        getyx(stdscr, oldy, oldx);
        for (smp = HMAP; smp <= TMAP; ++smp) {
@@ -406,16 +409,9 @@ svi_number(sp, ep)
                        continue;
                if (ISINFOLINE(sp, smp))
                        break;
                        continue;
                if (ISINFOLINE(sp, smp))
                        break;
-               if (smp->lno != 1)
-                       if (p != NULL) {
-                               if (smp->lno > lno)
-                                       break;
-                       } else {
-                               if ((p =
-                                   file_gline(sp, ep, smp->lno, NULL)) == NULL)
-                                       break;
-                               p = NULL;
-                       }
+               if (smp->lno != 1 && lp == NULL &&
+                   (p = file_gline(sp, ep, smp->lno, NULL)) == NULL)
+                       break;
                MOVE(sp, smp - HMAP, 0);
                (void)snprintf(nbuf, sizeof(nbuf), O_NUMBER_FMT, smp->lno);
                ADDSTR(nbuf);
                MOVE(sp, smp - HMAP, 0);
                (void)snprintf(nbuf, sizeof(nbuf), O_NUMBER_FMT, smp->lno);
                ADDSTR(nbuf);
index aa6fd79..d23fa80 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)term.c     8.40 (Berkeley) 1/8/94";
+static char sccsid[] = "@(#)term.c     8.41 (Berkeley) 1/23/94";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -629,7 +629,7 @@ term_key_ch(sp, val, chp)
                        *chp = kp->ch;
                        return (0);
                }
                        *chp = kp->ch;
                        return (0);
                }
-       return (1);
+       /* NOTREACHED */
 }
 
 /*
 }
 
 /*
index 0dde0e0..010d45a 100644 (file)
@@ -29,9 +29,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"     @(#)vi.1       8.1 (Berkeley) 1/12/94
+.\"     @(#)vi.1       8.7 (Berkeley) 1/23/94
 .\"
 .\"
-.Dd "January 12, 1994"
+.Dd "January 23, 1994"
 .Dt EX/VI 1
 .Os
 .Sh Name
 .Dt EX/VI 1
 .Os
 .Sh Name
@@ -62,7 +62,7 @@
 .Op Fl w Ar size
 .Op Fl x Ar aw
 .Sh DESCRIPTION
 .Op Fl w Ar size
 .Op Fl x Ar aw
 .Sh DESCRIPTION
-.Nm Ex
+.Nm "Ex"
 is a line-oriented text editor.
 .Nm Vi
 is a screen oriented text editor, based on
 is a line-oriented text editor.
 .Nm Vi
 is a screen oriented text editor, based on
@@ -72,7 +72,7 @@ is the same as using the
 .Fl R
 (read-only) option of
 .Nm vi .
 .Fl R
 (read-only) option of
 .Nm vi .
-.Nm Ex
+.Nm "Ex"
 and
 .Nm vi
 are really different interfaces to the same program,
 and
 .Nm vi
 are really different interfaces to the same program,
@@ -103,7 +103,7 @@ Useful for initial positioning in the file, but
 .Ar command
 is not limited to positioning commands.
 This is the POSIX 1003.2 interface for the historic
 .Ar command
 is not limited to positioning commands.
 This is the POSIX 1003.2 interface for the historic
-.Dq +command
+.Dq "+command"
 syntax.
 .Nm Nex/nvi
 supports both the old and new syntax.
 syntax.
 .Nm Nex/nvi
 supports both the old and new syntax.
@@ -173,35 +173,35 @@ will edit any format file.
 Line lengths are limited by available memory,
 and file sizes are limited by available disk space.
 The command
 Line lengths are limited by available memory,
 and file sizes are limited by available disk space.
 The command
-.Dq ^Vx[0-9A-Fa-f]* ,
+.Dq "^Vx[0-9A-Fa-f]* ,"
 in input mode, will insert any
 legal character value into the text.
 .It "Split screens"
 The command
 in input mode, will insert any
 legal character value into the text.
 .It "Split screens"
 The command
-.Dq :sp[lit] [file ...]
+.Dq ":sp[lit] [file ...]"
 splits the screen in vi mode.
 The key
 splits the screen in vi mode.
 The key
-.Dq ^W
+.Dq "^W"
 switches between the foreground screens,
 and the
 switches between the foreground screens,
 and the
-.Dq :resize count
+.Dq ":resize count"
 command can be used to grow or shrink any
 particular screen.
 .It "Background and foreground screens"
 The command
 command can be used to grow or shrink any
 particular screen.
 .It "Background and foreground screens"
 The command
-.Dq :bg
+.Dq ":bg"
 backgrounds the current screen,
 and the command
 backgrounds the current screen,
 and the command
-.Dq :fg [file]
+.Dq ":fg [file]"
 foregrounds the backgrounded screeen
 that is editing the specified file, or, by default, the first background
 screen on the queue.
 The command
 foregrounds the backgrounded screeen
 that is editing the specified file, or, by default, the first background
 screen on the queue.
 The command
-.Dq :di[splay] s[creens]
+.Dq ":di[splay] s[creens]"
 lists the background screens.
 .It "Shell screens"
 The command
 lists the background screens.
 .It "Shell screens"
 The command
-.Dq :sc[ript] [file ...]
+.Dq ":sc[ript] [file ...]"
 runs a shell in the screen.
 Editing is unchanged, with the exception that a <carriage-return>
 enters the current line (stripped of any prompt) as input to the
 runs a shell in the screen.
 Editing is unchanged, with the exception that a <carriage-return>
 enters the current line (stripped of any prompt) as input to the
@@ -209,22 +209,22 @@ shell.
 .It "Tag stacks"
 Tags are now maintained in a stack.
 The command
 .It "Tag stacks"
 Tags are now maintained in a stack.
 The command
-.Dq ^T
+.Dq "^T"
 returns to the previous tag location.
 The command
 returns to the previous tag location.
 The command
-.Dq :tagpop [number \| file]
+.Dq ":tagpop [number \| file]"
 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 the specified file.
 Use the 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 the specified file.
 Use the command
-.Dq :di[splay] t[ags]
+.Dq ":di[splay] t[ags]"
 to view the tags stack.
 The command
 to view the tags stack.
 The command
-.Dq :tagtop
+.Dq ":tagtop"
 returns to the top of the tag stack.
 .It "New displays"
 The command
 returns to the top of the tag stack.
 .It "New displays"
 The command
-.Dq :di[splay] b[uffers] \| s[creens] \| t[ags]
+.Dq ":di[splay] b[uffers] \| s[creens] \| t[ags]"
 can be
 used to display, respectively, the current cut buffers,
 the backgrounded screens, and the tags stack.
 can be
 used to display, respectively, the current cut buffers,
 the backgrounded screens, and the tags stack.
@@ -235,33 +235,33 @@ A '.' command immediately after a 'u' command continues either forward
 or backward depending on whether the 'u' command was an undo or a redo.
 .It "Usage information"
 The command
 or backward depending on whether the 'u' command was an undo or a redo.
 .It "Usage information"
 The command
-.Dq :exu[sage [cmd]
+.Dq ":exu[sage [cmd]"
 and
 and
-.Dq viu[sage] [key]
+.Dq "viu[sage] [key]"
 provide usage
 information for all of the ex and vi commands by default, or, optionally,
 for a specific command or key.
 .It "Extended regular expressions"
 The
 provide usage
 information for all of the ex and vi commands by default, or, optionally,
 for a specific command or key.
 .It "Extended regular expressions"
 The
-.Dq :set extended
+.Dq ":set extended"
 command treats search and other command regular
 expressions as extended (egrep(1) style) regular expressions.
 .It "Word search"
 The command
 command treats search and other command regular
 expressions as extended (egrep(1) style) regular expressions.
 .It "Word search"
 The command
-.Dq ^A
+.Dq "^A"
 searches for the word referenced by the cursor.
 .It "Number increment"
 The command
 searches for the word referenced by the cursor.
 .It "Number increment"
 The command
-.Dq #
+.Dq "#"
 increments the number referenced by the cursor.
 .It "Previous file"
 The command
 increments the number referenced by the cursor.
 .It "Previous file"
 The command
-.Dq :prev[ious][!]
+.Dq ":prev[ious][!]"
 edits the previous file from the
 argument list.
 .It "Left-Right scrolling"
 The command
 edits the previous file from the
 argument list.
 .It "Left-Right scrolling"
 The command
-.Dq :set leftright
+.Dq ":set leftright"
 makes
 .Nm nvi
 do left-right screen scrolling, instead of the traditional
 makes
 .Nm nvi
 do left-right screen scrolling, instead of the traditional
@@ -275,29 +275,29 @@ may recover any edit session.
 Edit sessions are backed by files in
 .Pa /var/tmp/vi.recover ,
 and are named
 Edit sessions are backed by files in
 .Pa /var/tmp/vi.recover ,
 and are named
-.Dq vi.XXXX ,
+.Dq "vi.XXXX" ,
 where
 where
-.Dq XXXX
+.Dq "XXXX"
 is a number related to the process id.
 When a file is first modified, a second file, which contains an
 email message for the user, is created, and is named
 is a number related to the process id.
 When a file is first modified, a second file, which contains an
 email message for the user, is created, and is named
-.Dq recover.XXXX ,
+.Dq "recover.XXXX" ,
 where, again,
 where, again,
-.Dq XXXX
+.Dq "XXXX"
 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 enters the ex/vi
 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 enters the ex/vi
-.Dq preserve
+.Dq "preserve"
 command.
 The use of the
 .Pa /var/tmp
 directory may be changed setting the option
 command.
 The use of the
 .Pa /var/tmp
 directory may be changed setting the option
-.Dq recdir
+.Dq "recdir"
 in the user's or system startup information.
 .Pp
 The recovery directory should have the
 in the user's or system startup information.
 .Pp
 The recovery directory should have the
-.Dq sticky-bit
+.Dq "sticky-bit"
 set so that only the owners of files may remove them.
 If this is not possible on the system, then a pseudo-user should
 own the recovery directory.
 set so that only the owners of files may remove them.
 If this is not possible on the system, then a pseudo-user should
 own the recovery directory.
@@ -310,23 +310,24 @@ In addition, it has all of the necessary email headers for sendmail.
 When the system is rebooted, all of the files in
 .Pa /var/tmp/vi.recover
 named
 When the system is rebooted, all of the files in
 .Pa /var/tmp/vi.recover
 named
-.Dq recover.XXXX
+.Dq "recover.XXXX"
 should be sent by email,
 using the
 .Fl t
 flag of sendmail (or a similar mechanism in other mailers).
 A simple way to do this is to insert the following script into your
 should be sent by email,
 using the
 .Fl t
 flag of sendmail (or a similar mechanism in other mailers).
 A simple way to do this is to insert the following script into your
-rc.local file:
+rc.local (or other startup) file:
 .sp
 .ne 7v
 .Bd -literal -offset indent -compact
 # Recover nvi editor files.
 virecovery=/var/tmp/vi.recover/recover.*
 .sp
 .ne 7v
 .Bd -literal -offset indent -compact
 # Recover nvi editor files.
 virecovery=/var/tmp/vi.recover/recover.*
-if [ $virecovery != /var/tmp/vi.recover/recover.\e* ]; then
+if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
        echo 'Recovering vi editor sessions'
        for i in $virecovery; do
                sendmail -t < $i
        done
        echo 'Recovering vi editor sessions'
        for i in $virecovery; do
                sendmail -t < $i
        done
+fi
 .Ed
 .Pp
 If
 .Ed
 .Pp
 If
@@ -342,7 +343,7 @@ This man page is woefully incomplete.
 .Pp
 Many and varied.
 See the file
 .Pp
 Many and varied.
 See the file
-.Pa nvi/docs/BUGS
+.Pa nvi/docs/bugs.current
 for a list of the known bugs in this version.
 .Sh FILES
 .Bl -tag -width XXXX/var/tmp/vi.recover -compact
 for a list of the known bugs in this version.
 .Sh FILES
 .Bl -tag -width XXXX/var/tmp/vi.recover -compact
@@ -358,26 +359,35 @@ Storage for recovery files.
 .Xr dbopen 3
 .sp
 The
 .Xr dbopen 3
 .sp
 The
-.Dq Vi Quick Reference
+.Dq "Vi Quick Reference"
 card.
 .sp
 card.
 .sp
-.Dq An Introduction to Display Editing with Vi ,
+.Dq "An Introduction to Display Editing with Vi" ,
 found in the
 found in the
-.Dq UNIX User's Manual Supplementary Documents .
+.Dq "UNIX User's Manual Supplementary Documents" .
 .sp
 .sp
-.Dq Edit: A tutorial ,
+.Dq "Edit: A tutorial" ,
 found in the
 found in the
-.Dq UNIX User's Manual Supplementary Documents .
+.Dq "UNIX User's Manual Supplementary Documents" .
 .sp
 .sp
-.Dq Ex Reference Manual (Version 3.7) ,
+.Dq "Ex Reference Manual (Version 3.7)" ,
 found in the
 found in the
-.Dq UNIX User's Manual Supplementary Documents .
+.Dq "UNIX User's Manual Supplementary Documents" .
+.Pp
+.Nm Nroff/troff
+source for the previous three documents are distributed with
+.Nm nex/nvi
+in the
+.Pa nvi/docs/USD.doc
+directory of the
+.Nm nex/nvi
+source code.
 .sp
 The files
 .sp
 The files
-.Dq autowrite ,
-.Dq input ,
+.Dq "autowrite" ,
+.Dq "input" ,
 and
 and
-.Dq quoting ,
+.Dq "quoting" ,
 found in the
 .Pa nvi/docs
 directory of the
 found in the
 .Pa nvi/docs
 directory of the