/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped22/*23* Glenn Fowler24* AT&T Research25*26* magic interface definitions27*/2829#ifndef _MAGIC_H30#define _MAGIC_H3132#include <sfio.h>33#include <ls.h>3435#define MAGIC_VERSION 19961031L3637#ifndef MAGIC_FILE38#define MAGIC_FILE "lib/file/magic"39#endif4041#ifndef MAGIC_DIR42#define MAGIC_DIR "lib/file"43#endif4445#define MAGIC_FILE_ENV "MAGICFILE"4647#define MAGIC_MIME (1<<0) /* magictype returns MIME type */48#define MAGIC_VERBOSE (1<<1) /* verbose magic file errors */49#define MAGIC_ALL (1<<2) /* list all table matches */5051#define MAGIC_USER (1L<<16) /* first user flag bit */5253struct Magic_s;54struct Magicdisc_s;5556typedef struct Magicdisc_s57{58unsigned long version; /* interface version */59unsigned long flags; /* MAGIC_* flags */60Error_f errorf; /* error function */61} Magicdisc_t;6263typedef struct Magic_s64{65const char* id; /* library id string */6667#ifdef _MAGIC_PRIVATE_68_MAGIC_PRIVATE_69#endif7071} Magic_t;7273#if _BLD_ast && defined(__EXPORT__)74#define extern __EXPORT__75#endif7677extern Magic_t* magicopen(Magicdisc_t*);78extern int magicload(Magic_t*, const char*, unsigned long);79extern int magiclist(Magic_t*, Sfio_t*);80extern char* magictype(Magic_t*, Sfio_t*, const char*, struct stat*);81extern int magicclose(Magic_t*);8283#undef extern8485#endif868788