42 if (!stralloc_copys(&in,
""))
nomem();
43 if (!stralloc_copys(&
out,
""))
nomem();
45 for (
int i = 0; i < header->len; i++) {
47 if (ch ==
'\0')
goto DONE;
48 if (i == header->len - 2 && ch ==
'=')
goto DONE;
50 if (ch ==
'?') seenq++;
52 if (!stralloc_copys(&in,
""))
nomem();
53 if (ch ==
'q' || ch ==
'Q') {
55 }
else if (ch ==
'b' || ch ==
'B') {
64 if (seenq == 3 && ch !=
'?' && ch !=
' ')
if (!stralloc_append(&in,&ch))
nomem();
65 if (seenq == 4) { done = 1;
if (!stralloc_0(&in))
nomem(); }
66 if (ch ==
' ' || ch ==
'\n' || ch ==
'\t') {
if (!stralloc_0(&in))
nomem(); done = 1; }
67 }
else if (ch !=
'=') {
68 if (!stralloc_append(&in,&ch))
nomem();
71 if (i == header->len - 1) done = 1;
77 case 0:
if (!stralloc_0(&in))
nomem();
78 if (!stralloc_catb(&
out,in.s,in.len))
nomem();
79 if (!stralloc_copys(&in,
""))
nomem();
82 case 3:
if (!stralloc_copys(&word,
""))
nomem();
84 if (!stralloc_cat(&
out,&word))
nomem();
86 if (!stralloc_copys(&in,
""))
nomem();
88 logmsg(
WHO,0,INFO,B(
"error decoding header: ",word.s));
89 if (!stralloc_catb(&
out,in.s,in.len))
nomem();
90 } done = 0; seenq = 0; mimetype = 0;
break;
91 case 5:
if (!stralloc_copys(&word,
""))
nomem();
93 if (!stralloc_cat(&
out,&word))
nomem();
95 if (!stralloc_copys(&in,
""))
nomem();
97 if (!stralloc_catb(&
out,in.s,in.len))
nomem();
98 logmsg(
WHO,0,INFO,B(
"error decoding header: ",word.s));
99 if (!stralloc_catb(&
out,in.s,in.len))
nomem();
100 } done = 0; seenq = 0; mimetype = 0;
break;
107 if (!stralloc_copyb(header,
out.s,
out.len))
nomem();
108 if (!stralloc_append(header,
"\n"))
nomem();
109 if (!stralloc_0(header))
nomem();