2 ** unquote.c: Handle quote removal and quoted-pair strings on
3 ** RFC 2822-5322 atoms.
5 ** This code is Copyright (c) 2013, by the authors of nmh. See the
6 ** COPYRIGHT file in the root directory of the nmh distribution for
7 ** complete copyright information.
13 ** Remove quotes and quoted-pair sequences from RFC-5322 atoms.
15 ** Currently the actual algorithm is simpler than it technically should
16 ** be: any quotes are simply eaten, unless they're preceded by the escape
17 ** character (\). This seems to be sufficient for our needs for now.
21 ** input - The input string
22 ** output - The output string; is assumed to have at least as much
23 ** room as the input string. At worst the output string will
24 ** be the same size as the input string; it might be smaller.
27 unquote_string(const char *input, char *output)
32 while (input[inpos] != '\0') {
33 switch (input[inpos]) {
36 if (input[inpos] != '\0')
37 output[outpos++] = input[inpos++];
43 output[outpos++] = input[inpos++];
47 output[outpos] = '\0';