13 logmsg(
WHO,111,FATAL,
"out of memory");
22, { 0, 0, 0, 0, 0, 0, 0 }
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();
85 if (!stralloc_0(&
out)) 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();
94 if (!stralloc_0(&
out)) 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();
117 if (*argv[1] ==
'+') {
119 if (str_len(argv[1]) == 1)
120 a[0].
name =
"subject";
122 a[0].
name = argv[1] + 1;
130 if (getln(buffer_0,&
line,&
match,
'\n') == -1)
131 logmsg(
WHO,111,FATAL,
"unable to read input ");
143 _exit(
flag ? 0 : 100);
int mess822_qpdecode(stralloc *, const char *, int, int)
int mess822_line(mess822_header *, stralloc *)
int mess822_end(mess822_header *)
int mess822_ok(stralloc *)
int mess822_begin(mess822_header *, mess822_action *)
int mess822_b64decode(stralloc *, const char *, int, int)
int header_decode(stralloc *header)