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 = sym->u.ptr; r; r = r->chain)
19 if(rcmp(r, head, tail) == 0){
25 r = (Rule *)Malloc(sizeof(Rule));
27 r->shellcmd = shellcmd;
34 r->alltargets = ahead;
38 rr = symlook(head, S_TARGET, (void *)r)->u.ptr;
47 if((attr®EXP) || shellt->charin(head, "%&")){
53 r->pat = regcomp(head);
75 dumpr(char *s, Rule *r)
79 Bprint(&bout, "%s: start=%ld shelltype=%s shellcmd=%s\n",
80 s, r, r->shellt->name, wtos(r->shellcmd, ' '));
81 for(; r; r = r->next){
82 Bprint(&bout, "\tRule %ld: %s[%d] attr=%x next=%ld chain=%ld alltarget='%s'",
83 r, r->file, r->line, r->attr, r->next, r->chain, wtos(r->alltargets, ' '));
85 Bprint(&bout, " prog='%s'", r->prog);
86 Bprint(&bout, "\n\ttarget=%s: %s\n", r->target, wtos(r->tail, ' '));
87 Bprint(&bout, "\trecipe@%ld='%s'\n", r->recipe, r->recipe);
92 rcmp(Rule *r, char *target, Word *tail)
96 if(strcmp(r->target, target))
98 for(w = r->tail; w && tail; w = w->next, tail = tail->next)
99 if(strcmp(w->s, tail->s))
110 memset(s, 0, nrules);