1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
27 * magic interface definitions
36 #define MAGIC_VERSION 19961031L
39 #define MAGIC_FILE "lib/file/magic"
43 #define MAGIC_DIR "lib/file"
46 #define MAGIC_FILE_ENV "MAGICFILE"
48 #define MAGIC_MIME (1<<0) /* magictype returns MIME type */
49 #define MAGIC_VERBOSE (1<<1) /* verbose magic file errors */
51 #define MAGIC_USER (1L<<16) /* first user flag bit */
56 typedef struct Magicdisc_s
58 unsigned long version
; /* interface version */
59 unsigned long flags
; /* MAGIC_* flags */
60 Error_f errorf
; /* error function */
63 typedef struct Magic_s
65 const char* id
; /* library id string */
67 #ifdef _MAGIC_PRIVATE_
73 #if _BLD_ast && defined(__EXPORT__)
74 #define extern __EXPORT__
77 extern Magic_t
* magicopen(Magicdisc_t
*);
78 extern int magicload(Magic_t
*, const char*, unsigned long);
79 extern int magiclist(Magic_t
*, Sfio_t
*);
80 extern char* magictype(Magic_t
*, Sfio_t
*, const char*, struct stat
*);
81 extern int magicclose(Magic_t
*);