12static const 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,
const stralloc *sain)
25 if (!stralloc_ready(saout,sain->len * 2 + 2))
return 0;
28 for (i = 0;i < sain->len;++i)
31 if ((ch ==
'\r') || (ch ==
'\n') || (ch ==
'"') || (ch ==
'\\'))
48 if (uch >= 128)
return 1;
49 if (!ok[uch])
return 1;
51 if (s[0] ==
'.')
return 1;
52 if (s[n - 1] ==
'.')
return 1;
53 for (i = 0;i < n - 1;++i)
if (s[i] ==
'.')
if (s[i + 1] ==
'.')
return 1;
57int quote(stralloc *saout,
const stralloc *sain)
60 return stralloc_copy(saout,sain);
63static stralloc foo = {0};
65int quote2(stralloc *sa,
const char *s)
69 if (!stralloc_copys(&foo,s))
return 0;
70 if (!s[j])
return quote(sa,&foo);
72 if (!
quote(sa,&foo))
return 0;
73 return stralloc_cats(sa,s + j);
void doit(char *addr, unsigned long msgnum, unsigned long when, stralloc *bounce)
int quote2(stralloc *sa, const char *s)
int quote(stralloc *saout, const stralloc *sain)
int quote_need(const char *s, unsigned int n)