Lines Matching full:magic
36 FILE_RCSID("@(#)$File: magic.c,v 1.123 2023/12/29 18:04:48 christos Exp $")
39 #include "magic.h"
125 "%s/share/misc/magic.mgc", in _w32_get_magic_relative_to()
126 "%s/magic.mgc", in _w32_get_magic_relative_to()
149 "%s/../share/misc/magic.mgc", dllpath); in _w32_get_magic_relative_to()
177 static const char hmagic[] = "/.magic/magic.mgc"; in get_default_magic()
189 return MAGIC; in get_default_magic()
191 if (asprintf(&hmagicpath, "%s/.magic.mgc", home) < 0) in get_default_magic()
192 return MAGIC; in get_default_magic()
195 if (asprintf(&hmagicpath, "%s/.magic", home) < 0) in get_default_magic()
196 return MAGIC; in get_default_magic()
202 return MAGIC; in get_default_magic()
208 if (asprintf(&default_magic, "%s:%s", hmagicpath, MAGIC) < 0) in get_default_magic()
215 return MAGIC; in get_default_magic()
224 /* Before anything else, try to get a magic file from user HOME */ in get_default_magic()
228 /* First, try to get a magic file from user-application data */ in get_default_magic()
232 /* Second, try to get a magic file from the user profile data */ in get_default_magic()
237 /* Third, try to get a magic file from Common Files */ in get_default_magic()
241 /* Fourth, try to get magic file relative to exe location */ in get_default_magic()
244 /* Fifth, try to get magic file relative to dll location */ in get_default_magic()
247 /* Avoid MAGIC constant - it likely points to a file within MSys tree */ in get_default_magic()
259 magicfile = getenv("MAGIC"); in magic_getpath()
263 return action == FILE_LOAD ? get_default_magic() : MAGIC; in magic_getpath()
314 * load a magic file
326 * Install a set of compiled magic buffers.
334 return buffer_apprentice(ms, RCAST(struct magic **, bufs), in magic_load_buffers()
570 return "Magic database is not open"; in magic_error()