* Fix an error in compilation when Alpine is not built with S/MIME
[alpine.git] / pith / escapes.c
blobf6f5c8fe77d866d4fdcec5aebc385a57afbbae72
1 #if !defined(lint) && !defined(DOS)
2 static char rcsid[] = "$Id: escapes.c 761 2007-10-23 22:35:18Z hubert@u.washington.edu $";
3 #endif
5 /*
6 * ========================================================================
7 * Copyright 2006 University of Washington
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * ========================================================================
18 /*======================================================================
20 escapes.c
21 Implements known escape code matching
23 ====*/
26 #include "../pith/headers.h"
27 #include "../pith/escapes.h"
31 /*------------------------------------------------------------------
32 This list of known escape sequences is taken from RFC's 1486 and 1554
33 and draft-apng-cc-encoding, and the X11R5 source with only a remote
34 understanding of what this all means...
36 NOTE: if the length of these should extend beyond 4 chars, fix
37 MAX_ESC_LEN in filter.c
38 ----*/
39 #ifdef _WINDOWS
40 static char *known_escapes[] = {
41 "(B", "(J", "$@", "$B", /* RFC 1468 */
42 "(H",
43 NULL};
44 #else
45 static char *known_escapes[] = {
46 "(B", "(J", "$@", "$B", /* RFC 1468 */
47 "(H",
48 "$A", "$(C", "$(D", ".A", ".F", /* added by RFC 1554 */
49 "$)C", "$)A", "$*E", "$*X", /* those in apng-draft */
50 "$+G", "$+H", "$+I", "$+J", "$+K",
51 "$+L", "$+M",
52 ")I", "-A", "-B", "-C", "-D", /* codes form X11R5 source */
53 "-F", "-G", "-H", "-L", "-M",
54 "-$(A", "$(B", "$)B", "$)D",
55 NULL};
56 #endif
59 int
60 match_escapes(char *esc_seq)
62 char **p;
63 int n;
65 for(p = known_escapes; *p && strncmp(esc_seq, *p, n = strlen(*p)); p++)
68 return(*p ? n + 1 : 0);