3 static char *vexpand(char*, Envy*, Bufblock*);
4 static char *shquote(char*, Rune, Bufblock*);
5 static char *shbquote(char*, Bufblock*);
8 shprint(char *s, Envy *env, Bufblock *buf)
14 n = chartorune(&r, s);
16 s = vexpand(s, env, buf);
20 s = copyq(s, r, buf); /*handle quoted strings*/
27 mygetenv(char *name, Envy *env)
31 if (symlook(name, S_WESET, 0) == 0 && symlook(name, S_INTERNAL, 0) == 0)
33 /* only resolve internal variables and variables we've set */
34 for(; env->name; env++){
35 if (strcmp(env->name, name) == 0)
36 return wtos(env->values, ' ');
42 vexpand(char *w, Envy *env, Bufblock *buf)
44 char *s, carry, *p, *q;
46 assert(/*vexpand no $*/ *w == '$');
47 p = w+1; /* skip dollar sign */
62 bufcpy(buf, s, strlen(s));
64 } else /* copy name intact*/
77 i = getfields(q, flds, nelem(flds), 0, " \t\n");
84 for(j = 0; j < i; j++){
85 for(s = flds[j]; *s; *t++ = *s++);