3 static Word *nextword(char**);
10 w = (Word *)Malloc(sizeof(Word));
40 wtos(Word *w, int sep)
46 for(; w; w = w->next){
47 for(cp = w->s; *cp; cp++)
53 cp = strdup(buf->start);
90 * break out a word from a string handling quotes, executions,
91 * and variable expansions.
97 Word *head, *tail, *w;
106 while(*cp == ' ' || *cp == '\t') /* leading white space */
110 cp += chartorune(&r, cp);
121 cp = expandquote(cp, r, b);
123 fprint(2, "missing closing quote: %s\n", *s);
135 if(b->current != b->start){
136 bufcpy(b, w->s, strlen(w->s));
139 w->s = strdup(b->start);
140 b->current = b->start;
143 bufcpy(b, tail->s, strlen(tail->s));
144 bufcpy(b, w->s, strlen(w->s));
147 tail->s = strdup(b->start);
148 tail->next = w->next;
151 b->current = b->start;
165 if(b->current != b->start){
168 bufcpy(b, tail->s, strlen(tail->s));
169 bufcpy(b, b->start, cp-b->start);
172 tail->s = strdup(cp);
175 head = newword(b->start);
183 dumpw(char *s, Word *w)
185 Bprint(&bout, "%s", s);
186 for(; w; w = w->next)
187 Bprint(&bout, " '%s'", w->s);