On Fri, Jun 30, 2017 at 09:19:31AM -0600, Anthony J. Bentley wrote:
>
> Here's a diff that updates the STANDARDS section in the manual.
> I think it will be enough to talk about our POSIX compliance. POSIX
> discusses its differences from historical ex/vi in great detail,
> including an explicit recommendation to delete modelines and sourceany.
The diff reads fine to me. OK.
>
> Index: common/main.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/common/main.c,v
> retrieving revision 1.39
> diff -u -p -r1.39 main.c
> --- common/main.c 18 Apr 2017 01:45:35 -0000 1.39
> +++ common/main.c 30 Jun 2017 15:16:56 -0000
> @@ -52,7 +52,7 @@ editor(GS *gp, int argc, char *argv[])
> SCR *sp;
> size_t len;
> u_int flags;
> - int ch, flagchk, lflag, secure, startup, readonly, rval, silent;
> + int ch, flagchk, secure, startup, readonly, rval, silent;
> char *tag_f, *wsizearg, path[256];
>
> static const char *optstr[3] = {
> @@ -114,7 +114,7 @@ editor(GS *gp, int argc, char *argv[])
> /* Parse the arguments. */
> flagchk = '\0';
> tag_f = wsizearg = NULL;
> - lflag = secure = silent = 0;
> + secure = silent = 0;
> startup = 1;
>
> /* Set the file snapshot flag. */
> @@ -163,9 +163,6 @@ editor(GS *gp, int argc, char *argv[])
> case 'F': /* No snapshot. */
> F_CLR(gp, G_SNAPSHOT);
> break;
> - case 'l': /* Set lisp, showmatch options. */
> - lflag = 1;
> - break;
> case 'R': /* Readonly. */
> readonly = 1;
> break;
> @@ -260,11 +257,7 @@ editor(GS *gp, int argc, char *argv[])
> goto err;
>
> { int oargs[5], *oargp = oargs;
> - if (lflag) { /* Command-line options. */
> - *oargp++ = O_LISP;
> - *oargp++ = O_SHOWMATCH;
> - }
> - if (readonly)
> + if (readonly) /* Command-line options. */
> *oargp++ = O_READONLY;
> if (secure)
> *oargp++ = O_SECURE;
> Index: common/options.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/common/options.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 options.c
> --- common/options.c 30 Jun 2017 14:42:05 -0000 1.24
> +++ common/options.c 30 Jun 2017 15:16:56 -0000
> @@ -89,12 +89,6 @@ OPTLIST const optlist[] = {
> {"leftright", f_reformat, OPT_0BOOL, 0},
> /* O_LINES 4.4BSD */
> {"lines", f_lines, OPT_NUM, OPT_NOSAVE},
> -/* O_LISP 4BSD
> - * XXX
> - * When the lisp option is implemented, delete the OPT_NOSAVE flag,
> - * so that :mkexrc dumps it.
> - */
> - {"lisp", f_lisp, OPT_0BOOL, OPT_NOSAVE},
> /* O_LIST 4BSD */
> {"list", f_reformat, OPT_0BOOL, 0},
> /* O_LOCKFILES 4.4BSD
> @@ -109,15 +103,6 @@ OPTLIST const optlist[] = {
> {"matchtime", NULL, OPT_NUM, 0},
> /* O_MESG 4BSD */
> {"mesg", NULL, OPT_1BOOL, 0},
> -/* O_MODELINE 4BSD
> - * !!!
> - * This has been documented in historical systems as both "modeline"
> - * and as "modelines". Regardless of the name, this option represents
> - * a security problem of mammoth proportions, not to mention a stunning
> - * example of what your intro CS professor referred to as the perils of
> - * mixing code and data. Don't add it, or I will kill you.
> - */
> - {"modeline", NULL, OPT_0BOOL, OPT_NOSET},
> /* O_NOPRINT 4.4BSD */
> {"noprint", f_print, OPT_STR, OPT_EARLYSET},
> /* O_NUMBER 4BSD */
> @@ -126,8 +111,6 @@ OPTLIST const optlist[] = {
> {"octal", f_print, OPT_0BOOL, OPT_EARLYSET},
> /* O_OPEN 4BSD */
> {"open", NULL, OPT_1BOOL, 0},
> -/* O_OPTIMIZE 4BSD */
> - {"optimize", NULL, OPT_1BOOL, 0},
> /* O_PARAGRAPHS 4BSD */
> {"paragraphs", f_paragraph, OPT_STR, 0},
> /* O_PATH 4.4BSD */
> @@ -140,8 +123,6 @@ OPTLIST const optlist[] = {
> {"readonly", f_readonly, OPT_0BOOL, OPT_ALWAYS},
> /* O_RECDIR 4.4BSD */
> {"recdir", NULL, OPT_STR, 0},
> -/* O_REDRAW 4BSD */
> - {"redraw", NULL, OPT_0BOOL, 0},
> /* O_REMAP 4BSD */
> {"remap", NULL, OPT_1BOOL, 0},
> /* O_REPORT 4BSD */
> @@ -168,17 +149,6 @@ OPTLIST const optlist[] = {
> {"showmode", NULL, OPT_0BOOL, 0},
> /* O_SIDESCROLL 4.4BSD */
> {"sidescroll", NULL, OPT_NUM, OPT_NOZERO},
> -/* O_SLOWOPEN 4BSD */
> - {"slowopen", NULL, OPT_0BOOL, 0},
> -/* O_SOURCEANY 4BSD (undocumented)
> - * !!!
> - * Historic vi, on startup, source'd $HOME/.exrc and ./.exrc, if they
> - * were owned by the user. The sourceany option was an undocumented
> - * feature of historic vi which permitted the startup source'ing of
> - * .exrc files the user didn't own. This is an obvious security problem,
> - * and we ignore the option.
> - */
> - {"sourceany", NULL, OPT_0BOOL, OPT_NOSET},
> /* O_TABSTOP 4BSD */
> {"tabstop", f_reformat, OPT_NUM, OPT_NOZERO},
> /* O_TAGLENGTH 4BSD */
> @@ -241,16 +211,12 @@ static OABBREV const abbrev[] = {
> {"ht", O_HARDTABS}, /* 4BSD */
> {"ic", O_IGNORECASE}, /* 4BSD */
> {"li", O_LINES}, /* 4.4BSD */
> - {"modelines", O_MODELINE}, /* HPUX */
> {"nu", O_NUMBER}, /* 4BSD */
> - {"opt", O_OPTIMIZE}, /* 4BSD */
> {"para", O_PARAGRAPHS}, /* 4BSD */
> - {"re", O_REDRAW}, /* O'Reilly */
> {"ro", O_READONLY}, /* 4BSD (undocumented) */
> {"scr", O_SCROLL}, /* 4BSD (undocumented) */
> {"sect", O_SECTIONS}, /* O'Reilly */
> {"sh", O_SHELL}, /* 4BSD */
> - {"slow", O_SLOWOPEN}, /* 4BSD */
> {"sm", O_SHOWMATCH}, /* 4BSD */
> {"smd", O_SHOWMODE}, /* 4BSD */
> {"sw", O_SHIFTWIDTH}, /* 4BSD */
> @@ -508,14 +474,6 @@ opts_set(SCR *sp, ARGS *argv[], char *us
> if (F_ISSET(op, OPT_NOUNSET) && turnoff) {
> msgq_str(sp, M_ERR, name,
> "set: the %s option may not be turned off");
> - rval = 1;
> - break;
> - }
> -
> - /* Some options may not be set. */
> - if (F_ISSET(op, OPT_NOSET) && !turnoff) {
> - msgq_str(sp, M_ERR, name,
> - "set: the %s option may never be turned on");
> rval = 1;
> break;
> }
> Index: common/options.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/common/options.h,v
> retrieving revision 1.8
> diff -u -p -r1.8 options.h
> --- common/options.h 8 Jan 2006 21:05:39 -0000 1.8
> +++ common/options.h 30 Jun 2017 15:16:56 -0000
> @@ -88,7 +88,6 @@ struct _optlist {
> #define OPT_ALWAYS 0x002 /* Always call the support
> function. */
> #define OPT_NDISP 0x004 /* Never display the option. */
> #define OPT_NOSAVE 0x008 /* Mkexrc command doesn't save.
> */
> -#define OPT_NOSET 0x010 /* Option may not be set. */
> #define OPT_NOUNSET 0x020 /* Option may not be unset. */
> #define OPT_NOZERO 0x040 /* Option may not be set to 0.
> */
> #define OPT_EARLYSET 0x080 /* Func called after value is
> set */
> Index: common/options_f.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/common/options_f.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 options_f.c
> --- common/options_f.c 6 Jan 2016 22:28:52 -0000 1.11
> +++ common/options_f.c 30 Jun 2017 15:16:56 -0000
> @@ -121,16 +121,6 @@ f_lines(SCR *sp, OPTION *op, char *str,
> }
>
> /*
> - * PUBLIC: int f_lisp(SCR *, OPTION *, char *, u_long *);
> - */
> -int
> -f_lisp(SCR *sp, OPTION *op, char *str, u_long *valp)
> -{
> - msgq(sp, M_ERR, "The lisp option is not implemented");
> - return (0);
> -}
> -
> -/*
> * PUBLIC: int f_paragraph(SCR *, OPTION *, char *, u_long *);
> */
> int
> Index: docs/USD.doc/vi.man/vi.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/docs/USD.doc/vi.man/vi.1,v
> retrieving revision 1.69
> diff -u -p -r1.69 vi.1
> --- docs/USD.doc/vi.man/vi.1 30 Jun 2017 14:42:05 -0000 1.69
> +++ docs/USD.doc/vi.man/vi.1 30 Jun 2017 15:16:56 -0000
> @@ -106,8 +106,6 @@ Start editing in ex mode, as if the comm
> Don't copy the entire file when first starting to edit.
> (The default is to make a copy in case someone else modifies
> the file during your edit session.)
> -.\" .It Fl l
> -.\" Start editing with the lisp and showmatch options set.
> .It Fl R
> Start editing in read-only mode, as if the command name was
> .Nm view ,
> @@ -2376,11 +2374,6 @@ Do left-right scrolling.
> .Nm vi
> only.
> Set the number of lines in the screen.
> -.It Cm lisp Bq off
> -.Nm vi
> -only.
> -Modify various search commands and options to work with Lisp.
> -This option is not yet implemented.
> .It Cm list Bq off
> Display lines in an unambiguous fashion.
> .It Cm lock Bq on
> @@ -2404,11 +2397,6 @@ pauses on the matching character when th
> option is set.
> .It Cm mesg Bq on
> Permit messages from other users.
> -.It Cm modelines , modeline Bq off
> -Read the first and last few lines of each file for
> -.Nm ex
> -commands.
> -This option will never be implemented.
> .It Cm noprint Bq \&"\&"
> Characters that are never handled as printable characters.
> .It Cm number, nu Bq off
> @@ -2424,11 +2412,6 @@ If this option is not set, the
> and
> .Cm visual
> commands are disallowed.
> -.It Cm optimize , opt Bq on
> -.Nm vi
> -only.
> -Optimize text throughput to dumb terminals.
> -This option is not yet implemented
> .It Cm paragraphs , para Bq "IPLPPPQPP LIpplpipbpBlBdPpLpIt"
> .Nm vi
> only.
> @@ -2449,11 +2432,6 @@ Display a command prompt.
> Mark the file and session as read-only.
> .It Cm recdir Bq /tmp/vi.recover
> The directory where recovery files are stored.
> -.It Cm redraw , re Bq off
> -.Nm vi
> -only.
> -Simulate an intelligent terminal on a dumb one.
> -This option is not yet implemented.
> .It Cm remap Bq on
> Remap keys until resolved.
> .It Cm report Bq 5
> @@ -2509,12 +2487,6 @@ flag.
> .Nm vi
> only.
> Set the amount a left-right scroll will shift.
> -.It Cm slowopen , slow Bq off
> -Delay display updating during text input.
> -This option is not yet implemented.
> -.It Cm sourceany Bq off
> -Read startup files not owned by the current user.
> -This option will never be implemented.
> .It Cm tabstop , ts Bq 8
> This option sets tab widths for the editor display.
> .It Cm taglength , tl Bq 0
> @@ -2766,9 +2738,40 @@ and >0 if an error occurs.
> .Nm nex Ns / Ns Nm nvi
> is close to
> .St -p1003.1-2008 .
> -That document differs from historical
> -.Nm ex Ns / Ns Nm vi
> -practice in several places; there are changes to be made on both sides.
> +It deviates in the following respects:
> +.Bl -bullet
> +.It
> +The
> +.Ic s
> +.Nm ex
> +command may not be called as
> +.Ic substitute .
> +.It
> +The
> +.Ic directory , redraw
> +and
> +.Ic slowopen
> +settings are not implemented.
> +.It
> +The
> +.Ic paragraphs
> +and
> +.Ic sections
> +settings default to values useful for editing
> +.Xr mdoc 7
> +manuals.
> +.It
> +The
> +.Ev TMPDIR
> +environment variable is ignored.
> +.It
> +In insert mode, entering
> +.Ic Aq control-H ,
> +.Ic Aq erase ,
> +or
> +.Ic Aq kill
> +following a backslash will not embed the control character in the text.
> +.El
> .Sh HISTORY
> The
> .Nm ex
> Index: include/com_extern.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/include/com_extern.h,v
> retrieving revision 1.14
> diff -u -p -r1.14 com_extern.h
> --- include/com_extern.h 27 May 2016 09:18:12 -0000 1.14
> +++ include/com_extern.h 30 Jun 2017 15:16:56 -0000
> @@ -69,7 +69,6 @@ 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_paragraph(SCR *, OPTION *, char *, u_long *);
> int f_print(SCR *, OPTION *, char *, u_long *);
> int f_readonly(SCR *, OPTION *, char *, u_long *);
> Index: include/options_def.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/vi/include/options_def.h,v
> retrieving revision 1.7
> diff -u -p -r1.7 options_def.h
> --- include/options_def.h 1 Aug 2016 18:27:35 -0000 1.7
> +++ include/options_def.h 30 Jun 2017 15:16:56 -0000
> @@ -24,25 +24,21 @@ enum {
> O_KEYTIME,
> O_LEFTRIGHT,
> O_LINES,
> - O_LISP,
> O_LIST,
> O_LOCKFILES,
> O_MAGIC,
> O_MATCHTIME,
> O_MESG,
> - O_MODELINE,
> O_NOPRINT,
> O_NUMBER,
> O_OCTAL,
> O_OPEN,
> - O_OPTIMIZE,
> O_PARAGRAPHS,
> O_PATH,
> O_PRINT,
> O_PROMPT,
> O_READONLY,
> O_RECDIR,
> - O_REDRAW,
> O_REMAP,
> O_REPORT,
> O_RULER,
> @@ -56,8 +52,6 @@ enum {
> O_SHOWMATCH,
> O_SHOWMODE,
> O_SIDESCROLL,
> - O_SLOWOPEN,
> - O_SOURCEANY,
> O_TABSTOP,
> O_TAGLENGTH,
> O_TAGS,
>