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 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 /*======================================================================
21 Implements known escape code matching
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
40 static char *known_escapes
[] = {
41 "(B", "(J", "$@", "$B", /* RFC 1468 */
45 static char *known_escapes
[] = {
46 "(B", "(J", "$@", "$B", /* RFC 1468 */
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",
52 ")I", "-A", "-B", "-C", "-D", /* codes form X11R5 source */
53 "-F", "-G", "-H", "-L", "-M",
54 "-$(A", "$(B", "$)B", "$)D",
60 match_escapes(char *esc_seq
)
65 for(p
= known_escapes
; *p
&& strncmp(esc_seq
, *p
, n
= strlen(*p
)); p
++)
68 return(*p
? n
+ 1 : 0);