4 static 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 = sym->u.ptr; r; r = r->chain)
19 if(rcmp(r, head, tail) == 0){
25 r = (Rule *)Malloc(sizeof(Rule));
32 r->alltargets = ahead;
37 rr = symlook(head, S_TARGET, r)->u.ptr;
46 if((attr®EXP) || charin(head, "%&")){
52 r->pat = regcomp(head);
74 dumpr(char *s, Rule *r)
76 Bprint(&bout, "%s: start=%p\n", s, r);
77 for(; r; r = r->next){
78 Bprint(&bout, "\tRule %p: %s:%d attr=%x next=%p chain=%p alltarget='%s'",
79 r, r->file, r->line, r->attr, r->next, r->chain, wtos(r->alltargets, ' '));
81 Bprint(&bout, " prog='%s'", r->prog);
82 Bprint(&bout, "\n\ttarget=%s: %s\n", r->target, wtos(r->tail,' '));
83 Bprint(&bout, "\trecipe@%p='%s'\n", r->recipe, r->recipe);
88 rcmp(Rule *r, char *target, Word *tail)
92 if(strcmp(r->target, target))
94 for(w = r->tail; w && tail; w = w->next, tail = tail->next)
95 if(strcmp(w->s, tail->s))
106 memset(s, 0, nrules);