File indexing completed on 2026-08-06 09:41:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef _MAGIC_H
0028 #define _MAGIC_H
0029
0030 #include <sys/types.h>
0031
0032 #define MAGIC_NONE 0x0000000
0033 #define MAGIC_DEBUG 0x0000001
0034 #define MAGIC_SYMLINK 0x0000002
0035 #define MAGIC_COMPRESS 0x0000004
0036 #define MAGIC_DEVICES 0x0000008
0037 #define MAGIC_MIME_TYPE 0x0000010
0038 #define MAGIC_CONTINUE 0x0000020
0039 #define MAGIC_CHECK 0x0000040
0040 #define MAGIC_PRESERVE_ATIME 0x0000080
0041 #define MAGIC_RAW 0x0000100
0042 #define MAGIC_ERROR 0x0000200
0043 #define MAGIC_MIME_ENCODING 0x0000400
0044 #define MAGIC_MIME (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
0045 #define MAGIC_APPLE 0x0000800
0046 #define MAGIC_EXTENSION 0x1000000
0047
0048 #define MAGIC_COMPRESS_TRANSP 0x2000000
0049
0050 #define MAGIC_NO_COMPRESS_FORK 0x4000000
0051
0052 #define MAGIC_NODESC (MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
0053
0054 #define MAGIC_NO_CHECK_COMPRESS 0x0001000
0055 #define MAGIC_NO_CHECK_TAR 0x0002000
0056 #define MAGIC_NO_CHECK_SOFT 0x0004000
0057 #define MAGIC_NO_CHECK_APPTYPE 0x0008000
0058 #define MAGIC_NO_CHECK_ELF 0x0010000
0059 #define MAGIC_NO_CHECK_TEXT 0x0020000
0060 #define MAGIC_NO_CHECK_CDF 0x0040000
0061 #define MAGIC_NO_CHECK_CSV 0x0080000
0062 #define MAGIC_NO_CHECK_TOKENS 0x0100000
0063 #define MAGIC_NO_CHECK_ENCODING 0x0200000
0064 #define MAGIC_NO_CHECK_JSON 0x0400000
0065 #define MAGIC_NO_CHECK_SIMH 0x0800000
0066
0067
0068 #define MAGIC_NO_CHECK_BUILTIN ( \
0069 MAGIC_NO_CHECK_COMPRESS | \
0070 MAGIC_NO_CHECK_TAR | \
0071 \
0072 MAGIC_NO_CHECK_APPTYPE | \
0073 MAGIC_NO_CHECK_ELF | \
0074 MAGIC_NO_CHECK_TEXT | \
0075 MAGIC_NO_CHECK_CSV | \
0076 MAGIC_NO_CHECK_CDF | \
0077 MAGIC_NO_CHECK_TOKENS | \
0078 MAGIC_NO_CHECK_ENCODING | \
0079 MAGIC_NO_CHECK_JSON | \
0080 MAGIC_NO_CHECK_SIMH | \
0081 0 \
0082 )
0083
0084 #define MAGIC_SNPRINTB "\177\020\
0085 b\0debug\0\
0086 b\1symlink\0\
0087 b\2compress\0\
0088 b\3devices\0\
0089 b\4mime_type\0\
0090 b\5continue\0\
0091 b\6check\0\
0092 b\7preserve_atime\0\
0093 b\10raw\0\
0094 b\11error\0\
0095 b\12mime_encoding\0\
0096 b\13apple\0\
0097 b\14no_check_compress\0\
0098 b\15no_check_tar\0\
0099 b\16no_check_soft\0\
0100 b\17no_check_apptype\0\
0101 b\20no_check_elf\0\
0102 b\21no_check_text\0\
0103 b\22no_check_cdf\0\
0104 b\23no_check_csv\0\
0105 b\24no_check_tokens\0\
0106 b\25no_check_encoding\0\
0107 b\26no_check_json\0\
0108 b\27no_check_simh\0\
0109 b\30extension\0\
0110 b\31transp_compression\0\
0111 "
0112
0113
0114 #define MAGIC_NO_CHECK_ASCII MAGIC_NO_CHECK_TEXT
0115
0116
0117 #define MAGIC_NO_CHECK_FORTRAN 0x000000
0118 #define MAGIC_NO_CHECK_TROFF 0x000000
0119
0120 #define MAGIC_VERSION 546
0121
0122
0123 #ifdef __cplusplus
0124 extern "C" {
0125 #endif
0126
0127 typedef struct magic_set *magic_t;
0128 magic_t magic_open(int);
0129 void magic_close(magic_t);
0130
0131 const char *magic_getpath(const char *, int);
0132 const char *magic_file(magic_t, const char *);
0133 const char *magic_descriptor(magic_t, int);
0134 const char *magic_buffer(magic_t, const void *, size_t);
0135
0136 const char *magic_error(magic_t);
0137 int magic_getflags(magic_t);
0138 int magic_setflags(magic_t, int);
0139
0140 int magic_version(void);
0141 int magic_load(magic_t, const char *);
0142 int magic_load_buffers(magic_t, void **, size_t *, size_t);
0143
0144 int magic_compile(magic_t, const char *);
0145 int magic_check(magic_t, const char *);
0146 int magic_list(magic_t, const char *);
0147 int magic_errno(magic_t);
0148
0149 #define MAGIC_PARAM_INDIR_MAX 0
0150 #define MAGIC_PARAM_NAME_MAX 1
0151 #define MAGIC_PARAM_ELF_PHNUM_MAX 2
0152 #define MAGIC_PARAM_ELF_SHNUM_MAX 3
0153 #define MAGIC_PARAM_ELF_NOTES_MAX 4
0154 #define MAGIC_PARAM_REGEX_MAX 5
0155 #define MAGIC_PARAM_BYTES_MAX 6
0156 #define MAGIC_PARAM_ENCODING_MAX 7
0157 #define MAGIC_PARAM_ELF_SHSIZE_MAX 8
0158 #define MAGIC_PARAM_MAGWARN_MAX 9
0159
0160 int magic_setparam(magic_t, int, const void *);
0161 int magic_getparam(magic_t, int, void *);
0162
0163 #ifdef __cplusplus
0164 };
0165 #endif
0166
0167 #endif