Fix broken file name globbing. Man is now also able to find pages

like "3DBorder" and "[".  (NB, the "3DBorder" problem has actually
been intention, it allowed for weird section names like "3xyzzy".  We
don't have them, either.)

(Partially) Submitted by:	taob@gate.sinica.edu.tw (Brian Tao)
This commit is contained in:
Joerg Wunsch 1995-04-11 22:01:53 +00:00
parent bfb50190bb
commit c8a2ad770c
2 changed files with 14 additions and 4 deletions

View File

@ -197,7 +197,8 @@ glob_match (pattern, text, dot_special)
{
register char c1 = *t++;
int invert;
char *cp1 = p;
if (c1 == '\0')
return 0;
@ -218,8 +219,15 @@ glob_match (pattern, text, dot_special)
}
if (cstart == '\0')
return 0; /* Missing ']'. */
{
/* Missing ']'. */
if (c1 != '[')
return 0;
/* matched a single bracket */
p = cp1;
goto breakbracket;
}
c = *p++;
if (c == '-')
@ -254,6 +262,7 @@ glob_match (pattern, text, dot_special)
}
if (invert)
return 0;
breakbracket:
break;
}

View File

@ -458,7 +458,8 @@ is_section (name)
register char **vs;
for (vs = section_list; *vs != NULL; vs++)
if ((strcmp (*vs, name) == NULL) || (isdigit (name[0])))
if ((strcmp (*vs, name) == NULL)
|| (isdigit (name[0]) && strlen(name) == 1))
return strdup (name);
return NULL;