コード例 #1
0
ファイル: tw.comp.c プロジェクト: 2trill2spill/freebsd
/* tw_match():
 *	Match a string against the pattern given.
 *	and return the number of matched characters
 *	in a prefix of the string.
 */
static int
tw_match(const Char *str, const Char *pat, int exact)
{
    const Char *estr;
    int rv = exact ? Gmatch(estr = str, pat) : Gnmatch(str, pat, &estr);
#ifdef TDEBUG
    xprintf("G%smatch(%s, ", exact ? "" : "n", short2str(str));
    xprintf("%s, ", short2str(pat));
    xprintf("%s) = %d [%" TCSH_PTRDIFF_T_FMT "d]\n", short2str(estr), rv,
	estr - str);
#endif /* TDEBUG */
    return (int) (rv ? estr - str : -1);
}
コード例 #2
0
ファイル: sh.glob.c プロジェクト: 2014-class/freerouter
int
Gmatch(const Char *string, const Char *pattern)
{
    return Gnmatch(string, pattern, NULL);
}