6 extern int _needsquotes(char*, int*);
7 extern int _runeneedsquotes(Rune*, int*);
10 unquotestrdup(char *s)
15 ret = s = strdup(s); /* return unquoted copy */
19 t = s; /* s is output string, t is input string */
20 while(*t!='\0' && (quoting || (*t!=' ' && *t!='\t'))){
31 /* quoting and we're on a quote */
33 /* end of quoted section; absorb closing quote */
38 /* doubled quote; fold one quote into two */
43 memmove(s, t, strlen(t)+1);
48 unquoterunestrdup(Rune *s)
53 ret = s = runestrdup(s); /* return unquoted copy */
57 t = s; /* s is output string, t is input string */
58 while(*t!='\0' && (quoting || (*t!=' ' && *t!='\t'))){
69 /* quoting and we're on a quote */
71 /* end of quoted section; absorb closing quote */
76 /* doubled quote; fold one quote into two */
81 memmove(s, t, (runestrlen(t)+1)*sizeof(Rune));
92 if(_needsquotes(s, "elen) == 0)
95 ret = malloc(quotelen+1);
103 *u++ = r; /* double the quote */
112 quoterunestrdup(Rune *s)
118 if(_runeneedsquotes(s, "elen) == 0)
119 return runestrdup(s);
121 ret = malloc((quotelen+1)*sizeof(Rune));
129 *u++ = r; /* double the quote */