* Implement options: expandtab gtagsmode matchchars * Fix tty garbling when quitting from recovery mode. * Don't coredump during autoindent edge case. * Set internal version to "nvi-1.81.6nb4 (2009-08-07)" * Crank pkgrevision to nb4.
111 lines
3.7 KiB
Text
111 lines
3.7 KiB
Text
$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.
|