summaryrefslogtreecommitdiff
path: root/editors/nvi/patches/patch-ai
blob: d2da35ddd563c0b7c67f90404f694dc59926ef4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
$NetBSD: patch-ai,v 1.3 2009/08/07 16:39:21 lukem Exp $

--- ../common/options.c.orig	2007-11-19 03:41:42.000000000 +1100
+++ ../common/options.c
@@ -48,6 +48,8 @@ static int	 	 opts_print __P((SCR *, OPT
  *
  * HPUX noted options and abbreviations are from "The Ultimate Guide to the
  * VI and EX Text Editors", 1990.
+ *
+ * This list must be sorted...
  */
 OPTLIST const optlist[] = {
 /* O_ALTWERASE	  4.4BSD */
@@ -76,10 +78,12 @@ OPTLIST const optlist[] = {
 	{L("directory"),	NULL,		OPT_STR,	0},
 /* O_EDCOMPATIBLE   4BSD */
 	{L("edcompatible"),NULL,		OPT_0BOOL,	0},
-/* O_ESCAPETIME	  4.4BSD */
-	{L("escapetime"),	NULL,		OPT_NUM,	0},
 /* O_ERRORBELLS	    4BSD */
 	{L("errorbells"),	NULL,		OPT_0BOOL,	0},
+/* O_ESCAPETIME	  4.4BSD */
+	{L("escapetime"),	NULL,		OPT_NUM,	0},
+/* O_EXPANDTAB	  NetBSD 5.0 */
+	{L("expandtab"),	NULL,		OPT_0BOOL,	0},
 /* O_EXRC	System V (undocumented) */
 	{L("exrc"),	NULL,		OPT_0BOOL,	0},
 /* O_EXTENDED	  4.4BSD */
@@ -90,6 +94,8 @@ OPTLIST const optlist[] = {
 	{L("fileencoding"),f_encoding,	OPT_STR,	OPT_WC},
 /* O_FLASH	    HPUX */
 	{L("flash"),	NULL,		OPT_1BOOL,	0},
+/* O_GTAGSMODE	    FreeBSD/NetBSD */
+	{L("gtagsmode"),NULL,		OPT_1BOOL,	0},
 /* O_HARDTABS	    4BSD */
 	{L("hardtabs"),	NULL,		OPT_NUM,	0},
 /* O_ICLOWER	  4.4BSD */
@@ -120,6 +126,8 @@ OPTLIST const optlist[] = {
 	{L("lock"),	NULL,		OPT_1BOOL,	0},
 /* O_MAGIC	    4BSD */
 	{L("magic"),	NULL,		OPT_1BOOL,	0},
+/* O_MATCHCHARS	  netbsd 2.0 */
+	{L("matchchars"),	NULL,		OPT_STR,	OPT_PAIRS},
 /* O_MATCHTIME	  4.4BSD */
 	{L("matchtime"),	NULL,		OPT_NUM,	0},
 /* O_MESG	    4BSD */
@@ -146,7 +154,7 @@ OPTLIST const optlist[] = {
 /* O_OPTIMIZE	    4BSD */
 	{L("optimize"),	NULL,		OPT_1BOOL,	0},
 /* O_PARAGRAPHS	    4BSD */
-	{L("paragraphs"),	f_paragraph,	OPT_STR,	0},
+	{L("paragraphs"), NULL,		OPT_STR,	OPT_PAIRS},
 /* O_PATH	  4.4BSD */
 	{L("path"),	NULL,		OPT_STR,	0},
 /* O_PRINT	  4.4BSD */
@@ -170,7 +178,7 @@ OPTLIST const optlist[] = {
 /* O_SEARCHINCR	  4.4BSD */
 	{L("searchincr"),	NULL,		OPT_0BOOL,	0},
 /* O_SECTIONS	    4BSD */
-	{L("sections"),	f_section,	OPT_STR,	0},
+	{L("sections"),	NULL,		OPT_STR,	OPT_PAIRS},
 /* O_SECURE	  4.4BSD */
 	{L("secure"),	NULL,		OPT_0BOOL,	OPT_NOUNSET},
 /* O_SHELL	    4BSD */
@@ -255,7 +263,9 @@ static OABBREV const abbrev[] = {
 	{L("dir"),	O_TMP_DIRECTORY},	/*     4BSD */
 	{L("eb"),	O_ERRORBELLS},		/*     4BSD */
 	{L("ed"),	O_EDCOMPATIBLE},	/*     4BSD */
+	{L("et"),	O_EXPANDTAB},		/* NetBSD 5.0 */
 	{L("ex"),	O_EXRC},		/* System V (undocumented) */
+	{L("gt"),	O_GTAGSMODE},		/* FreeBSD, NetBSD */
 	{L("fe"),	O_FILEENCODING},
 	{L("ht"),	O_HARDTABS},		/*     4BSD */
 	{L("ic"),	O_IGNORECASE},		/*     4BSD */
@@ -307,6 +317,13 @@ opts_init(SCR *sp, int *oargs)
 	CHAR_T *wp;
 	size_t wlen;
 
+	if (sizeof optlist / sizeof optlist[0] - 1 != O_OPTIONCOUNT) {
+		fprintf(stderr, "vi: option table size error (%d != %d)\n",
+		    (int)(sizeof optlist / sizeof optlist[0] - 1),
+		    O_OPTIONCOUNT);
+		exit(1);
+	}
+
 	a.bp = b2;
 	b.bp = NULL;
 	a.len = b.len = 0;
@@ -358,6 +375,7 @@ opts_init(SCR *sp, int *oargs)
 	OI(O_TMP_DIRECTORY, b2);
 	OI(O_ESCAPETIME, L("escapetime=1"));
 	OI(O_KEYTIME, L("keytime=6"));
+	OI(O_MATCHCHARS, L("matchchars=()[]{}<>"));
 	OI(O_MATCHTIME, L("matchtime=7"));
 	(void)SPRINTF(b2, SIZE(b2), L("msgcat=%s"), _PATH_MSGCAT);
 	OI(O_MSGCAT, b2);
@@ -708,6 +726,14 @@ badnum:				INT2CHAR(sp, name, STRLEN(nam
 				break;
 			}
 
+			/* Check for strings that must have even length */
+			if (F_ISSET(op, OPT_PAIRS) && STRLEN(sep) & 1) {
+				msgq_wstr(sp, M_ERR, name,
+				    "047|set: the %s option must be in two character groups");
+				rval = 1;
+				break;
+			}
+
 			/*
 			 * Do nothing if the value is unchanged, the underlying
 			 * functions can be expensive.