5
static int rhead(char *, Word **, Word **, int *, char **);
6
static char *rbody(Biobuf*);
10
parse(char *f, int fd, int varoverride)
23
fprint(2, "open %s: %r\n", f);
30
Binit(&in, fd, OREAD);
32
while(assline(&in, buf)){
34
switch(rhead(buf->start, &head, &tail, &attr, &prog))
40
fprint(2, "missing include file name\n");
43
newfd = open(p, OREAD);
45
fprint(2, "warning: skipping missing include file %s: %r\n", p);
53
fprint(2, "missing include program name\n");
57
pid=pipecmd(p, envy, &newfd, shellt, shellcmd);
59
fprint(2, "warning: skipping missing program file %s: %r\n", p);
62
while(waitup(-3, &pid) >= 0)
65
fprint(2, "bad include program status\n");
71
addrules(head, tail, body, attr, hline, prog);
76
fprint(2, "multiple vars on left side of assignment\n");
79
if(symlook(head->s, S_OVERRIDE, 0)){
84
symlook(head->s, S_OVERRIDE, (void *)"");
90
cp = wtos(tail, ' '); print("assign %s to %s\n", head->s, cp); free(cp);
92
setvar(head->s, (void *) tail);
93
symlook(head->s, S_WESET, (void *)"");
94
if(strcmp(head->s, "MKSHELL") == 0){
95
if((err = setshell(tail)) != nil){
97
fprint(2, "%s\n", err);
104
symlook(head->s, S_NOEXPORT, (void *)"");
108
fprint(2, "expected one of :<=\n");
120
addrules(Word *head, Word *tail, char *body, int attr, int hline, char *prog)
124
assert("addrules args", head && body);
125
/* tuck away first non-meta rule as default target*/
126
if(target1 == 0 && !(attr®EXP)){
127
for(w = head; w; w = w->next)
128
if(shellt->charin(w->s, "%&"))
131
target1 = wdup(head);
133
for(w = head; w; w = w->next)
134
addrule(w->s, tail, body, head, attr, hline, prog);
138
rhead(char *line, Word **h, Word **t, int *attr, char **prog)
147
p = shellt->charin(line,":=<");
152
if(sep == '<' && *p == '|'){
159
pp = shellt->charin(p, shellt->termchars); /* termchars is shell-dependent */
160
if (pp && *pp == '=') {
162
n = chartorune(&r, p);
167
fprint(2, "unknown attribute '%c'\n",*p);
175
p++; /* skip trailing '=' */
178
if((sep == ':') && *p && (*p != ' ') && (*p != '\t')){
180
n = chartorune(&r, p);
188
fprint(2, "unknown attribute '%c'\n", p[-1]);
203
pp = utfrune(p, ':');
204
if (pp == 0 || *pp == 0)
228
fprint(2, "missing trailing :\n");
233
if(*w->s == 0 && sep != '<' && sep != '|' && sep != 'S') {
235
fprint(2, "no var on left side of assignment/rule\n");
258
else if (r != ' ' && r != '\t') {
269
p = strdup(buf->start);
280
static struct input *inputs = 0;
285
struct input *in, *me;
287
me = (struct input *)Malloc(sizeof(*me));
294
for(in = inputs; in->next; )
303
struct input *in, *me;
305
assert("pop input list", inputs != 0);
306
if(inputs->next == 0){
310
for(in = inputs; in->next->next; )