2 /* Copyright Gerhard Rieger 2001-2008 */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 #ifndef __utils_h_included
6 #define __utils_h_included 1
8 /* a generic name table entry */
15 extern void *memrchr(const void *s
, int c
, size_t n
);
17 extern void *memdup(const void *src
, size_t n
);
19 extern int setenv(const char *name
, const char *value
, int overwrite
);
20 #endif /* !HAVE_SETENV */
22 extern const struct wordent
*keyw(const struct wordent
*keywds
, const char *name
, unsigned int nkeys
);
25 #define XIOSAN_ZERO_MASK 0x000f
26 #define XIOSAN_ZERO_DEFAULT 0x0000
27 #define XIOSAN_ZERO_DOT 0x0001
28 #define XIOSAN_ZERO_BACKSLASH_OCT_3 0x0002
29 #define XIOSAN_ZERO_BACKSLASH_OCT_4 0x0003
30 #define XIOSAN_ZERO_BACKSLASHX_HEX_UP 0x0004
31 #define XIOSAN_ZERO_BACKSLASHX_HEX_LOW 0x0005
32 #define XIOSAN_ZERO_PERCENT_HEX_UP 0x0006
33 #define XIOSAN_ZERO_PERCENT_HEX_LOW 0x0007
34 #define XIOSAN_CONTROL_MASK 0x00f0
35 #define XIOSAN_CONTROL_DEFAULT 0x0000
36 #define XIOSAN_CONTROL_DOT 0x0010
37 #define XIOSAN_CONTROL_BACKSLASH_OCT_3 0x0020
38 #define XIOSAN_CONTROL_BACKSLASH_OCT_4 0x0030
39 #define XIOSAN_CONTROL_BACKSLASHX_HEX_UP 0x0040
40 #define XIOSAN_CONTROL_BACKSLASHX_HEX_LOW 0x0050
41 #define XIOSAN_CONTROL_PERCENT_HEX_UP 0x0060
42 #define XIOSAN_CONTROL_PERCENT_HEX_LOW 0x0070
43 #define XIOSAN_UNPRINT_MASK 0x0f00
44 #define XIOSAN_UNPRINT_DEFAULT 0x0000
45 #define XIOSAN_UNPRINT_DOT 0x0100
46 #define XIOSAN_UNPRINT_BACKSLASH_OCT_3 0x0200
47 #define XIOSAN_UNPRINT_BACKSLASH_OCT_4 0x0300
48 #define XIOSAN_UNPRINT_BACKSLASHX_HEX_UP 0x0400
49 #define XIOSAN_UNPRINT_BACKSLASHX_HEX_LOW 0x0500
50 #define XIOSAN_UNPRINT_PERCENT_HEX_UP 0x0600
51 #define XIOSAN_UNPRINT_PERCENT_HEX_LOW 0x0700
52 #define XIOSAN_DEFAULT_MASK 0xf000
53 #define XIOSAN_DEFAULT_BACKSLASH_DOT 0x1000
54 #define XIOSAN_DEFAULT_BACKSLASH_OCT_3 0x2000
55 #define XIOSAN_DEFAULT_BACKSLASH_OCT_4 0x3000
56 #define XIOSAN_DEFAULT_BACKSLASHX_HEX_UP 0x4000
57 #define XIOSAN_DEFAULT_BACKSLASHX_HEX_LOW 0x5000
58 #define XIOSAN_DEFAULT_PERCENT_HEX_UP 0x6000
59 #define XIOSAN_DEFAULT_PERCENT_HEX_LOW 0x7000
62 char *sanitize_string(const char *data
, /* input data */
63 size_t bytes
, /* length of input data, >=0 */
64 char *coded
, /* output buffer, must be long enough */
67 char *xiosubstr(char *scratch
, const char *str
, size_t from
, size_t len
);
69 #endif /* !defined(__utils_h_included) */