]> thyrsus.com Git - vh.git/commitdiff
Tightened pattern recognition for references.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 11 Jun 1993 23:59:34 +0000 (23:59 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 11 Jun 1993 23:59:34 +0000 (23:59 +0000)
vh.1
vh.c

diff --git a/vh.1 b/vh.1
index d2eb278bb91a551e4402a08e3047456ce50c6afe..6bb09f1451a1aa19b4d0a38dd779d2dea92d524d 100644 (file)
--- a/vh.1
+++ b/vh.1
@@ -118,10 +118,13 @@ wrong places; it will let you know if your index is out of date.
 
 If the first character of the text file is not a `=', the code also assumes:
 
-2. Reference targets begin with a `:' at the left margin and are bounded
+2. Reference text may not begin with whitespace, single- or double-quote, nor
+   end with a semicolon.
+
+3. Reference targets begin with a `:' at the left margin and are bounded
 on the right by another `:' (an optional second `:' may follow that).
 
-This second rule is useful for filtering out false hits from the index.
+These rules are useful for filtering out false hits from the index.
 .SH FILES
 A copy of vh called  `foo' would require the following:
 .TP 3.5i
diff --git a/vh.c b/vh.c
index 8daea7a127efef2bc5c72e3e8f200474b7bf2757..e96eaba0ae4e972daad9b38df53dc1c093c27451 100644 (file)
--- a/vh.c
+++ b/vh.c
@@ -1159,6 +1159,7 @@ char      *name;
     long lnum = 1;
     char refbuf[LNSZ + 1], *refpt = refbuf;
     int c, len = 0, depth = 0;
+    bool goforit = FALSE;
 
     /* time for consistency check */
     initbrowse(name);
@@ -1181,18 +1182,19 @@ char    *name;
            ungetc(c = fgetc(vht->fp), vht->fp);
            if (isprint(c))
                ++depth;
+           goforit = (c != '"' && c != '\'' && !isspace(c));
        }
        else if (depth > 0 && c == RTAG)
        {
            ++len;
            --depth;
-           if (depth == 0 && refpt != refbuf)
+           if (depth == 0 && refpt != refbuf && goforit && refpt[-1] != ';')
            {
                *refpt = '\0';
                if (xlocate(refbuf) < 0)
                    (void) printf(DANGLING, name, TXT, lnum, refbuf);
-               refpt = refbuf;
            }
+           refpt = refbuf;
        }
        else if (depth != 0)
        {