|
|
|
@ -461,6 +461,28 @@ lookupstyle(char *ctxt, char *style)
|
|
|
|
|
return found;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
testforstyle(char *ctxt, char *style)
|
|
|
|
|
{
|
|
|
|
|
Style s;
|
|
|
|
|
Stypat p;
|
|
|
|
|
int found = 0;
|
|
|
|
|
|
|
|
|
|
s = (Style)zstyletab->getnode2(zstyletab, style);
|
|
|
|
|
if (s) {
|
|
|
|
|
MatchData match;
|
|
|
|
|
savematch(&match);
|
|
|
|
|
for (p = s->pats; p; p = p->next)
|
|
|
|
|
if (pattry(p->prog, ctxt)) {
|
|
|
|
|
found = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
restorematch(&match);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return !found; /* 0 == success */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
|
|
|
|
{
|
|
|
|
@ -570,6 +592,7 @@ bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
|
|
|
|
case 't': min = 2; max = -1; break;
|
|
|
|
|
case 'T': min = 2; max = -1; break;
|
|
|
|
|
case 'm': min = 3; max = 3; break;
|
|
|
|
|
case 'q': min = 2; max = 2; break;
|
|
|
|
|
case 'g': min = 1; max = 3; break;
|
|
|
|
|
default:
|
|
|
|
|
zwarnnam(nam, "invalid option: %s", args[0]);
|
|
|
|
@ -723,6 +746,15 @@ bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'q':
|
|
|
|
|
{
|
|
|
|
|
int success;
|
|
|
|
|
queue_signals(); /* Protect PAT_STATIC */
|
|
|
|
|
success = testforstyle(args[1], args[2]);
|
|
|
|
|
unqueue_signals();
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'g':
|
|
|
|
|
{
|
|
|
|
|
int ret = 1;
|
|
|
|
|