4 static int rcmp(Rule *r, char *target, Word *tail);
8 addrule(char *head, Word *tail, char *body, Word *ahead, int attr, int hline, char *prog)
17 if(sym = symlook(head, S_TARGET, 0)){
18 for(r = (Rule *)sym->value; r; r = r->chain)
19 if(rcmp(r, head, tail) == 0){
25 r = (Rule *)Malloc(sizeof(Rule));
32 r->alltargets = ahead;
36 rr = (Rule *)symlook(head, S_TARGET, (void *)r)->value;
45 if((attr®EXP) || charin(head, "%&")){
51 r->pat = regcomp(head);
73 dumpr(char *s, Rule *r)
75 Bprint(&bout, "%s: start=%ld\n", s, r);
76 for(; r; r = r->next){
77 Bprint(&bout, "\tRule %ld: %s[%d] attr=%x next=%ld chain=%ld alltarget='%s'",
78 r, r->file, r->line, r->attr, r->next, r->chain, wtos(r->alltargets, ' '));
80 Bprint(&bout, " prog='%s'", r->prog);
81 Bprint(&bout, "\n\ttarget=%s: %s\n", r->target, wtos(r->tail, ' '));
82 Bprint(&bout, "\trecipe@%ld='%s'\n", r->recipe, r->recipe);
87 rcmp(Rule *r, char *target, Word *tail)
91 if(strcmp(r->target, target))
93 for(w = r->tail; w && tail; w = w->next, tail = tail->next)
94 if(strcmp(w->s, tail->s))
105 memset(s, 0, nrules);