From 71de761cfb460a337d590457920caa601ff97028 Mon Sep 17 00:00:00 2001 From: bentley Date: Mon, 3 Jul 2017 07:01:14 +0000 Subject: [PATCH] Remove settings that were unimplemented for 20 years; update STANDARDS. ok jmc@ natano@ --- usr.bin/vi/common/main.c | 15 ++----- usr.bin/vi/common/options.c | 44 +----------------- usr.bin/vi/common/options.h | 3 +- usr.bin/vi/common/options_f.c | 12 +---- usr.bin/vi/docs/USD.doc/vi.man/vi.1 | 69 +++++++++++++++-------------- usr.bin/vi/include/com_extern.h | 3 +- usr.bin/vi/include/options_def.h | 8 +--- 7 files changed, 45 insertions(+), 109 deletions(-) diff --git a/usr.bin/vi/common/main.c b/usr.bin/vi/common/main.c index 8b105d2a95d..ccff821ca35 100644 --- a/usr.bin/vi/common/main.c +++ b/usr.bin/vi/common/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.39 2017/04/18 01:45:35 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.40 2017/07/03 07:01:14 bentley Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -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; diff --git a/usr.bin/vi/common/options.c b/usr.bin/vi/common/options.c index 38ca08d7f6d..5f8c6d16ea7 100644 --- a/usr.bin/vi/common/options.c +++ b/usr.bin/vi/common/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.24 2017/06/30 14:42:05 bentley Exp $ */ +/* $OpenBSD: options.c,v 1.25 2017/07/03 07:01:14 bentley Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -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 */ @@ -512,14 +478,6 @@ opts_set(SCR *sp, ARGS *argv[], char *usage) 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; - } - if (equals) { msgq_str(sp, M_ERR, name, "set: [no]%s option doesn't take a value"); diff --git a/usr.bin/vi/common/options.h b/usr.bin/vi/common/options.h index 42f789a96d2..dcda620a1ad 100644 --- a/usr.bin/vi/common/options.h +++ b/usr.bin/vi/common/options.h @@ -1,4 +1,4 @@ -/* $OpenBSD: options.h,v 1.8 2006/01/08 21:05:39 miod Exp $ */ +/* $OpenBSD: options.h,v 1.9 2017/07/03 07:01:14 bentley Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -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 */ diff --git a/usr.bin/vi/common/options_f.c b/usr.bin/vi/common/options_f.c index ae6713a0563..6d10b265ee9 100644 --- a/usr.bin/vi/common/options_f.c +++ b/usr.bin/vi/common/options_f.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options_f.c,v 1.11 2016/01/06 22:28:52 millert Exp $ */ +/* $OpenBSD: options_f.c,v 1.12 2017/07/03 07:01:14 bentley Exp $ */ /*- * Copyright (c) 1993, 1994 @@ -120,16 +120,6 @@ f_lines(SCR *sp, OPTION *op, char *str, u_long *valp) return (0); } -/* - * 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 *); */ diff --git a/usr.bin/vi/docs/USD.doc/vi.man/vi.1 b/usr.bin/vi/docs/USD.doc/vi.man/vi.1 index 3f75652834d..feb74c58199 100644 --- a/usr.bin/vi/docs/USD.doc/vi.man/vi.1 +++ b/usr.bin/vi/docs/USD.doc/vi.man/vi.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: vi.1,v 1.69 2017/06/30 14:42:05 bentley Exp $ +.\" $OpenBSD: vi.1,v 1.70 2017/07/03 07:01:14 bentley Exp $ .\" .\" Copyright (c) 1994 .\" The Regents of the University of California. All rights reserved. @@ -14,7 +14,7 @@ .\" .\" @(#)vi.1 8.51 (Berkeley) 10/10/96 .\" -.Dd $Mdocdate: June 30 2017 $ +.Dd $Mdocdate: July 3 2017 $ .Dt VI 1 .Os .Sh NAME @@ -106,8 +106,6 @@ Start editing in ex mode, as if the command name were 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 the 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 diff --git a/usr.bin/vi/include/com_extern.h b/usr.bin/vi/include/com_extern.h index 9d98181b19b..f2658cda23f 100644 --- a/usr.bin/vi/include/com_extern.h +++ b/usr.bin/vi/include/com_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: com_extern.h,v 1.14 2016/05/27 09:18:12 martijn Exp $ */ +/* $OpenBSD: com_extern.h,v 1.15 2017/07/03 07:01:14 bentley Exp $ */ int cut(SCR *, CHAR_T *, MARK *, MARK *, int); int cut_line(SCR *, recno_t, size_t, size_t, CB *); @@ -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 *); diff --git a/usr.bin/vi/include/options_def.h b/usr.bin/vi/include/options_def.h index b7b01a3e022..f080dfa6a3b 100644 --- a/usr.bin/vi/include/options_def.h +++ b/usr.bin/vi/include/options_def.h @@ -1,4 +1,4 @@ -/* $OpenBSD: options_def.h,v 1.7 2016/08/01 18:27:35 bentley Exp $ */ +/* $OpenBSD: options_def.h,v 1.8 2017/07/03 07:01:14 bentley Exp $ */ enum { O_ALTWERASE = 0, @@ -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, -- 2.20.1