* Update configure script according to previous change to configure.ac
[alpine.git] / pith / escapes.c
blobf9d1b4253239e154d74cb8868ebd9acacb161857
1 /*
2 * ========================================================================
3 * Copyright 2013-2022 Eduardo Chappa
4 * Copyright 2006 University of Washington
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
15 /*======================================================================
17 escapes.c
18 Implements known escape code matching
20 ====*/
23 #include "../pith/headers.h"
24 #include "../pith/escapes.h"
28 /*------------------------------------------------------------------
29 This list of known escape sequences is taken from RFC's 1486 and 1554
30 and draft-apng-cc-encoding, and the X11R5 source with only a remote
31 understanding of what this all means...
33 NOTE: if the length of these should extend beyond 4 chars, fix
34 MAX_ESC_LEN in filter.c
35 ----*/
36 #ifdef _WINDOWS
37 static char *known_escapes[] = {
38 "(B", "(J", "$@", "$B", /* RFC 1468 */
39 "(H",
40 NULL};
41 #else
42 static char *known_escapes[] = {
43 "(B", "(J", "$@", "$B", /* RFC 1468 */
44 "(H",
45 "$A", "$(C", "$(D", ".A", ".F", /* added by RFC 1554 */
46 "$)C", "$)A", "$*E", "$*X", /* those in apng-draft */
47 "$+G", "$+H", "$+I", "$+J", "$+K",
48 "$+L", "$+M",
49 ")I", "-A", "-B", "-C", "-D", /* codes form X11R5 source */
50 "-F", "-G", "-H", "-L", "-M",
51 "-$(A", "$(B", "$)B", "$)D",
52 NULL};
53 #endif
56 int
57 match_escapes(char *esc_seq)
59 char **p;
60 int n;
62 for(p = known_escapes; *p && strncmp(esc_seq, *p, n = strlen(*p)); p++)
65 return(*p ? n + 1 : 0);