12static char ok[128] = {
13 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
14,0,7,0,7,7,7,7,7,0,0,7,7,0,7,7,7 ,7,7,7,7,7,7,7,7,7,7,0,0,0,7,0,7
15,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 ,7,7,7,7,7,7,7,7,7,7,7,0,0,0,7,7
16,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 ,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0
19static int doit(stralloc *saout,stralloc *sain)
25 if (!stralloc_ready(saout,sain->len * 2 + 2))
return 0;
29 for (i = 0; i < sain->len; ++i) {
31 if ((ch ==
'\r') || (ch ==
'\n') || (ch ==
'"') || (ch ==
'\\'))
47 for (i = 0; i < n; ++i) {
49 if (uch >= 128)
return 1;
50 if (!ok[uch])
return 1;
52 if (s[0] ==
'.')
return 1;
53 if (s[n - 1] ==
'.')
return 1;
55 for (i = 0; i < n - 1; ++i)
57 if (s[i + 1] ==
'.')
return 1;
62int quote(stralloc *saout,stralloc *sain)
65 return stralloc_copy(saout,sain);
68static stralloc
foo = {0};
80 return stralloc_cats(
sa,s +
j);
int stralloc_copys(stralloc *, char const *)
int quote_need(char *s, unsigned int n)
int quote(stralloc *saout, stralloc *sain)
int quote2(stralloc *sa, char *s)