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;
104
while(*cp == ' ' || *cp == '\t') /* leading white space */
107
cp += chartorune(&r, cp);
117
cp = shellt->expandquote(cp, r, b);
119
fprint(2, "missing closing quote: %s\n", *s);
127
if(b->current != b->start){
128
bufcpy(b, w->s, strlen(w->s));
131
w->s = strdup(b->start);
132
b->current = b->start;
135
bufcpy(b, tail->s, strlen(tail->s));
136
bufcpy(b, w->s, strlen(w->s));
139
tail->s = strdup(b->start);
140
tail->next = w->next;
143
b->current = b->start;
156
if(b->current != b->start){
159
bufcpy(b, tail->s, strlen(tail->s));
160
bufcpy(b, b->start, cp-b->start);
163
tail->s = strdup(cp);
166
head = newword(b->start);
174
dumpw(char *s, Word *w)
176
Bprint(&bout, "%s", s);
177
for(; w; w = w->next)
178
Bprint(&bout, " '%s'", w->s);