Wed Oct 1 21:20:09 2008 UTC ()
put back matchchars


(christos)
diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/dutch.base
diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/french.base
diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/german.base
diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/spanish.base
diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/swedish.base
diff -r1.1.1.2 -r1.2 src/dist/nvi/common/options.awk
diff -r1.1.1.2 -r1.2 src/dist/nvi/common/options.c
diff -r1.1.1.2 -r1.2 src/dist/nvi/common/options.h
diff -r1.1.1.2 -r1.2 src/dist/nvi/common/options_f.c
diff -r1.1.1.2 -r1.2 src/dist/nvi/docs/vi.man/vi.1
diff -r1.1.1.2 -r1.2 src/dist/nvi/docs/vi.ref/set.opt.texi
diff -r1.1.1.2 -r1.2 src/dist/nvi/docs/vi.ref/vi.cmd.texi
diff -r1.1.1.2 -r1.2 src/dist/nvi/vi/v_match.c

cvs diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/Attic/dutch.base (expand / switch to unified diff)

--- src/dist/nvi/catalog/Attic/dutch.base 2008/05/16 18:03:04 1.1.1.1
+++ src/dist/nvi/catalog/Attic/dutch.base 2008/10/01 21:20:09 1.2
@@ -33,28 +33,27 @@ @@ -33,28 +33,27 @@
33034 "set: [no]%s optie kan geen waarde hebben" 33034 "set: [no]%s optie kan geen waarde hebben"
34035 "set: %s optie moet een waarde hebben" 34035 "set: %s optie moet een waarde hebben"
35036 "set: %s optie: %s" 35036 "set: %s optie: %s"
36037 "set: %s optie: %s: getal is te groot" 36037 "set: %s optie: %s: getal is te groot"
37038 "set: %s optie: %s is een ongeldige waarde" 37038 "set: %s optie: %s is een ongeldige waarde"
38039 "set: %s optie moet een waarde hebben" 38039 "set: %s optie moet een waarde hebben"
39040 "Te weinig kolommen op het scherm, minder dan %d" 39040 "Te weinig kolommen op het scherm, minder dan %d"
40041 "Aantal kolommen te groot, meer dan %d" 40041 "Aantal kolommen te groot, meer dan %d"
41042 "Te weinig regels op het scherm, minder dan %d" 41042 "Te weinig regels op het scherm, minder dan %d"
42043 "Aantal regels te groot, meer dan %d" 42043 "Aantal regels te groot, meer dan %d"
43044 "De lisp optie is niet ondersteund" 43044 "De lisp optie is niet ondersteund"
44045 "messages niet uitgeschakeld: %s" 44045 "messages niet uitgeschakeld: %s"
45046 "messages niet geactiveerd: %s" 45046 "messages niet geactiveerd: %s"
46048 "De paragraph optie moet karakter paren bevatten" 46047 "set: de %s optie moet karakter paren bevatten"
47049 "De section optie moet karakter paren bevatten" 
48053 "De standaard buffer is leeg" 47053 "De standaard buffer is leeg"
49054 "Buffer %s is leeg" 48054 "Buffer %s is leeg"
50055 "Bestanden met newlines in de naam kunnen niet hersteld worden" 49055 "Bestanden met newlines in de naam kunnen niet hersteld worden"
51056 "Wijzigingen kunnen niet ongedaan gemaakt worden als deze sessie mislukt" 50056 "Wijzigingen kunnen niet ongedaan gemaakt worden als deze sessie mislukt"
52057 "Bestand wordt gecopieerd voor herstel..." 51057 "Bestand wordt gecopieerd voor herstel..."
53058 "Herstel mechanisme werkt niet: %s" 52058 "Herstel mechanisme werkt niet: %s"
54059 "Wijzigingen kunnen niet ongedaan gemaakt worden als deze sessie mislukt" 53059 "Wijzigingen kunnen niet ongedaan gemaakt worden als deze sessie mislukt"
55060 "Kon bestand niet veilig stellen: %s" 54060 "Kon bestand niet veilig stellen: %s"
56061 "Bestand wordt gecopieerd voor herstel..." 55061 "Bestand wordt gecopieerd voor herstel..."
57062 "Informatie met betrekking tot gebruiker nummer %u niet gevonden" 56062 "Informatie met betrekking tot gebruiker nummer %u niet gevonden"
58063 "Kan herstel bestand niet beveiligen" 57063 "Kan herstel bestand niet beveiligen"
59064 "herstel buffer overgelopen" 58064 "herstel buffer overgelopen"
60065 "herstel bestand" 59065 "herstel bestand"

cvs diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/Attic/french.base (expand / switch to unified diff)

--- src/dist/nvi/catalog/Attic/french.base 2008/05/16 18:03:05 1.1.1.1
+++ src/dist/nvi/catalog/Attic/french.base 2008/10/01 21:20:09 1.2
@@ -33,28 +33,27 @@ @@ -33,28 +33,27 @@
33034 "Définition : option [no]%s ne prend pas de valeur" 33034 "Définition : option [no]%s ne prend pas de valeur"
34035 "Définition : l'option %s n'est pas booléenne" 34035 "Définition : l'option %s n'est pas booléenne"
35036 "Définition : option %s : %s" 35036 "Définition : option %s : %s"
36037 "Définition : option %s : %s : Dépassement de valeur" 36037 "Définition : option %s : %s : Dépassement de valeur"
37038 "Définition : option %s : %s n'est pas un nombre valide" 37038 "Définition : option %s : %s n'est pas un nombre valide"
38039 "Définition : l'option %s n'est pas booléenne" 38039 "Définition : l'option %s n'est pas booléenne"
39040 "Les colonnes de l'écran sont trop petites, inférieures à %d" 39040 "Les colonnes de l'écran sont trop petites, inférieures à %d"
40041 "Les colonnes de l'écran sont trop grandes, supérieures à %d" 40041 "Les colonnes de l'écran sont trop grandes, supérieures à %d"
41042 "Les lignes de l'écran sont trop courtes, inférieures à %d" 41042 "Les lignes de l'écran sont trop courtes, inférieures à %d"
42043 "Les lignes de l'écran sont trop longues, supérieures à %d" 42043 "Les lignes de l'écran sont trop longues, supérieures à %d"
43044 "L'option lisp n'est pas implémentée" 43044 "L'option lisp n'est pas implémentée"
44045 "Les messages ne sont pas désactivés : %s" 44045 "Les messages ne sont pas désactivés : %s"
45046 "Les messages ne sont pas activés : %s" 45046 "Les messages ne sont pas activés : %s"
46048 "L'option de paragraphe doit être en groupe de deux caractères" 46047 "D‚finition : l'option de %s doit ˆtre en groupe de deux caractŠres"
47049 "L'option de section doit être en groupe de deux caractères" 
48053 "Le tampon par défaut est vide" 47053 "Le tampon par défaut est vide"
49054 "Le tampon %s est vide" 48054 "Le tampon %s est vide"
50055 "Les fichiers dont le nom contient des caractères de saut de ligne sont irrécupérables" 49055 "Les fichiers dont le nom contient des caractères de saut de ligne sont irrécupérables"
51056 "Impossible de récupérer les modifications si la session échoue" 50056 "Impossible de récupérer les modifications si la session échoue"
52057 "Copie en cours du fichier pour récupération..." 51057 "Copie en cours du fichier pour récupération..."
53058 "La préservation a échoué : %s" 52058 "La préservation a échoué : %s"
54059 "Impossible de récupérer les modifications si la session échoue" 53059 "Impossible de récupérer les modifications si la session échoue"
55060 "La sauvegarde du fichier a échoué : %s" 54060 "La sauvegarde du fichier a échoué : %s"
56061 "Copie en cours du fichier pour récupération..." 55061 "Copie en cours du fichier pour récupération..."
57062 "Les renseignements sur l'identité %u de l'utilisateur sont introuvables" 56062 "Les renseignements sur l'identité %u de l'utilisateur sont introuvables"
58063 "Impossible de verrouiller le fichier de récupération" 57063 "Impossible de verrouiller le fichier de récupération"
59064 "Débordement de tampon du fichier de récupération" 58064 "Débordement de tampon du fichier de récupération"
60065 "Fichier de récupération" 59065 "Fichier de récupération"

cvs diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/Attic/german.base (expand / switch to unified diff)

--- src/dist/nvi/catalog/Attic/german.base 2008/05/16 18:03:06 1.1.1.1
+++ src/dist/nvi/catalog/Attic/german.base 2008/10/01 21:20:09 1.2
@@ -33,28 +33,27 @@ @@ -33,28 +33,27 @@
33034 "set: der [no]%s Option kann kein Wert zugewiesen werden" 33034 "set: der [no]%s Option kann kein Wert zugewiesen werden"
34035 "set: %s ist keine Boolsche Option" 34035 "set: %s ist keine Boolsche Option"
35036 "set: %s Option: %s" 35036 "set: %s Option: %s"
36037 "set: %s Option: %s: Werte-Überlauf" 36037 "set: %s Option: %s: Werte-Überlauf"
37038 "set: %s Option: %s ist eine ungültige Zahl" 37038 "set: %s Option: %s ist eine ungültige Zahl"
38039 "set: %s ist keine Boolsche Option" 38039 "set: %s ist keine Boolsche Option"
39040 "Bildschirm hat zu wenig Spalten, weniger als %d" 39040 "Bildschirm hat zu wenig Spalten, weniger als %d"
40041 "Bildschirm hat zu viele Spalten, mehr als %d" 40041 "Bildschirm hat zu viele Spalten, mehr als %d"
41042 "Bildschirm hat zu wenig Zeilen, weniger als %d" 41042 "Bildschirm hat zu wenig Zeilen, weniger als %d"
42043 "Bildschirm hat zu viele Zeilen, mehr als %d" 42043 "Bildschirm hat zu viele Zeilen, mehr als %d"
43044 "Die lisp-Option ist nicht implementiert" 43044 "Die lisp-Option ist nicht implementiert"
44045 "Meldungen nicht abgeschaltet: %s" 44045 "Meldungen nicht abgeschaltet: %s"
45046 "Meldungen nicht eingeschaltet: %s" 45046 "Meldungen nicht eingeschaltet: %s"
46048 "Die paragraph-Option muß Gruppen zu zwei Zeichen enthalten" 46047 "set: Die %s Option muss Gruppen zu zwei Zeichen enthalten"
47049 "Die section-Option muß Gruppen zu zwei Zeichen enthalten" 
48053 "Der Standardpuffer ist leer" 47053 "Der Standardpuffer ist leer"
49054 "Puffer %s ist leer" 48054 "Puffer %s ist leer"
50055 "Dateien mit newlines im Namen sind nicht wiederherstellbar" 49055 "Dateien mit newlines im Namen sind nicht wiederherstellbar"
51056 "Änderungen nicht wiederherstellbar, falls die Editorsitzung schiefgeht" 50056 "Änderungen nicht wiederherstellbar, falls die Editorsitzung schiefgeht"
52057 "kopiere Datei für Wiederherstellung ..." 51057 "kopiere Datei für Wiederherstellung ..."
53058 "Rettungsmechanismus funktioniert nicht: %s" 52058 "Rettungsmechanismus funktioniert nicht: %s"
54059 "Änderungen nicht wiederherstellbar, falls die Editorsitzung schiefgeht" 53059 "Änderungen nicht wiederherstellbar, falls die Editorsitzung schiefgeht"
55060 "Sicherung der Datei gescheitert: %s" 54060 "Sicherung der Datei gescheitert: %s"
56061 "kopiere Datei für Wiederherstellung ..." 55061 "kopiere Datei für Wiederherstellung ..."
57062 "Informationen über den Benutzer mit id %u nicht gefunden" 56062 "Informationen über den Benutzer mit id %u nicht gefunden"
58063 "Wiederherstellungsdatei kann nicht gelockt werden" 57063 "Wiederherstellungsdatei kann nicht gelockt werden"
59064 "Puffer der Wiederherstellungsdatei übergelaufen" 58064 "Puffer der Wiederherstellungsdatei übergelaufen"
60065 "Wiederherstellungsdatei" 59065 "Wiederherstellungsdatei"

cvs diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/Attic/spanish.base (expand / switch to unified diff)

--- src/dist/nvi/catalog/Attic/spanish.base 2008/05/16 18:03:07 1.1.1.1
+++ src/dist/nvi/catalog/Attic/spanish.base 2008/10/01 21:20:09 1.2
@@ -33,28 +33,27 @@ @@ -33,28 +33,27 @@
33034 "determinar: [no] hay opci¢n %s no tiene valor" 33034 "determinar: [no] hay opci¢n %s no tiene valor"
34035 "determinar: opci¢n %s no es booleano" 34035 "determinar: opci¢n %s no es booleano"
35036 "determinar: opci¢n %s: %s" 35036 "determinar: opci¢n %s: %s"
36037 "determinar: opci¢n %s: %s: desbordamiento de valores" 36037 "determinar: opci¢n %s: %s: desbordamiento de valores"
37038 "determinar: opci¢n %s: %s es un n£mero ilegal" 37038 "determinar: opci¢n %s: %s es un n£mero ilegal"
38039 "determinar: opci¢n %s no es booleano" 38039 "determinar: opci¢n %s no es booleano"
39040 "Las columnas en pantalla son demasiado peque¤as, menos de %d" 39040 "Las columnas en pantalla son demasiado peque¤as, menos de %d"
40041 "Las columnas en pantalla son demasiado grandes, m s de %d" 40041 "Las columnas en pantalla son demasiado grandes, m s de %d"
41042 "Las l¡neas en pantalla son demasiado peque¤as, menos de %d" 41042 "Las l¡neas en pantalla son demasiado peque¤as, menos de %d"
42043 "Las l¡neas en pantalla son demasiado grandes, m s de %d" 42043 "Las l¡neas en pantalla son demasiado grandes, m s de %d"
43044 "La opci¢n lisp no est  implementada" 43044 "La opci¢n lisp no est  implementada"
44045 "mensajes no desconectados: %s" 44045 "mensajes no desconectados: %s"
45046 "mensajes no conectados: %s" 45046 "mensajes no conectados: %s"
46048 "La opci¢n de p rrafo debe estar en dos grupos de caracteres" 46047 "determinar: La opci¢n de %s debe estar en dos grupos de caracteres"
47049 "La opci¢n de secci¢n debe estar en dos grupos de caracteres" 
48053 "El buffer por omisi¢n est  vac¡o" 47053 "El buffer por omisi¢n est  vac¡o"
49054 "El buffer %s est  vac¡o" 48054 "El buffer %s est  vac¡o"
50055 "Los archivos con nuevas l¡neas en el nombre son irrecuperables" 49055 "Los archivos con nuevas l¡neas en el nombre son irrecuperables"
51056 "Las modificaciones no pueden recuperarse si la sesi¢n falla" 50056 "Las modificaciones no pueden recuperarse si la sesi¢n falla"
52057 "Copiando archivo para recuperaci¢n..." 51057 "Copiando archivo para recuperaci¢n..."
53058 "Preservaci¢n fracasada: %s" 52058 "Preservaci¢n fracasada: %s"
54059 "Las modificaciones no pueden recuperarse si la sesi¢n falla" 53059 "Las modificaciones no pueden recuperarse si la sesi¢n falla"
55060 "Archivo de respaldo fracasado: %s" 54060 "Archivo de respaldo fracasado: %s"
56061 "Copiando archivo para recuperaci¢n..." 55061 "Copiando archivo para recuperaci¢n..."
57062 "Informaci¢n sobre identificaci¢n del usuario %u no encontrada" 56062 "Informaci¢n sobre identificaci¢n del usuario %u no encontrada"
58063 "No se puede trabar archivo de recuperaci¢n" 57063 "No se puede trabar archivo de recuperaci¢n"
59064 "Desbordamiento de buffer de archivo de recuperaci¢n" 58064 "Desbordamiento de buffer de archivo de recuperaci¢n"
60065 "Archivo de recuperaci¢n" 59065 "Archivo de recuperaci¢n"

cvs diff -r1.1.1.1 -r1.2 src/dist/nvi/catalog/Attic/swedish.base (expand / switch to unified diff)

--- src/dist/nvi/catalog/Attic/swedish.base 2008/05/16 18:03:08 1.1.1.1
+++ src/dist/nvi/catalog/Attic/swedish.base 2008/10/01 21:20:09 1.2
@@ -33,28 +33,27 @@ @@ -33,28 +33,27 @@
33034 "set: [no]%s flaggan kan inte ges ett värde" 33034 "set: [no]%s flaggan kan inte ges ett värde"
34035 "set: %s flaggan är inte boleansk" 34035 "set: %s flaggan är inte boleansk"
35036 "set: %s flaggan: %s" 35036 "set: %s flaggan: %s"
36037 "set: %s flaggan: %s: för stort värde" 36037 "set: %s flaggan: %s: för stort värde"
37038 "set: %s flaggan: %s är ett otillåtet tal" 37038 "set: %s flaggan: %s är ett otillåtet tal"
38039 "set: %s flaggan är inte boleansk" 38039 "set: %s flaggan är inte boleansk"
39040 "Fönsterkolumnerna är för få, mindre än %d" 39040 "Fönsterkolumnerna är för få, mindre än %d"
40041 "Fönsterkolumnerna är för många, fler än %d" 40041 "Fönsterkolumnerna är för många, fler än %d"
41042 "Fönsterraderna är för få, mindre än %d" 41042 "Fönsterraderna är för få, mindre än %d"
42043 "Fönsterraderna är för många, fler än %d" 42043 "Fönsterraderna är för många, fler än %d"
43044 "Lisp flaggan är inte implementerad" 43044 "Lisp flaggan är inte implementerad"
44045 "meddelanden är inte avslagna: %s" 44045 "meddelanden är inte avslagna: %s"
45046 "meddelanden är inte påslagna: %s" 45046 "meddelanden är inte påslagna: %s"
46048 "Paragraph flaggan måste ges i teckengrupper om två" 46047 "set: %s flaggan måste ges i teckengrupper om två"
47049 "Section flaggan måste ges i teckengrupper om två" 
48053 "Standardbufferten är tom" 47053 "Standardbufferten är tom"
49054 "Buffer %s är tom" 48054 "Buffer %s är tom"
50055 "Filer med radmatning i namnet kan inte återskapas" 49055 "Filer med radmatning i namnet kan inte återskapas"
51056 "Ändringar kan inte återskapas om programmet kraschar" 50056 "Ändringar kan inte återskapas om programmet kraschar"
52057 "Kopierar filen för återskapning..." 51057 "Kopierar filen för återskapning..."
53058 "Säkerhetskopiering misslyckades: %s" 52058 "Säkerhetskopiering misslyckades: %s"
54059 "Ändringar kan inte återskapas om programmet kraschar" 53059 "Ändringar kan inte återskapas om programmet kraschar"
55060 "Misslyckades att säkerhetskopiera filen: %s" 54060 "Misslyckades att säkerhetskopiera filen: %s"
56061 "Kopierar filen för återskapning..." 55061 "Kopierar filen för återskapning..."
57062 "Kan inte hitta information om användaridentitet %u" 56062 "Kan inte hitta information om användaridentitet %u"
58063 "Kan inte låsa återskapningsfilen" 57063 "Kan inte låsa återskapningsfilen"
59064 "Återskapningsfilens buffer överskriven" 58064 "Återskapningsfilens buffer överskriven"
60065 "Återskapningsfil" 59065 "Återskapningsfil"

cvs diff -r1.1.1.2 -r1.2 src/dist/nvi/common/Attic/options.awk (expand / switch to unified diff)

--- src/dist/nvi/common/Attic/options.awk 2008/05/18 14:29:48 1.1.1.2
+++ src/dist/nvi/common/Attic/options.awk 2008/10/01 21:20:09 1.2
@@ -1,9 +1,21 @@ @@ -1,9 +1,21 @@
1# Id: options.awk,v 10.1 1995/06/08 19:00:01 bostic Exp (Berkeley) Date: 1995/06/08 19:00:01 1# Id: options.awk,v 10.1 1995/06/08 19:00:01 bostic Exp (Berkeley) Date: 1995/06/08 19:00:01
2  2
3/^\/\* O_[0-9A-Z_]*/ { 3/^\/\* O_[0-9A-Z_]*/ {
4 printf("#define %s %d\n", $2, cnt++); 4 opt = $2
5 next; 5 printf("#define %s %d\n", opt, cnt++)
 6 ofs = FS
 7 FS="\""
 8 do getline
 9 while ($1 != " {L(")
 10 FS=ofs
 11 opt_name = $2
 12 if (opt_name < prev_name) {
 13 printf "missorted %s: \"%s\" < \"%s\"\n", opt, opt_name, prev_name >"/dev/stderr"
 14 exit 1
 15 }
 16 prev_name = opt_name
 17 next
6} 18}
7END { 19END {
8 printf("#define O_OPTIONCOUNT %d\n", cnt); 20 printf("#define O_OPTIONCOUNT %d\n", cnt);
9} 21}

cvs diff -r1.1.1.2 -r1.2 src/dist/nvi/common/Attic/options.c (expand / switch to unified diff)

--- src/dist/nvi/common/Attic/options.c 2008/05/18 14:29:49 1.1.1.2
+++ src/dist/nvi/common/Attic/options.c 2008/10/01 21:20:09 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: options.c,v 1.1.1.2 2008/05/18 14:29:49 aymeric Exp $ */ 1/* $NetBSD: options.c,v 1.2 2008/10/01 21:20:09 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1991, 1993, 1994 4 * Copyright (c) 1991, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1991, 1993, 1994, 1995, 1996 6 * Copyright (c) 1991, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved. 7 * Keith Bostic. All rights reserved.
8 * 8 *
9 * See the LICENSE file for redistribution information. 9 * See the LICENSE file for redistribution information.
10 */ 10 */
11 11
12#include "config.h" 12#include "config.h"
13 13
14#ifndef lint 14#ifndef lint
@@ -40,26 +40,28 @@ static int opts_print __P((SCR *, OPT @@ -40,26 +40,28 @@ static int opts_print __P((SCR *, OPT
40#ifdef USE_WIDECHAR 40#ifdef USE_WIDECHAR
41#define OPT_WC 0 41#define OPT_WC 0
42#else 42#else
43#define OPT_WC (OPT_NOSAVE | OPT_NDISP) 43#define OPT_WC (OPT_NOSAVE | OPT_NDISP)
44#endif 44#endif
45 45
46/* 46/*
47 * O'Reilly noted options and abbreviations are from "Learning the VI Editor", 47 * O'Reilly noted options and abbreviations are from "Learning the VI Editor",
48 * Fifth Edition, May 1992. There's no way of knowing what systems they are 48 * Fifth Edition, May 1992. There's no way of knowing what systems they are
49 * actually from. 49 * actually from.
50 * 50 *
51 * HPUX noted options and abbreviations are from "The Ultimate Guide to the 51 * HPUX noted options and abbreviations are from "The Ultimate Guide to the
52 * VI and EX Text Editors", 1990. 52 * VI and EX Text Editors", 1990.
 53 *
 54 * This list must be sorted...
53 */ 55 */
54OPTLIST const optlist[] = { 56OPTLIST const optlist[] = {
55/* O_ALTWERASE 4.4BSD */ 57/* O_ALTWERASE 4.4BSD */
56 {L("altwerase"), f_altwerase, OPT_0BOOL, 0}, 58 {L("altwerase"), f_altwerase, OPT_0BOOL, 0},
57/* O_AUTOINDENT 4BSD */ 59/* O_AUTOINDENT 4BSD */
58 {L("autoindent"), NULL, OPT_0BOOL, 0}, 60 {L("autoindent"), NULL, OPT_0BOOL, 0},
59/* O_AUTOPRINT 4BSD */ 61/* O_AUTOPRINT 4BSD */
60 {L("autoprint"), NULL, OPT_1BOOL, 0}, 62 {L("autoprint"), NULL, OPT_1BOOL, 0},
61/* O_AUTOWRITE 4BSD */ 63/* O_AUTOWRITE 4BSD */
62 {L("autowrite"), NULL, OPT_0BOOL, 0}, 64 {L("autowrite"), NULL, OPT_0BOOL, 0},
63/* O_BACKUP 4.4BSD */ 65/* O_BACKUP 4.4BSD */
64 {L("backup"), NULL, OPT_STR, 0}, 66 {L("backup"), NULL, OPT_STR, 0},
65/* O_BEAUTIFY 4BSD */ 67/* O_BEAUTIFY 4BSD */
@@ -68,30 +70,30 @@ OPTLIST const optlist[] = { @@ -68,30 +70,30 @@ OPTLIST const optlist[] = {
68 {L("cdpath"), NULL, OPT_STR, 0}, 70 {L("cdpath"), NULL, OPT_STR, 0},
69/* O_CEDIT 4.4BSD */ 71/* O_CEDIT 4.4BSD */
70 {L("cedit"), NULL, OPT_STR, 0}, 72 {L("cedit"), NULL, OPT_STR, 0},
71/* O_COLUMNS 4.4BSD */ 73/* O_COLUMNS 4.4BSD */
72 {L("columns"), f_columns, OPT_NUM, OPT_NOSAVE}, 74 {L("columns"), f_columns, OPT_NUM, OPT_NOSAVE},
73/* O_COMBINED */ 75/* O_COMBINED */
74 {L("combined"), NULL, OPT_0BOOL, OPT_NOSET|OPT_WC}, 76 {L("combined"), NULL, OPT_0BOOL, OPT_NOSET|OPT_WC},
75/* O_COMMENT 4.4BSD */ 77/* O_COMMENT 4.4BSD */
76 {L("comment"), NULL, OPT_0BOOL, 0}, 78 {L("comment"), NULL, OPT_0BOOL, 0},
77/* O_TMP_DIRECTORY 4BSD */ 79/* O_TMP_DIRECTORY 4BSD */
78 {L("directory"), NULL, OPT_STR, 0}, 80 {L("directory"), NULL, OPT_STR, 0},
79/* O_EDCOMPATIBLE 4BSD */ 81/* O_EDCOMPATIBLE 4BSD */
80 {L("edcompatible"),NULL, OPT_0BOOL, 0}, 82 {L("edcompatible"),NULL, OPT_0BOOL, 0},
81/* O_ESCAPETIME 4.4BSD */ 
82 {L("escapetime"), NULL, OPT_NUM, 0}, 
83/* O_ERRORBELLS 4BSD */ 83/* O_ERRORBELLS 4BSD */
84 {L("errorbells"), NULL, OPT_0BOOL, 0}, 84 {L("errorbells"), NULL, OPT_0BOOL, 0},
 85/* O_ESCAPETIME 4.4BSD */
 86 {L("escapetime"), NULL, OPT_NUM, 0},
85/* O_EXRC System V (undocumented) */ 87/* O_EXRC System V (undocumented) */
86 {L("exrc"), NULL, OPT_0BOOL, 0}, 88 {L("exrc"), NULL, OPT_0BOOL, 0},
87/* O_EXTENDED 4.4BSD */ 89/* O_EXTENDED 4.4BSD */
88 {L("extended"), f_recompile, OPT_0BOOL, 0}, 90 {L("extended"), f_recompile, OPT_0BOOL, 0},
89/* O_FILEC 4.4BSD */ 91/* O_FILEC 4.4BSD */
90 {L("filec"), NULL, OPT_STR, 0}, 92 {L("filec"), NULL, OPT_STR, 0},
91/* O_FILEENCODING */ 93/* O_FILEENCODING */
92 {L("fileencoding"),f_encoding, OPT_STR, OPT_WC}, 94 {L("fileencoding"),f_encoding, OPT_STR, OPT_WC},
93/* O_FLASH HPUX */ 95/* O_FLASH HPUX */
94 {L("flash"), NULL, OPT_1BOOL, 0}, 96 {L("flash"), NULL, OPT_1BOOL, 0},
95/* O_HARDTABS 4BSD */ 97/* O_HARDTABS 4BSD */
96 {L("hardtabs"), NULL, OPT_NUM, 0}, 98 {L("hardtabs"), NULL, OPT_NUM, 0},
97/* O_ICLOWER 4.4BSD */ 99/* O_ICLOWER 4.4BSD */
@@ -112,77 +114,79 @@ OPTLIST const optlist[] = { @@ -112,77 +114,79 @@ OPTLIST const optlist[] = {
112 * so that :mkexrc dumps it. 114 * so that :mkexrc dumps it.
113 */ 115 */
114 {L("lisp"), f_lisp, OPT_0BOOL, OPT_NOSAVE}, 116 {L("lisp"), f_lisp, OPT_0BOOL, OPT_NOSAVE},
115/* O_LIST 4BSD */ 117/* O_LIST 4BSD */
116 {L("list"), f_reformat, OPT_0BOOL, 0}, 118 {L("list"), f_reformat, OPT_0BOOL, 0},
117/* O_LOCKFILES 4.4BSD 119/* O_LOCKFILES 4.4BSD
118 * XXX 120 * XXX
119 * Locking isn't reliable enough over NFS to require it, in addition, 121 * Locking isn't reliable enough over NFS to require it, in addition,
120 * it's a serious startup performance problem over some remote links. 122 * it's a serious startup performance problem over some remote links.
121 */ 123 */
122 {L("lock"), NULL, OPT_1BOOL, 0}, 124 {L("lock"), NULL, OPT_1BOOL, 0},
123/* O_MAGIC 4BSD */ 125/* O_MAGIC 4BSD */
124 {L("magic"), NULL, OPT_1BOOL, 0}, 126 {L("magic"), NULL, OPT_1BOOL, 0},
 127/* O_MATCHCHARS netbsd 2.0 */
 128 {L("matchchars"), NULL, OPT_STR, OPT_PAIRS},
125/* O_MATCHTIME 4.4BSD */ 129/* O_MATCHTIME 4.4BSD */
126 {L("matchtime"), NULL, OPT_NUM, 0}, 130 {L("matchtime"), NULL, OPT_NUM, 0},
127/* O_MESG 4BSD */ 131/* O_MESG 4BSD */
128 {L("mesg"), NULL, OPT_1BOOL, 0}, 132 {L("mesg"), NULL, OPT_1BOOL, 0},
129/* O_MODELINE 4BSD 133/* O_MODELINE 4BSD
130 * !!! 134 * !!!
131 * This has been documented in historical systems as both "modeline" 135 * This has been documented in historical systems as both "modeline"
132 * and as "modelines". Regardless of the name, this option represents 136 * and as "modelines". Regardless of the name, this option represents
133 * a security problem of mammoth proportions, not to mention a stunning 137 * a security problem of mammoth proportions, not to mention a stunning
134 * example of what your intro CS professor referred to as the perils of 138 * example of what your intro CS professor referred to as the perils of
135 * mixing code and data. Don't add it, or I will kill you. 139 * mixing code and data. Don't add it, or I will kill you.
136 */ 140 */
137 {L("modeline"), NULL, OPT_0BOOL, OPT_NOSET}, 141 {L("modeline"), NULL, OPT_0BOOL, OPT_NOSET},
138/* O_MSGCAT 4.4BSD */ 142/* O_MSGCAT 4.4BSD */
139 {L("msgcat"), f_msgcat, OPT_STR, 0}, 143 {L("msgcat"), f_msgcat, OPT_STR, 0},
140/* O_NOPRINT 4.4BSD */ 144/* O_NOPRINT 4.4BSD */
141 {L("noprint"), f_print, OPT_STR, 0}, 145 {L("noprint"), f_print, OPT_STR, 0},
142/* O_NUMBER 4BSD */ 146/* O_NUMBER 4BSD */
143 {L("number"), f_reformat, OPT_0BOOL, 0}, 147 {L("number"), f_reformat, OPT_0BOOL, 0},
144/* O_OCTAL 4.4BSD */ 148/* O_OCTAL 4.4BSD */
145 {L("octal"), f_print, OPT_0BOOL, 0}, 149 {L("octal"), f_print, OPT_0BOOL, 0},
146/* O_OPEN 4BSD */ 150/* O_OPEN 4BSD */
147 {L("open"), NULL, OPT_1BOOL, 0}, 151 {L("open"), NULL, OPT_1BOOL, 0},
148/* O_OPTIMIZE 4BSD */ 152/* O_OPTIMIZE 4BSD */
149 {L("optimize"), NULL, OPT_1BOOL, 0}, 153 {L("optimize"), NULL, OPT_1BOOL, 0},
150/* O_PARAGRAPHS 4BSD */ 154/* O_PARAGRAPHS 4BSD */
151 {L("paragraphs"), f_paragraph, OPT_STR, 0}, 155 {L("paragraphs"), NULL, OPT_STR, OPT_PAIRS},
152/* O_PATH 4.4BSD */ 156/* O_PATH 4.4BSD */
153 {L("path"), NULL, OPT_STR, 0}, 157 {L("path"), NULL, OPT_STR, 0},
154/* O_PRINT 4.4BSD */ 158/* O_PRINT 4.4BSD */
155 {L("print"), f_print, OPT_STR, 0}, 159 {L("print"), f_print, OPT_STR, 0},
156/* O_PROMPT 4BSD */ 160/* O_PROMPT 4BSD */
157 {L("prompt"), NULL, OPT_1BOOL, 0}, 161 {L("prompt"), NULL, OPT_1BOOL, 0},
158/* O_READONLY 4BSD (undocumented) */ 162/* O_READONLY 4BSD (undocumented) */
159 {L("readonly"), f_readonly, OPT_0BOOL, OPT_ALWAYS}, 163 {L("readonly"), f_readonly, OPT_0BOOL, OPT_ALWAYS},
160/* O_RECDIR 4.4BSD */ 164/* O_RECDIR 4.4BSD */
161 {L("recdir"), NULL, OPT_STR, 0}, 165 {L("recdir"), NULL, OPT_STR, 0},
162/* O_REDRAW 4BSD */ 166/* O_REDRAW 4BSD */
163 {L("redraw"), NULL, OPT_0BOOL, 0}, 167 {L("redraw"), NULL, OPT_0BOOL, 0},
164/* O_REMAP 4BSD */ 168/* O_REMAP 4BSD */
165 {L("remap"), NULL, OPT_1BOOL, 0}, 169 {L("remap"), NULL, OPT_1BOOL, 0},
166/* O_REPORT 4BSD */ 170/* O_REPORT 4BSD */
167 {L("report"), NULL, OPT_NUM, 0}, 171 {L("report"), NULL, OPT_NUM, 0},
168/* O_RULER 4.4BSD */ 172/* O_RULER 4.4BSD */
169 {L("ruler"), NULL, OPT_0BOOL, 0}, 173 {L("ruler"), NULL, OPT_0BOOL, 0},
170/* O_SCROLL 4BSD */ 174/* O_SCROLL 4BSD */
171 {L("scroll"), NULL, OPT_NUM, 0}, 175 {L("scroll"), NULL, OPT_NUM, 0},
172/* O_SEARCHINCR 4.4BSD */ 176/* O_SEARCHINCR 4.4BSD */
173 {L("searchincr"), NULL, OPT_0BOOL, 0}, 177 {L("searchincr"), NULL, OPT_0BOOL, 0},
174/* O_SECTIONS 4BSD */ 178/* O_SECTIONS 4BSD */
175 {L("sections"), f_section, OPT_STR, 0}, 179 {L("sections"), NULL, OPT_STR, OPT_PAIRS},
176/* O_SECURE 4.4BSD */ 180/* O_SECURE 4.4BSD */
177 {L("secure"), NULL, OPT_0BOOL, OPT_NOUNSET}, 181 {L("secure"), NULL, OPT_0BOOL, OPT_NOUNSET},
178/* O_SHELL 4BSD */ 182/* O_SHELL 4BSD */
179 {L("shell"), NULL, OPT_STR, 0}, 183 {L("shell"), NULL, OPT_STR, 0},
180/* O_SHELLMETA 4.4BSD */ 184/* O_SHELLMETA 4.4BSD */
181 {L("shellmeta"), NULL, OPT_STR, 0}, 185 {L("shellmeta"), NULL, OPT_STR, 0},
182/* O_SHIFTWIDTH 4BSD */ 186/* O_SHIFTWIDTH 4BSD */
183 {L("shiftwidth"), NULL, OPT_NUM, OPT_NOZERO}, 187 {L("shiftwidth"), NULL, OPT_NUM, OPT_NOZERO},
184/* O_SHOWMATCH 4BSD */ 188/* O_SHOWMATCH 4BSD */
185 {L("showmatch"), NULL, OPT_0BOOL, 0}, 189 {L("showmatch"), NULL, OPT_0BOOL, 0},
186/* O_SHOWMODE 4.4BSD */ 190/* O_SHOWMODE 4.4BSD */
187 {L("showmode"), NULL, OPT_0BOOL, 0}, 191 {L("showmode"), NULL, OPT_0BOOL, 0},
188/* O_SIDESCROLL 4.4BSD */ 192/* O_SIDESCROLL 4.4BSD */
@@ -299,26 +303,33 @@ static OABBREV const abbrev[] = { @@ -299,26 +303,33 @@ static OABBREV const abbrev[] = {
299 */ 303 */
300int 304int
301opts_init(SCR *sp, int *oargs) 305opts_init(SCR *sp, int *oargs)
302{ 306{
303 ARGS *argv[2], a, b; 307 ARGS *argv[2], a, b;
304 OPTLIST const *op; 308 OPTLIST const *op;
305 u_long isset, v; 309 u_long isset, v;
306 int cnt, optindx; 310 int cnt, optindx;
307 char *s; 311 char *s;
308 CHAR_T b2[1024]; 312 CHAR_T b2[1024];
309 CHAR_T *wp; 313 CHAR_T *wp;
310 size_t wlen; 314 size_t wlen;
311 315
 316 if (sizeof optlist / sizeof optlist[0] - 1 != O_OPTIONCOUNT) {
 317 fprintf(stderr, "vi: option table size error (%d != %d)\n",
 318 (int)(sizeof optlist / sizeof optlist[0] - 1),
 319 O_OPTIONCOUNT);
 320 exit(1);
 321 }
 322
312 a.bp = b2; 323 a.bp = b2;
313 b.bp = NULL; 324 b.bp = NULL;
314 a.len = b.len = 0; 325 a.len = b.len = 0;
315 argv[0] = &a; 326 argv[0] = &a;
316 argv[1] = &b; 327 argv[1] = &b;
317 328
318 /* Set numeric and string default values. */ 329 /* Set numeric and string default values. */
319#define OI(indx, str) { \ 330#define OI(indx, str) { \
320 a.len = STRLEN(str); \ 331 a.len = STRLEN(str); \
321 if ((CHAR_T*)str != b2) /* GCC puts strings in text-space. */ \ 332 if ((CHAR_T*)str != b2) /* GCC puts strings in text-space. */ \
322 (void)MEMCPY(b2, str, a.len+1); \ 333 (void)MEMCPY(b2, str, a.len+1); \
323 if (opts_set(sp, argv, NULL)) { \ 334 if (opts_set(sp, argv, NULL)) { \
324 optindx = indx; \ 335 optindx = indx; \
@@ -350,26 +361,27 @@ opts_init(SCR *sp, int *oargs) @@ -350,26 +361,27 @@ opts_init(SCR *sp, int *oargs)
350 361
351 /* 362 /*
352 * !!! 363 * !!!
353 * Vi historically stored temporary files in /var/tmp. We store them 364 * Vi historically stored temporary files in /var/tmp. We store them
354 * in /tmp by default, hoping it's a memory based file system. There 365 * in /tmp by default, hoping it's a memory based file system. There
355 * are two ways to change this -- the user can set either the directory 366 * are two ways to change this -- the user can set either the directory
356 * option or the TMPDIR environmental variable. 367 * option or the TMPDIR environmental variable.
357 */ 368 */
358 (void)SPRINTF(b2, SIZE(b2), 369 (void)SPRINTF(b2, SIZE(b2),
359 L("directory=%s"), (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s); 370 L("directory=%s"), (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s);
360 OI(O_TMP_DIRECTORY, b2); 371 OI(O_TMP_DIRECTORY, b2);
361 OI(O_ESCAPETIME, L("escapetime=1")); 372 OI(O_ESCAPETIME, L("escapetime=1"));
362 OI(O_KEYTIME, L("keytime=6")); 373 OI(O_KEYTIME, L("keytime=6"));
 374 OI(O_MATCHCHARS, L("matchchars=()[]{}<>"));
363 OI(O_MATCHTIME, L("matchtime=7")); 375 OI(O_MATCHTIME, L("matchtime=7"));
364 (void)SPRINTF(b2, SIZE(b2), L("msgcat=%s"), _PATH_MSGCAT); 376 (void)SPRINTF(b2, SIZE(b2), L("msgcat=%s"), _PATH_MSGCAT);
365 OI(O_MSGCAT, b2); 377 OI(O_MSGCAT, b2);
366 OI(O_REPORT, L("report=5")); 378 OI(O_REPORT, L("report=5"));
367 OI(O_PARAGRAPHS, L("paragraphs=IPLPPPQPP LIpplpipbp")); 379 OI(O_PARAGRAPHS, L("paragraphs=IPLPPPQPP LIpplpipbp"));
368 (void)SPRINTF(b2, SIZE(b2), L("path=%s"), ""); 380 (void)SPRINTF(b2, SIZE(b2), L("path=%s"), "");
369 OI(O_PATH, b2); 381 OI(O_PATH, b2);
370 (void)SPRINTF(b2, SIZE(b2), L("recdir=%s"), _PATH_PRESERVE); 382 (void)SPRINTF(b2, SIZE(b2), L("recdir=%s"), _PATH_PRESERVE);
371 OI(O_RECDIR, b2); 383 OI(O_RECDIR, b2);
372 OI(O_SECTIONS, L("sections=NHSHH HUnhsh")); 384 OI(O_SECTIONS, L("sections=NHSHH HUnhsh"));
373 (void)SPRINTF(b2, SIZE(b2), 385 (void)SPRINTF(b2, SIZE(b2),
374 L("shell=%s"), (s = getenv("SHELL")) == NULL ? _PATH_BSHELL : s); 386 L("shell=%s"), (s = getenv("SHELL")) == NULL ? _PATH_BSHELL : s);
375 OI(O_SHELL, b2); 387 OI(O_SHELL, b2);
@@ -700,26 +712,34 @@ badnum: INT2CHAR(sp, name, STRLEN(nam @@ -700,26 +712,34 @@ badnum: INT2CHAR(sp, name, STRLEN(nam
700 if (turnoff) { 712 if (turnoff) {
701 msgq_wstr(sp, M_ERR, name, 713 msgq_wstr(sp, M_ERR, name,
702 "039|set: %s option isn't a boolean"); 714 "039|set: %s option isn't a boolean");
703 rval = 1; 715 rval = 1;
704 break; 716 break;
705 } 717 }
706 if (qmark || !equals) { 718 if (qmark || !equals) {
707 if (!disp) 719 if (!disp)
708 disp = SELECT_DISPLAY; 720 disp = SELECT_DISPLAY;
709 F_SET(spo, OPT_SELECTED); 721 F_SET(spo, OPT_SELECTED);
710 break; 722 break;
711 } 723 }
712 724
 725 /* Check for strings that must have even length */
 726 if (F_ISSET(op, OPT_PAIRS) && STRLEN(sep) & 1) {
 727 msgq_wstr(sp, M_ERR, name,
 728 "047|set: the %s option must be in two character groups");
 729 rval = 1;
 730 break;
 731 }
 732
713 /* 733 /*
714 * Do nothing if the value is unchanged, the underlying 734 * Do nothing if the value is unchanged, the underlying
715 * functions can be expensive. 735 * functions can be expensive.
716 */ 736 */
717 INT2CHAR(sp, sep, STRLEN(sep) + 1, np, nlen); 737 INT2CHAR(sp, sep, STRLEN(sep) + 1, np, nlen);
718 if (!F_ISSET(op, OPT_ALWAYS) && 738 if (!F_ISSET(op, OPT_ALWAYS) &&
719 O_STR(sp, offset) != NULL && 739 O_STR(sp, offset) != NULL &&
720 !strcmp(O_STR(sp, offset), np)) 740 !strcmp(O_STR(sp, offset), np))
721 break; 741 break;
722 742
723 /* Report to subsystems. */ 743 /* Report to subsystems. */
724 if (op->func != NULL && 744 if (op->func != NULL &&
725 op->func(sp, spo, np, NULL) || 745 op->func(sp, spo, np, NULL) ||

cvs diff -r1.1.1.2 -r1.2 src/dist/nvi/common/Attic/options.h (expand / switch to unified diff)

--- src/dist/nvi/common/Attic/options.h 2008/05/18 14:29:49 1.1.1.2
+++ src/dist/nvi/common/Attic/options.h 2008/10/01 21:20:09 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: options.h,v 1.1.1.2 2008/05/18 14:29:49 aymeric Exp $ */ 1/* $NetBSD: options.h,v 1.2 2008/10/01 21:20:09 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1991, 1993, 1994 4 * Copyright (c) 1991, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1991, 1993, 1994, 1995, 1996 6 * Copyright (c) 1991, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved. 7 * Keith Bostic. All rights reserved.
8 * 8 *
9 * See the LICENSE file for redistribution information. 9 * See the LICENSE file for redistribution information.
10 * 10 *
11 * Id: options.h,v 10.20 2001/06/09 18:26:28 skimo Exp (Berkeley) Date: 2001/06/09 18:26:28 11 * Id: options.h,v 10.20 2001/06/09 18:26:28 skimo Exp (Berkeley) Date: 2001/06/09 18:26:28
12 */ 12 */
13 13
14/* 14/*
@@ -81,23 +81,24 @@ struct _optlist { @@ -81,23 +81,24 @@ struct _optlist {
81 CHAR_T *name; /* Name. */ 81 CHAR_T *name; /* Name. */
82 /* Change function. */ 82 /* Change function. */
83 int (*func) __P((SCR *, OPTION *, char *, u_long *)); 83 int (*func) __P((SCR *, OPTION *, char *, u_long *));
84 /* Type of object. */ 84 /* Type of object. */
85 enum { OPT_0BOOL, OPT_1BOOL, OPT_NUM, OPT_STR } type; 85 enum { OPT_0BOOL, OPT_1BOOL, OPT_NUM, OPT_STR } type;
86 86
87#define OPT_ADISP 0x001 /* Always display the option. */ 87#define OPT_ADISP 0x001 /* Always display the option. */
88#define OPT_ALWAYS 0x002 /* Always call the support function. */ 88#define OPT_ALWAYS 0x002 /* Always call the support function. */
89#define OPT_NDISP 0x004 /* Never display the option. */ 89#define OPT_NDISP 0x004 /* Never display the option. */
90#define OPT_NOSAVE 0x008 /* Mkexrc command doesn't save. */ 90#define OPT_NOSAVE 0x008 /* Mkexrc command doesn't save. */
91#define OPT_NOSET 0x010 /* Option may not be set. */ 91#define OPT_NOSET 0x010 /* Option may not be set. */
92#define OPT_NOUNSET 0x020 /* Option may not be unset. */ 92#define OPT_NOUNSET 0x020 /* Option may not be unset. */
93#define OPT_NOZERO 0x040 /* Option may not be set to 0. */ 93#define OPT_NOZERO 0x040 /* Option may not be set to 0. */
 94#define OPT_PAIRS 0x080 /* String with even length */
94 u_int8_t flags; 95 u_int8_t flags;
95}; 96};
96 97
97/* Option argument to opts_dump(). */ 98/* Option argument to opts_dump(). */
98enum optdisp { NO_DISPLAY, ALL_DISPLAY, CHANGED_DISPLAY, SELECT_DISPLAY }; 99enum optdisp { NO_DISPLAY, ALL_DISPLAY, CHANGED_DISPLAY, SELECT_DISPLAY };
99 100
100/* Options array. */ 101/* Options array. */
101extern OPTLIST const optlist[]; 102extern OPTLIST const optlist[];
102 103
103#include "options_def.h" 104#include "options_def.h"

cvs diff -r1.1.1.2 -r1.2 src/dist/nvi/common/Attic/options_f.c (expand / switch to unified diff)

--- src/dist/nvi/common/Attic/options_f.c 2008/05/18 14:29:50 1.1.1.2
+++ src/dist/nvi/common/Attic/options_f.c 2008/10/01 21:20:09 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: options_f.c,v 1.1.1.2 2008/05/18 14:29:50 aymeric Exp $ */ 1/* $NetBSD: options_f.c,v 1.2 2008/10/01 21:20:09 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1993, 1994 4 * Copyright (c) 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1993, 1994, 1995, 1996 6 * Copyright (c) 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved. 7 * Keith Bostic. All rights reserved.
8 * 8 *
9 * See the LICENSE file for redistribution information. 9 * See the LICENSE file for redistribution information.
10 */ 10 */
11 11
12#include "config.h" 12#include "config.h"
13 13
14#ifndef lint 14#ifndef lint
@@ -52,27 +52,27 @@ f_columns(SCR *sp, OPTION *op, char *str @@ -52,27 +52,27 @@ f_columns(SCR *sp, OPTION *op, char *str
52 msgq(sp, M_ERR, "040|Screen columns too small, less than %d", 52 msgq(sp, M_ERR, "040|Screen columns too small, less than %d",
53 MINIMUM_SCREEN_COLS); 53 MINIMUM_SCREEN_COLS);
54 return (1); 54 return (1);
55 } 55 }
56 56
57 /* 57 /*
58 * !!! 58 * !!!
59 * It's not uncommon for allocation of huge chunks of memory to cause 59 * It's not uncommon for allocation of huge chunks of memory to cause
60 * core dumps on various systems. So, we prune out numbers that are 60 * core dumps on various systems. So, we prune out numbers that are
61 * "obviously" wrong. Vi will not work correctly if it has the wrong 61 * "obviously" wrong. Vi will not work correctly if it has the wrong
62 * number of lines/columns for the screen, but at least we don't drop 62 * number of lines/columns for the screen, but at least we don't drop
63 * core. 63 * core.
64 */ 64 */
65#define MAXIMUM_SCREEN_COLS 500 65#define MAXIMUM_SCREEN_COLS 4000
66 if (*valp > MAXIMUM_SCREEN_COLS) { 66 if (*valp > MAXIMUM_SCREEN_COLS) {
67 msgq(sp, M_ERR, "041|Screen columns too large, greater than %d", 67 msgq(sp, M_ERR, "041|Screen columns too large, greater than %d",
68 MAXIMUM_SCREEN_COLS); 68 MAXIMUM_SCREEN_COLS);
69 return (1); 69 return (1);
70 } 70 }
71 return (0); 71 return (0);
72} 72}
73 73
74/* 74/*
75 * PUBLIC: int f_lines __P((SCR *, OPTION *, char *, u_long *)); 75 * PUBLIC: int f_lines __P((SCR *, OPTION *, char *, u_long *));
76 */ 76 */
77int 77int
78f_lines(SCR *sp, OPTION *op, char *str, u_long *valp) 78f_lines(SCR *sp, OPTION *op, char *str, u_long *valp)
@@ -82,27 +82,27 @@ f_lines(SCR *sp, OPTION *op, char *str,  @@ -82,27 +82,27 @@ f_lines(SCR *sp, OPTION *op, char *str,
82 msgq(sp, M_ERR, "042|Screen lines too small, less than %d", 82 msgq(sp, M_ERR, "042|Screen lines too small, less than %d",
83 MINIMUM_SCREEN_ROWS); 83 MINIMUM_SCREEN_ROWS);
84 return (1); 84 return (1);
85 } 85 }
86 86
87 /* 87 /*
88 * !!! 88 * !!!
89 * It's not uncommon for allocation of huge chunks of memory to cause 89 * It's not uncommon for allocation of huge chunks of memory to cause
90 * core dumps on various systems. So, we prune out numbers that are 90 * core dumps on various systems. So, we prune out numbers that are
91 * "obviously" wrong. Vi will not work correctly if it has the wrong 91 * "obviously" wrong. Vi will not work correctly if it has the wrong
92 * number of lines/columns for the screen, but at least we don't drop 92 * number of lines/columns for the screen, but at least we don't drop
93 * core. 93 * core.
94 */ 94 */
95#define MAXIMUM_SCREEN_ROWS 500 95#define MAXIMUM_SCREEN_ROWS 4000
96 if (*valp > MAXIMUM_SCREEN_ROWS) { 96 if (*valp > MAXIMUM_SCREEN_ROWS) {
97 msgq(sp, M_ERR, "043|Screen lines too large, greater than %d", 97 msgq(sp, M_ERR, "043|Screen lines too large, greater than %d",
98 MAXIMUM_SCREEN_ROWS); 98 MAXIMUM_SCREEN_ROWS);
99 return (1); 99 return (1);
100 } 100 }
101 101
102 /* 102 /*
103 * Set the value, and the related scroll value. If no window 103 * Set the value, and the related scroll value. If no window
104 * value set, set a new default window. 104 * value set, set a new default window.
105 */ 105 */
106 o_set(sp, O_LINES, 0, NULL, *valp); 106 o_set(sp, O_LINES, 0, NULL, *valp);
107 if (*valp == 1) { 107 if (*valp == 1) {
108 sp->defscroll = 1; 108 sp->defscroll = 1;
@@ -135,40 +135,26 @@ f_lisp(SCR *sp, OPTION *op, char *str, u @@ -135,40 +135,26 @@ f_lisp(SCR *sp, OPTION *op, char *str, u
135} 135}
136 136
137/* 137/*
138 * PUBLIC: int f_msgcat __P((SCR *, OPTION *, char *, u_long *)); 138 * PUBLIC: int f_msgcat __P((SCR *, OPTION *, char *, u_long *));
139 */ 139 */
140int 140int
141f_msgcat(SCR *sp, OPTION *op, char *str, u_long *valp) 141f_msgcat(SCR *sp, OPTION *op, char *str, u_long *valp)
142{ 142{
143 (void)msg_open(sp, str); 143 (void)msg_open(sp, str);
144 return (0); 144 return (0);
145} 145}
146 146
147/* 147/*
148 * PUBLIC: int f_paragraph __P((SCR *, OPTION *, char *, u_long *)); 
149 */ 
150int 
151f_paragraph(SCR *sp, OPTION *op, char *str, u_long *valp) 
152{ 
153 if (strlen(str) & 1) { 
154 msgq(sp, M_ERR, 
155 "048|The paragraph option must be in two character groups"); 
156 return (1); 
157 } 
158 return (0); 
159} 
160 
161/* 
162 * PUBLIC: int f_print __P((SCR *, OPTION *, char *, u_long *)); 148 * PUBLIC: int f_print __P((SCR *, OPTION *, char *, u_long *));
163 */ 149 */
164int 150int
165f_print(SCR *sp, OPTION *op, char *str, u_long *valp) 151f_print(SCR *sp, OPTION *op, char *str, u_long *valp)
166{ 152{
167 int offset = op - sp->opts; 153 int offset = op - sp->opts;
168 154
169 /* Preset the value, needed for reinitialization of lookup table. */ 155 /* Preset the value, needed for reinitialization of lookup table. */
170 if (offset == O_OCTAL) { 156 if (offset == O_OCTAL) {
171 if (*valp) 157 if (*valp)
172 O_SET(sp, offset); 158 O_SET(sp, offset);
173 else 159 else
174 O_CLR(sp, offset); 160 O_CLR(sp, offset);
@@ -218,40 +204,26 @@ f_recompile(SCR *sp, OPTION *op, char *s @@ -218,40 +204,26 @@ f_recompile(SCR *sp, OPTION *op, char *s
218} 204}
219 205
220/* 206/*
221 * PUBLIC: int f_reformat __P((SCR *, OPTION *, char *, u_long *)); 207 * PUBLIC: int f_reformat __P((SCR *, OPTION *, char *, u_long *));
222 */ 208 */
223int 209int
224f_reformat(SCR *sp, OPTION *op, char *str, u_long *valp) 210f_reformat(SCR *sp, OPTION *op, char *str, u_long *valp)
225{ 211{
226 F_SET(sp, SC_SCR_REFORMAT); 212 F_SET(sp, SC_SCR_REFORMAT);
227 return (0); 213 return (0);
228} 214}
229 215
230/* 216/*
231 * PUBLIC: int f_section __P((SCR *, OPTION *, char *, u_long *)); 
232 */ 
233int 
234f_section(SCR *sp, OPTION *op, char *str, u_long *valp) 
235{ 
236 if (strlen(str) & 1) { 
237 msgq(sp, M_ERR, 
238 "049|The section option must be in two character groups"); 
239 return (1); 
240 } 
241 return (0); 
242} 
243 
244/* 
245 * PUBLIC: int f_ttywerase __P((SCR *, OPTION *, char *, u_long *)); 217 * PUBLIC: int f_ttywerase __P((SCR *, OPTION *, char *, u_long *));
246 */ 218 */
247int 219int
248f_ttywerase(SCR *sp, OPTION *op, char *str, u_long *valp) 220f_ttywerase(SCR *sp, OPTION *op, char *str, u_long *valp)
249{ 221{
250 if (*valp) 222 if (*valp)
251 O_CLR(sp, O_ALTWERASE); 223 O_CLR(sp, O_ALTWERASE);
252 return (0); 224 return (0);
253} 225}
254 226
255/* 227/*
256 * PUBLIC: int f_w300 __P((SCR *, OPTION *, char *, u_long *)); 228 * PUBLIC: int f_w300 __P((SCR *, OPTION *, char *, u_long *));
257 */ 229 */

cvs diff -r1.1.1.2 -r1.2 src/dist/nvi/docs/vi.man/Attic/vi.1 (expand / switch to unified diff)

--- src/dist/nvi/docs/vi.man/Attic/vi.1 2008/05/18 14:30:57 1.1.1.2
+++ src/dist/nvi/docs/vi.man/Attic/vi.1 2008/10/01 21:20:09 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: vi.1,v 1.1.1.2 2008/05/18 14:30:57 aymeric Exp $ 1.\" $NetBSD: vi.1,v 1.2 2008/10/01 21:20:09 christos Exp $
2.\" 2.\"
3.\" Copyright (c) 1994 3.\" Copyright (c) 1994
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
5.\" Copyright (c) 1994, 1995, 1996 5.\" Copyright (c) 1994, 1995, 1996
6.\" Keith Bostic. All rights reserved. 6.\" Keith Bostic. All rights reserved.
7.\" 7.\"
8.\" This document may not be republished without written permission from 8.\" This document may not be republished without written permission from
9.\" Keith Bostic.  9.\" Keith Bostic.
10.\" 10.\"
11.\" See the LICENSE file for redistribution information. 11.\" See the LICENSE file for redistribution information.
12.\" 12.\"
13.\" Id: vi.1,v 8.53 2001/01/28 13:20:06 skimo Exp (Berkeley) Date: 2001/01/28 13:20:06 13.\" Id: vi.1,v 8.53 2001/01/28 13:20:06 skimo Exp (Berkeley) Date: 2001/01/28 13:20:06
14.\" 14.\"
@@ -1143,26 +1143,29 @@ only. @@ -1143,26 +1143,29 @@ only.
1143Modify various search commands and options to work with Lisp. 1143Modify various search commands and options to work with Lisp.
1144.I "This option is not yet implemented." 1144.I "This option is not yet implemented."
1145.TP 1145.TP
1146.B "list [off]" 1146.B "list [off]"
1147Display lines in an unambiguous fashion. 1147Display lines in an unambiguous fashion.
1148.TP 1148.TP
1149.B "lock [on]" 1149.B "lock [on]"
1150Attempt to get an exclusive lock on any file being edited, 1150Attempt to get an exclusive lock on any file being edited,
1151read or written. 1151read or written.
1152.TP 1152.TP
1153.B "magic [on]" 1153.B "magic [on]"
1154Treat certain characters specially in regular expressions. 1154Treat certain characters specially in regular expressions.
1155.TP 1155.TP
 1156.B "matchchars [[]{}()<>]"
 1157Character pairs looked for by the % command.
 1158.TP
1156.B "matchtime [7]" 1159.B "matchtime [7]"
1157.I \&Vi 1160.I \&Vi
1158only. 1161only.
1159The 10th's of a second 1162The 10th's of a second
1160.I ex/vi 1163.I ex/vi
1161pauses on the matching character when the 1164pauses on the matching character when the
1162.B showmatch 1165.B showmatch
1163option is set. 1166option is set.
1164.TP 1167.TP
1165.B "mesg [on]" 1168.B "mesg [on]"
1166Permit messages from other users. 1169Permit messages from other users.
1167.TP 1170.TP
1168.B "modelines, modeline [off]" 1171.B "modelines, modeline [off]"

cvs diff -r1.1.1.2 -r1.2 src/dist/nvi/docs/vi.ref/Attic/set.opt.texi (expand / switch to unified diff)

--- src/dist/nvi/docs/vi.ref/Attic/set.opt.texi 2008/05/18 14:31:00 1.1.1.2
+++ src/dist/nvi/docs/vi.ref/Attic/set.opt.texi 2008/10/01 21:20:09 1.2
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1@comment Copyright (c) 1994 1@comment Copyright (c) 1994
2@c $NetBSD: set.opt.texi,v 1.1.1.2 2008/05/18 14:31:00 aymeric Exp $ 2@c $NetBSD: set.opt.texi,v 1.2 2008/10/01 21:20:09 christos Exp $
3@comment The Regents of the University of California. All rights reserved. 3@comment The Regents of the University of California. All rights reserved.
4@comment Copyright (c) 1994, 1995, 1996 4@comment Copyright (c) 1994, 1995, 1996
5@comment Keith Bostic. All rights reserved. 5@comment Keith Bostic. All rights reserved.
6@comment  6@comment
7@comment See the LICENSE file for redistribution information. 7@comment See the LICENSE file for redistribution information.
8@comment  8@comment
9@comment Id: set.opt.texi,v 8.1 2001/08/18 20:43:48 skimo Exp (Berkeley) Date: 2001/08/18 20:43:48 9@comment Id: set.opt.texi,v 8.1 2001/08/18 20:43:48 skimo Exp (Berkeley) Date: 2001/08/18 20:43:48
10@comment  10@comment
11@chapter Set Options 11@chapter Set Options
12 12
13There are a large number of options that may be set (or unset) to 13There are a large number of options that may be set (or unset) to
14change the editor's behavior. 14change the editor's behavior.
15This section describes the options, their abbreviations and their 15This section describes the options, their abbreviations and their
@@ -584,26 +584,35 @@ option off causes all regular expression @@ -584,26 +584,35 @@ option off causes all regular expression
584@QT{^} 584@QT{^}
585and 585and
586@QT{$}, 586@QT{$},
587to be treated as ordinary characters. 587to be treated as ordinary characters.
588To re-enable characters individually, when the 588To re-enable characters individually, when the
589@OP{magic} 589@OP{magic}
590option is off, 590option is off,
591precede them with a backslash 591precede them with a backslash
592@QT{\e} 592@QT{\e}
593character. 593character.
594See the section entitled 594See the section entitled
595@QB{Regular Expressions and Replacement Strings} 595@QB{Regular Expressions and Replacement Strings}
596for more information. 596for more information.
 597@cindex matchchars
 598@IP{matchchars [[]{}()<>]}
 599
 600@CO{Vi}
 601only.
 602This option defines the character pairs used by the
 603@CO{%}
 604command.
 605
597@cindex matchtime 606@cindex matchtime
598@IP{matchtime [7]} 607@IP{matchtime [7]}
599 608
600@CO{Vi} 609@CO{Vi}
601only. 610only.
602The 10th's of a second 611The 10th's of a second
603@CO{vi} 612@CO{vi}
604pauses on the matching character when the 613pauses on the matching character when the
605@OP{showmatch} 614@OP{showmatch}
606option is set. 615option is set.
607@cindex mesg 616@cindex mesg
608@IP{mesg [on]} 617@IP{mesg [on]}
609 618

cvs diff -r1.1.1.2 -r1.2 src/dist/nvi/docs/vi.ref/Attic/vi.cmd.texi (expand / switch to unified diff)

--- src/dist/nvi/docs/vi.ref/Attic/vi.cmd.texi 2008/05/18 14:31:02 1.1.1.2
+++ src/dist/nvi/docs/vi.ref/Attic/vi.cmd.texi 2008/10/01 21:20:09 1.2
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1@comment Copyright (c) 1994 1@comment Copyright (c) 1994
2@c $NetBSD: vi.cmd.texi,v 1.1.1.2 2008/05/18 14:31:02 aymeric Exp $ 2@c $NetBSD: vi.cmd.texi,v 1.2 2008/10/01 21:20:09 christos Exp $
3@comment The Regents of the University of California. All rights reserved. 3@comment The Regents of the University of California. All rights reserved.
4@comment Copyright (c) 1994, 1995, 1996 4@comment Copyright (c) 1994, 1995, 1996
5@comment Keith Bostic. All rights reserved. 5@comment Keith Bostic. All rights reserved.
6@comment  6@comment
7@comment See the LICENSE file for redistribution information. 7@comment See the LICENSE file for redistribution information.
8@comment  8@comment
9@comment Id: vi.cmd.texi,v 8.1 2001/08/18 20:43:49 skimo Exp (Berkeley) Date: 2001/08/18 20:43:49 9@comment Id: vi.cmd.texi,v 8.1 2001/08/18 20:43:49 skimo Exp (Berkeley) Date: 2001/08/18 20:43:49
10@comment  10@comment
11@chapter Vi Description 11@chapter Vi Description
12 12
13@CO{Vi} takes up the entire screen to display the edited file, 13@CO{Vi} takes up the entire screen to display the edited file,
14except for the bottom line of the screen. 14except for the bottom line of the screen.
15The bottom line of the screen is used to enter 15The bottom line of the screen is used to enter
@@ -1035,33 +1035,43 @@ in the line, although it is an error whe @@ -1035,33 +1035,43 @@ in the line, although it is an error whe
1035@item Line: 1035@item Line:
1036Set to the current line plus 1036Set to the current line plus
1037@LI{count}minus 1. 1037@LI{count}minus 1.
1038@item Column: 1038@item Column:
1039Set to the last character in the line. 1039Set to the last character in the line.
1040@item Options: 1040@item Options:
1041None. 1041None.
1042@end table 1042@end table
1043@end deftypefn 1043@end deftypefn
1044@cindex % 1044@cindex %
1045@deftypefn Command {} {%} 1045@deftypefn Command {} {%}
1046 1046
1047Move to the matching character. 1047Move to the matching character.
1048The cursor moves to the parenthesis or curly brace which 1048The cursor moves to the bracket character which
1049@emph{matches} 1049@emph{matches}
1050the parenthesis or curly brace found at the current cursor position 1050the bracket found at the current cursor position
1051or which is the closest one to the right of the cursor on the line. 1051or which is the closest one to the right of the cursor on the line.
1052It is an error to execute the 1052The bracket characters are defined by the
 1053@OP{matchchars}
 1054option.
 1055An error will be reported if none of the
 1056@OP{matchchars}
 1057characters is found, or if no matching character is found.
 1058If the open and close brackes are identical (e.g.: if they are
 1059@QT{'}
 1060or
 1061@QT{"},
 1062then repeating a
1053@CO{%} 1063@CO{%}
1054command on a line without a parenthesis or curly brace. 1064command will perform a backwards search from the original opening bracket.
1055Historically, any 1065Historically, any
1056@LI{count}specified to the 1066@LI{count}specified to the
1057@CO{%} 1067@CO{%}
1058command was ignored. 1068command was ignored.
1059@sp 1 1069@sp 1
1060The 1070The
1061@CO{%} 1071@CO{%}
1062command is an absolute movement. 1072command is an absolute movement.
1063The 1073The
1064@CO{%} 1074@CO{%}
1065command may be used as the motion component of other 1075command may be used as the motion component of other
1066@CO{vi} 1076@CO{vi}
1067commands, in which case any text copied into a buffer is 1077commands, in which case any text copied into a buffer is

cvs diff -r1.1.1.2 -r1.2 src/dist/nvi/vi/Attic/v_match.c (expand / switch to unified diff)

--- src/dist/nvi/vi/Attic/v_match.c 2008/05/18 14:31:42 1.1.1.2
+++ src/dist/nvi/vi/Attic/v_match.c 2008/10/01 21:20:09 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: v_match.c,v 1.1.1.2 2008/05/18 14:31:42 aymeric Exp $ */ 1/* $NetBSD: v_match.c,v 1.2 2008/10/01 21:20:09 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993, 1994 4 * Copyright (c) 1992, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1992, 1993, 1994, 1995, 1996 6 * Copyright (c) 1992, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved. 7 * Keith Bostic. All rights reserved.
8 * 8 *
9 * See the LICENSE file for redistribution information. 9 * See the LICENSE file for redistribution information.
10 */ 10 */
11 11
12#include "config.h" 12#include "config.h"
13 13
14#ifndef lint 14#ifndef lint
@@ -31,126 +31,125 @@ static const char sccsid[] = "Id: v_matc @@ -31,126 +31,125 @@ static const char sccsid[] = "Id: v_matc
31 * v_match -- % 31 * v_match -- %
32 * Search to matching character. 32 * Search to matching character.
33 * 33 *
34 * PUBLIC: int v_match __P((SCR *, VICMD *)); 34 * PUBLIC: int v_match __P((SCR *, VICMD *));
35 */ 35 */
36int 36int
37v_match(SCR *sp, VICMD *vp) 37v_match(SCR *sp, VICMD *vp)
38{ 38{
39 VCS cs; 39 VCS cs;
40 MARK *mp; 40 MARK *mp;
41 size_t cno, len, off; 41 size_t cno, len, off;
42 int cnt, isempty, matchc, startc, (*gc)__P((SCR *, VCS *)); 42 int cnt, isempty, matchc, startc, (*gc)__P((SCR *, VCS *));
43 CHAR_T *p; 43 CHAR_T *p;
 44 char *cp;
 45 char *match_chars;
 46
 47 static int match_lno, match_col, match_dir;
 48
 49 /*
 50 * Historically vi would match (), {} and [] however
 51 * an update included <>. This is ok for editing HTML
 52 * but a pain in the butt for C source.
 53 * Making it an option lets the user decide what is 'right'.
 54 * Also fixed to do something sensible with "".
 55 */
 56 match_chars = O_STR(sp, O_MATCHCHARS);
44 57
45 /* 58 /*
46 * !!! 59 * !!!
47 * Historic practice; ignore the count. 60 * Historic practice; ignore the count.
48 * 61 *
49 * !!! 62 * !!!
50 * Historical practice was to search for the initial character in the 63 * Historical practice was to search for the initial character in the
51 * forward direction only. 64 * forward direction only.
52 */ 65 */
53 if (db_eget(sp, vp->m_start.lno, &p, &len, &isempty)) { 66 if (db_eget(sp, vp->m_start.lno, &p, &len, &isempty)) {
54 if (isempty) 67 if (isempty)
55 goto nomatch; 68 goto nomatch;
56 return (1); 69 return (1);
57 } 70 }
58 for (off = vp->m_start.cno;; ++off) { 71 for (off = vp->m_start.cno;; ++off) {
59 if (off >= len) { 72 if (off >= len) {
60nomatch: msgq(sp, M_BERR, "184|No match character on this line"); 73nomatch: msgq(sp, M_BERR, "184|No match character on this line");
61 return (1); 74 return (1);
62 } 75 }
63 switch (startc = p[off]) { 76 startc = p[off];
64 case '(': 77 cp = strchr(match_chars, startc);
65 matchc = ')'; 78 if (cp != NULL)
66 gc = cs_next; 
67 break; 
68 case ')': 
69 matchc = '('; 
70 gc = cs_prev; 
71 break; 
72 case '[': 
73 matchc = ']'; 
74 gc = cs_next; 
75 break; 
76 case ']': 
77 matchc = '['; 
78 gc = cs_prev; 
79 break; 
80 case '{': 
81 matchc = '}'; 
82 gc = cs_next; 
83 break; 
84 case '}': 
85 matchc = '{'; 
86 gc = cs_prev; 
87 break; 79 break;
88 case '<': 
89 matchc = '>'; 
90 gc = cs_next; 
91 break; 
92 case '>': 
93 matchc = '<'; 
94 gc = cs_prev; 
95 break; 
96 default: 
97 continue; 
98 } 
99 break; 
100 } 80 }
 81 cnt = cp - match_chars;
 82 matchc = match_chars[cnt ^ 1];
 83
 84 /* Alternate back-forward search if startc and matchc the same */
 85 if (startc == matchc) {
 86 /* are we continuing from where last match finished? */
 87 if (match_lno == vp->m_start.lno && match_col ==vp->m_start.cno)
 88 /* yes - continue in sequence */
 89 match_dir++;
 90 else
 91 /* no - go forward, back, back, forward */
 92 match_dir = 1;
 93 if (match_dir & 2)
 94 cnt++;
 95 }
 96 gc = cnt & 1 ? cs_prev : cs_next;
101 97
102 cs.cs_lno = vp->m_start.lno; 98 cs.cs_lno = vp->m_start.lno;
103 cs.cs_cno = off; 99 cs.cs_cno = off;
104 if (cs_init(sp, &cs)) 100 if (cs_init(sp, &cs))
105 return (1); 101 return (1);
106 for (cnt = 1;;) { 102 for (cnt = 1;;) {
107 if (gc(sp, &cs)) 103 if (gc(sp, &cs))
108 return (1); 104 return (1);
109 if (cs.cs_flags != 0) { 105 if (cs.cs_flags != 0) {
110 if (cs.cs_flags == CS_EOF || cs.cs_flags == CS_SOF) 106 if (cs.cs_flags == CS_EOF || cs.cs_flags == CS_SOF)
111 break; 107 break;
112 continue; 108 continue;
113 } 109 }
 110 if (cs.cs_ch == matchc && --cnt == 0)
 111 break;
114 if (cs.cs_ch == startc) 112 if (cs.cs_ch == startc)
115 ++cnt; 113 ++cnt;
116 else if (cs.cs_ch == matchc && --cnt == 0) 
117 break; 
118 } 114 }
119 if (cnt) { 115 if (cnt) {
120 msgq(sp, M_BERR, "185|Matching character not found"); 116 msgq(sp, M_BERR, "185|Matching character not found");
121 return (1); 117 return (1);
122 } 118 }
123 119
124 vp->m_stop.lno = cs.cs_lno; 120 vp->m_stop.lno = cs.cs_lno;
125 vp->m_stop.cno = cs.cs_cno; 121 vp->m_stop.cno = cs.cs_cno;
126 122
127 /* 123 /*
128 * If moving right, non-motion commands move to the end of the range. 124 * If moving right, non-motion commands move to the end of the range.
129 * Delete and yank stay at the start. 125 * Delete and yank stay at the start.
130 * 126 *
131 * If moving left, all commands move to the end of the range. 127 * If moving left, all commands move to the end of the range.
132 * 128 *
133 * !!! 129 * !!!
134 * Don't correct for leftward movement -- historic vi deleted the 130 * Don't correct for leftward movement -- historic vi deleted the
135 * starting cursor position when deleting to a match. 131 * starting cursor position when deleting to a match.
136 */ 132 */
137 if (vp->m_start.lno < vp->m_stop.lno || 133 if (vp->m_start.lno < vp->m_stop.lno ||
138 vp->m_start.lno == vp->m_stop.lno && 134 vp->m_start.lno == vp->m_stop.lno &&
139 vp->m_start.cno < vp->m_stop.cno) 135 vp->m_start.cno < vp->m_stop.cno)
140 vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop; 136 vp->m_final = ISMOTION(vp) ? vp->m_start : vp->m_stop;
141 else 137 else
142 vp->m_final = vp->m_stop; 138 vp->m_final = vp->m_stop;
143 139
 140 match_lno = vp->m_final.lno;
 141 match_col = vp->m_final.cno;
 142
144 /* 143 /*
145 * !!! 144 * !!!
146 * If the motion is across lines, and the earliest cursor position 145 * If the motion is across lines, and the earliest cursor position
147 * is at or before any non-blank characters in the line, i.e. the 146 * is at or before any non-blank characters in the line, i.e. the
148 * movement is cutting all of the line's text, and the later cursor 147 * movement is cutting all of the line's text, and the later cursor
149 * position has nothing other than whitespace characters between it 148 * position has nothing other than whitespace characters between it
150 * and the end of its line, the buffer is in line mode. 149 * and the end of its line, the buffer is in line mode.
151 */ 150 */
152 if (!ISMOTION(vp) || vp->m_start.lno == vp->m_stop.lno) 151 if (!ISMOTION(vp) || vp->m_start.lno == vp->m_stop.lno)
153 return (0); 152 return (0);
154 mp = vp->m_start.lno < vp->m_stop.lno ? &vp->m_start : &vp->m_stop; 153 mp = vp->m_start.lno < vp->m_stop.lno ? &vp->m_start : &vp->m_stop;
155 if (mp->cno != 0) { 154 if (mp->cno != 0) {
156 cno = 0; 155 cno = 0;