Mercurial > aewl
comparison tag.c @ 609:dcbbfabc8ecc 2.5
applied Manuel's regex patch
author | arg@mig29 |
---|---|
date | Sun, 03 Dec 2006 11:21:25 +0100 |
parents | f7dcd3ac8d6f |
children | c7f84f23ec5a |
comparison
equal
deleted
inserted
replaced
608:ecfc43176b2d | 609:dcbbfabc8ecc |
---|---|
53 len = sizeof rule / sizeof rule[0]; | 53 len = sizeof rule / sizeof rule[0]; |
54 rreg = emallocz(len * sizeof(RReg)); | 54 rreg = emallocz(len * sizeof(RReg)); |
55 for(i = 0; i < len; i++) { | 55 for(i = 0; i < len; i++) { |
56 if(rule[i].clpattern) { | 56 if(rule[i].clpattern) { |
57 reg = emallocz(sizeof(regex_t)); | 57 reg = emallocz(sizeof(regex_t)); |
58 if(regcomp(reg, rule[i].clpattern, 0)) | 58 if(regcomp(reg, rule[i].clpattern, REG_EXTENDED)) |
59 free(reg); | 59 free(reg); |
60 else | 60 else |
61 rreg[i].clregex = reg; | 61 rreg[i].clregex = reg; |
62 } | 62 } |
63 if(rule[i].tpattern) { | 63 if(rule[i].tpattern) { |
64 reg = emallocz(sizeof(regex_t)); | 64 reg = emallocz(sizeof(regex_t)); |
65 if(regcomp(reg, rule[i].tpattern, 0)) | 65 if(regcomp(reg, rule[i].tpattern, REG_EXTENDED)) |
66 free(reg); | 66 free(reg); |
67 else | 67 else |
68 rreg[i].tregex = reg; | 68 rreg[i].tregex = reg; |
69 } | 69 } |
70 } | 70 } |
84 } | 84 } |
85 else if(XGetClassHint(dpy, c->win, &ch)) { | 85 else if(XGetClassHint(dpy, c->win, &ch)) { |
86 snprintf(prop, sizeof prop, "%s:%s:%s", | 86 snprintf(prop, sizeof prop, "%s:%s:%s", |
87 ch.res_class ? ch.res_class : "", | 87 ch.res_class ? ch.res_class : "", |
88 ch.res_name ? ch.res_name : "", c->name); | 88 ch.res_name ? ch.res_name : "", c->name); |
89 for(i = 0; !matched && i < len; i++) | 89 for(i = 0; i < len; i++) |
90 if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) { | 90 if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) { |
91 c->isfloat = rule[i].isfloat; | 91 c->isfloat = rule[i].isfloat; |
92 for(j = 0; rreg[i].tregex && j < ntags; j++) { | 92 for(j = 0; rreg[i].tregex && j < ntags; j++) { |
93 if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { | 93 if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { |
94 matched = True; | 94 matched = True; |