]> diplodocus.org Git - nmh/blob - h/mime.h
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / h / mime.h
1 /* mime.h -- definitions for MIME
2 */
3
4 #define VRSN_FIELD "MIME-Version"
5 #define VRSN_VALUE "1.0"
6 #define XXX_FIELD_PRF "Content-"
7 #define TYPE_FIELD "Content-Type"
8 #define ENCODING_FIELD "Content-Transfer-Encoding"
9 #define ID_FIELD "Content-ID"
10 #define DESCR_FIELD "Content-Description"
11 #define DISPO_FIELD "Content-Disposition"
12 #define MD5_FIELD "Content-MD5"
13 #define PSEUDOHEADER_PREFIX "Nmh-"
14 #define ATTACH_FIELD PSEUDOHEADER_PREFIX "Attach"
15 #define ATTACH_FIELD_ALT "Attach"
16 #define MHBUILD_FILE_PSEUDOHEADER PSEUDOHEADER_PREFIX "mhbuild-file-"
17 #define MHBUILD_ARGS_PSEUDOHEADER PSEUDOHEADER_PREFIX "mhbuild-args-"
18
19 /*
20 * Test for valid characters used in "token"
21 * as defined in RFC2045
22 */
23 #define istoken(c) (isascii((unsigned char) c) \
24 && !isspace ((unsigned char) c) \
25 && !iscntrl ((unsigned char) c) && (c) != '(' \
26 && (c) != ')' && (c) != '<' && (c) != '>' \
27 && (c) != '@' && (c) != ',' && (c) != ';' \
28 && (c) != ':' && (c) != '\\' && (c) != '"' \
29 && (c) != '/' && (c) != '[' && (c) != ']' \
30 && (c) != '?' && (c) != '=')
31
32 /*
33 * Definitions for RFC 2231 encoding
34 */
35 #define istspecial(c) ((c) == '(' || (c) == ')' || (c) == '<' || (c) == '>' \
36 || (c) == '@' || (c) == ',' || (c) == ';' \
37 || (c) == ':' || (c) == '\\' || (c) == '"' \
38 || (c) == '/' || (c) == '[' || (c) == ']' \
39 || (c) == '?' || (c) == '=')
40
41 #define isparamencode(c) (!isascii((unsigned char) c) || \
42 iscntrl((unsigned char) c) || istspecial(c) || \
43 (c) == ' ' || (c) == '*' || (c) == '\'' || \
44 (c) == '%')
45
46 #define MAXTEXTPERLN 78
47 #define MAXLONGLINE 998
48 #define CPERLIN 76
49 #define BPERLIN (CPERLIN / 4)
50 #define LPERMSG 632
51 #define CPERMSG (LPERMSG * CPERLIN)