-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.h
67 lines (51 loc) · 1.79 KB
/
functions.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
#if !defined(_FUNCTIONS_H)
#define _FUNCTIONS_H 1
#if defined(__cplusplus)
extern "C" {
#endif
#include "common.h"
#define MAGIC_FUNCTION(f, r, x, ...) \
do { \
if ((x) & MAGIC_DEBUG) \
r = f(__VA_ARGS__); \
else { \
save_t __##f; \
override_error_output(&(__##f)); \
r = f(__VA_ARGS__); \
restore_error_output(&(__##f)); \
} \
} while(0)
typedef struct file_data {
fpos_t position;
int old_fd;
int new_fd;
} file_data_t;
typedef struct save {
file_data_t file;
int status;
} save_t;
extern magic_t magic_open_wrapper(int flags);
extern void magic_close_wrapper(magic_t magic);
extern const char* magic_error_wrapper(magic_t magic);
extern int magic_errno_wrapper(magic_t magic);
extern const char* magic_getpath_wrapper(void);
extern int magic_getparam_wrapper(magic_t magic, int parameter, void *value);
extern int magic_setparam_wrapper(magic_t magic, int parameter,
const void *value);
extern int magic_getflags_wrapper(magic_t magic);
extern int magic_setflags_wrapper(magic_t magic, int flags);
extern int magic_load_wrapper(magic_t magic, const char *magic_file, int flags);
extern int magic_load_buffers_wrapper(magic_t magic, void **buffers,
size_t *sizes, size_t count, int flags);
extern int magic_compile_wrapper(magic_t magic, const char *magic_file, int flags);
extern int magic_check_wrapper(magic_t magic, const char *magic_file, int flags);
extern const char* magic_file_wrapper(magic_t magic, const char *filename,
int flags);
extern const char* magic_buffer_wrapper(magic_t magic, const void *buffer,
size_t size, int flags);
extern const char* magic_descriptor_wrapper(magic_t magic, int fd, int flags);
extern int magic_version_wrapper(void);
#if defined(__cplusplus)
}
#endif
#endif /* _FUNCTIONS_H */