FreeCalypso > hg > falcon-mail-tools
comparison f-demime/b2q_in.c @ 0:7e0d08176f32
f-demime starting code
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 06 May 2023 06:14:03 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7e0d08176f32 |
---|---|
1 /* | |
2 * This module implements the input side of base64-to-QP conversion. | |
3 */ | |
4 | |
5 #include <stdio.h> | |
6 #include <stdlib.h> | |
7 #include <string.h> | |
8 #include <strings.h> | |
9 #include "defs.h" | |
10 | |
11 extern void (*dec_outf)(); | |
12 extern FILE *tempfile; | |
13 | |
14 static int cr_state; | |
15 | |
16 static void | |
17 output_func(ch) | |
18 { | |
19 if (cr_state) { | |
20 cr_state = 0; | |
21 if (ch == '\n') { | |
22 putc('\n', tempfile); | |
23 return; | |
24 } else | |
25 putc('\r', tempfile); | |
26 } | |
27 if (ch == '\r') | |
28 cr_state = 1; | |
29 else | |
30 putc(ch, tempfile); | |
31 } | |
32 | |
33 void | |
34 b2q_conv_init() | |
35 { | |
36 dec_outf = output_func; | |
37 cr_state = 0; | |
38 } | |
39 | |
40 void | |
41 b2q_conv_finish() | |
42 { | |
43 if (cr_state) | |
44 putc('\r', tempfile); | |
45 } |