diff --git a/src/cmd/plumb/match.c b/src/cmd/plumb/match.c index 4cb32cc6..70d912a7 100644 --- a/src/cmd/plumb/match.c +++ b/src/cmd/plumb/match.c @@ -38,11 +38,11 @@ verbis(int obj, Plumbmsg *m, Rule *r) } static void -setvar(Resub rs[10], char *match[10]) +setvar(Resub rs[NMATCHSUBEXP], char *match[NMATCHSUBEXP]) { int i, n; - for(i=0; i<10; i++){ + for(i=0; iregex, alltext, rs, 10) || rs[0].s.sp!=alltext || rs[0].e.ep!=alltext+ntext) + if(!regexec(r->regex, alltext, rs, NMATCHSUBEXP) + || rs[0].s.sp!=alltext || rs[0].e.ep!=alltext+ntext) break; setvar(rs, e->match); return 1; @@ -300,7 +301,7 @@ freeexec(Exec *exec) return; free(exec->dir); free(exec->file); - for(i=0; i<10; i++) + for(i=0; imatch[i]); free(exec); } diff --git a/src/cmd/plumb/plumber.h b/src/cmd/plumb/plumber.h index 44700559..65d5d0ac 100644 --- a/src/cmd/plumb/plumber.h +++ b/src/cmd/plumb/plumber.h @@ -52,10 +52,15 @@ struct Ruleset char *port; }; +enum +{ + NMATCHSUBEXP = 10 +}; + struct Exec { Plumbmsg *msg; - char *match[10]; + char *match[NMATCHSUBEXP]; int p0; /* begin and end of match */ int p1; int clearclick; /* click was expanded; remove attribute */