1 #if !defined(lint) && !defined(DOS)
2 static char rcsid
[] = "$Id: escapes.c 761 2007-10-23 22:35:18Z hubert@u.washington.edu $";
6 * ========================================================================
7 * Copyright 2013-2020 Eduardo Chappa
8 * Copyright 2006 University of Washington
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * ========================================================================
19 /*======================================================================
22 Implements known escape code matching
27 #include "../pith/headers.h"
28 #include "../pith/escapes.h"
32 /*------------------------------------------------------------------
33 This list of known escape sequences is taken from RFC's 1486 and 1554
34 and draft-apng-cc-encoding, and the X11R5 source with only a remote
35 understanding of what this all means...
37 NOTE: if the length of these should extend beyond 4 chars, fix
38 MAX_ESC_LEN in filter.c
41 static char *known_escapes
[] = {
42 "(B", "(J", "$@", "$B", /* RFC 1468 */
46 static char *known_escapes
[] = {
47 "(B", "(J", "$@", "$B", /* RFC 1468 */
49 "$A", "$(C", "$(D", ".A", ".F", /* added by RFC 1554 */
50 "$)C", "$)A", "$*E", "$*X", /* those in apng-draft */
51 "$+G", "$+H", "$+I", "$+J", "$+K",
53 ")I", "-A", "-B", "-C", "-D", /* codes form X11R5 source */
54 "-F", "-G", "-H", "-L", "-M",
55 "-$(A", "$(B", "$)B", "$)D",
61 match_escapes(char *esc_seq
)
66 for(p
= known_escapes
; *p
&& strncmp(esc_seq
, *p
, n
= strlen(*p
)); p
++)
69 return(*p
? n
+ 1 : 0);