xref: /titanic_41/usr/src/lib/libast/amd64/include/ast/magic.h (revision bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2eb)
1 
2 /* : : generated by proto : : */
3 /***********************************************************************
4 *                                                                      *
5 *               This software is part of the ast package               *
6 *          Copyright (c) 1985-2009 AT&T Intellectual Property          *
7 *                      and is licensed under the                       *
8 *                  Common Public License, Version 1.0                  *
9 *                    by AT&T Intellectual Property                     *
10 *                                                                      *
11 *                A copy of the License is available at                 *
12 *            http://www.opensource.org/licenses/cpl1.0.txt             *
13 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
14 *                                                                      *
15 *              Information and Software Systems Research               *
16 *                            AT&T Research                             *
17 *                           Florham Park NJ                            *
18 *                                                                      *
19 *                 Glenn Fowler <gsf@research.att.com>                  *
20 *                  David Korn <dgk@research.att.com>                   *
21 *                   Phong Vo <kpv@research.att.com>                    *
22 *                                                                      *
23 ***********************************************************************/
24 
25 /*
26  * Glenn Fowler
27  * AT&T Research
28  *
29  * magic interface definitions
30  */
31 
32 #ifndef _MAGIC_H
33 #if !defined(__PROTO__)
34 #include <prototyped.h>
35 #endif
36 #if !defined(__LINKAGE__)
37 #define __LINKAGE__		/* 2004-08-11 transition */
38 #endif
39 
40 #define _MAGIC_H
41 
42 #include <sfio.h>
43 #include <ls.h>
44 
45 #define MAGIC_VERSION	19961031L
46 
47 #ifndef MAGIC_FILE
48 #define MAGIC_FILE	"lib/file/magic"
49 #endif
50 
51 #ifndef MAGIC_DIR
52 #define MAGIC_DIR	"lib/file"
53 #endif
54 
55 #define MAGIC_FILE_ENV	"MAGICFILE"
56 
57 #define MAGIC_MIME	(1<<0)		/* magictype returns MIME type	*/
58 #define MAGIC_VERBOSE	(1<<1)		/* verbose magic file errors	*/
59 
60 #define MAGIC_USER	(1L<<16)	/* first user flag bit		*/
61 
62 struct Magic_s;
63 struct Magicdisc_s;
64 
65 typedef struct Magicdisc_s
66 {
67 	unsigned long	version;	/* interface version		*/
68 	unsigned long	flags;		/* MAGIC_* flags		*/
69 	Error_f		errorf;		/* error function		*/
70 } Magicdisc_t;
71 
72 typedef struct Magic_s
73 {
74 	const char*	id;		/* library id string		*/
75 
76 #ifdef _MAGIC_PRIVATE_
77 	_MAGIC_PRIVATE_
78 #endif
79 
80 } Magic_t;
81 
82 #if _BLD_ast && defined(__EXPORT__)
83 #undef __MANGLE__
84 #define __MANGLE__ __LINKAGE__		__EXPORT__
85 #endif
86 
87 extern __MANGLE__ Magic_t*		magicopen __PROTO__((Magicdisc_t*));
88 extern __MANGLE__ int		magicload __PROTO__((Magic_t*, const char*, unsigned long));
89 extern __MANGLE__ int		magiclist __PROTO__((Magic_t*, Sfio_t*));
90 extern __MANGLE__ char*		magictype __PROTO__((Magic_t*, Sfio_t*, const char*, struct stat*));
91 extern __MANGLE__ int		magicclose __PROTO__((Magic_t*));
92 
93 #undef __MANGLE__
94 #define __MANGLE__ __LINKAGE__
95 
96 #endif
97