forked from erluko/socat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
72 lines (63 loc) · 2.68 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* source: utils.h */
/* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __utils_h_included
#define __utils_h_included 1
/* a generic name table entry */
struct wordent {
const char *name;
void *desc;
} ;
#if !HAVE_PROTOTYPE_LIB_memrchr
extern void *memrchr(const void *s, int c, size_t n);
#endif
extern void *memdup(const void *src, size_t n);
#if !HAVE_SETENV
extern int setenv(const char *name, const char *value, int overwrite);
#endif /* !HAVE_SETENV */
extern const struct wordent *keyw(const struct wordent *keywds, const char *name, unsigned int nkeys);
#define XIOSAN_ZERO_MASK 0x000f
#define XIOSAN_ZERO_DEFAULT 0x0000
#define XIOSAN_ZERO_DOT 0x0001
#define XIOSAN_ZERO_BACKSLASH_OCT_3 0x0002
#define XIOSAN_ZERO_BACKSLASH_OCT_4 0x0003
#define XIOSAN_ZERO_BACKSLASHX_HEX_UP 0x0004
#define XIOSAN_ZERO_BACKSLASHX_HEX_LOW 0x0005
#define XIOSAN_ZERO_PERCENT_HEX_UP 0x0006
#define XIOSAN_ZERO_PERCENT_HEX_LOW 0x0007
#define XIOSAN_CONTROL_MASK 0x00f0
#define XIOSAN_CONTROL_DEFAULT 0x0000
#define XIOSAN_CONTROL_DOT 0x0010
#define XIOSAN_CONTROL_BACKSLASH_OCT_3 0x0020
#define XIOSAN_CONTROL_BACKSLASH_OCT_4 0x0030
#define XIOSAN_CONTROL_BACKSLASHX_HEX_UP 0x0040
#define XIOSAN_CONTROL_BACKSLASHX_HEX_LOW 0x0050
#define XIOSAN_CONTROL_PERCENT_HEX_UP 0x0060
#define XIOSAN_CONTROL_PERCENT_HEX_LOW 0x0070
#define XIOSAN_UNPRINT_MASK 0x0f00
#define XIOSAN_UNPRINT_DEFAULT 0x0000
#define XIOSAN_UNPRINT_DOT 0x0100
#define XIOSAN_UNPRINT_BACKSLASH_OCT_3 0x0200
#define XIOSAN_UNPRINT_BACKSLASH_OCT_4 0x0300
#define XIOSAN_UNPRINT_BACKSLASHX_HEX_UP 0x0400
#define XIOSAN_UNPRINT_BACKSLASHX_HEX_LOW 0x0500
#define XIOSAN_UNPRINT_PERCENT_HEX_UP 0x0600
#define XIOSAN_UNPRINT_PERCENT_HEX_LOW 0x0700
#define XIOSAN_DEFAULT_MASK 0xf000
#define XIOSAN_DEFAULT_BACKSLASH_DOT 0x1000
#define XIOSAN_DEFAULT_BACKSLASH_OCT_3 0x2000
#define XIOSAN_DEFAULT_BACKSLASH_OCT_4 0x3000
#define XIOSAN_DEFAULT_BACKSLASHX_HEX_UP 0x4000
#define XIOSAN_DEFAULT_BACKSLASHX_HEX_LOW 0x5000
#define XIOSAN_DEFAULT_PERCENT_HEX_UP 0x6000
#define XIOSAN_DEFAULT_PERCENT_HEX_LOW 0x7000
extern
char *sanitize_string(const char *data, /* input data */
size_t bytes, /* length of input data, >=0 */
char *coded, /* output buffer, must be long enough */
int style);
extern
char *xiosubstr(char *scratch, const char *str, size_t from, size_t len);
extern
int xio_snprintf(char *str, size_t size, const char *format, ...);
#endif /* !defined(__utils_h_included) */