Back to index

php5  5.3.10
Defines | Typedefs | Functions
magic.h File Reference
#include <sys/types.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MAGIC_NONE   0x000000 /* No flags */
#define MAGIC_DEBUG   0x000001 /* Turn on debugging */
#define MAGIC_SYMLINK   0x000002 /* Follow symlinks */
#define MAGIC_COMPRESS   0x000004 /* Check inside compressed files */
#define MAGIC_DEVICES   0x000008 /* Look at the contents of devices */
#define MAGIC_MIME_TYPE   0x000010 /* Return the MIME type */
#define MAGIC_CONTINUE   0x000020 /* Return all matches */
#define MAGIC_CHECK   0x000040 /* Print warnings to stderr */
#define MAGIC_PRESERVE_ATIME   0x000080 /* Restore access time on exit */
#define MAGIC_RAW   0x000100 /* Don't translate unprintable chars */
#define MAGIC_ERROR   0x000200 /* Handle ENOENT etc as real errors */
#define MAGIC_MIME_ENCODING   0x000400 /* Return the MIME encoding */
#define MAGIC_MIME   (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
#define MAGIC_APPLE   0x000800 /* Return the Apple creator and type */
#define MAGIC_NO_CHECK_COMPRESS   0x001000 /* Don't check for compressed files */
#define MAGIC_NO_CHECK_TAR   0x002000 /* Don't check for tar files */
#define MAGIC_NO_CHECK_SOFT   0x004000 /* Don't check magic entries */
#define MAGIC_NO_CHECK_APPTYPE   0x008000 /* Don't check application type */
#define MAGIC_NO_CHECK_ELF   0x010000 /* Don't check for elf details */
#define MAGIC_NO_CHECK_TEXT   0x020000 /* Don't check for text files */
#define MAGIC_NO_CHECK_CDF   0x040000 /* Don't check for cdf files */
#define MAGIC_NO_CHECK_TOKENS   0x100000 /* Don't check tokens */
#define MAGIC_NO_CHECK_ENCODING   0x200000 /* Don't check text encodings */
#define MAGIC_NO_CHECK_ASCII   MAGIC_NO_CHECK_TEXT
#define MAGIC_NO_CHECK_FORTRAN   0x000000 /* Don't check ascii/fortran */
#define MAGIC_NO_CHECK_TROFF   0x000000 /* Don't check ascii/troff */

Typedefs

typedef struct magic_setmagic_t

Functions

magic_t magic_open (int)
void magic_close (magic_t)
const char * magic_file (magic_t, const char *)
const char * magic_stream (magic_t, php_stream *)
const char * magic_descriptor (magic_t, int)
const char * magic_buffer (magic_t, const void *, size_t)
const char * magic_error (magic_t)
int magic_setflags (magic_t, int)
int magic_load (magic_t, const char *)
int magic_compile (magic_t, const char *)
int magic_errno (magic_t)

Define Documentation

#define MAGIC_APPLE   0x000800 /* Return the Apple creator and type */

Definition at line 45 of file magic.h.

#define MAGIC_CHECK   0x000040 /* Print warnings to stderr */

Definition at line 39 of file magic.h.

#define MAGIC_COMPRESS   0x000004 /* Check inside compressed files */

Definition at line 35 of file magic.h.

#define MAGIC_CONTINUE   0x000020 /* Return all matches */

Definition at line 38 of file magic.h.

#define MAGIC_DEBUG   0x000001 /* Turn on debugging */

Definition at line 33 of file magic.h.

#define MAGIC_DEVICES   0x000008 /* Look at the contents of devices */

Definition at line 36 of file magic.h.

#define MAGIC_ERROR   0x000200 /* Handle ENOENT etc as real errors */

Definition at line 42 of file magic.h.

Definition at line 44 of file magic.h.

#define MAGIC_MIME_ENCODING   0x000400 /* Return the MIME encoding */

Definition at line 43 of file magic.h.

#define MAGIC_MIME_TYPE   0x000010 /* Return the MIME type */

Definition at line 37 of file magic.h.

#define MAGIC_NO_CHECK_APPTYPE   0x008000 /* Don't check application type */

Definition at line 49 of file magic.h.

Definition at line 57 of file magic.h.

#define MAGIC_NO_CHECK_CDF   0x040000 /* Don't check for cdf files */

Definition at line 52 of file magic.h.

#define MAGIC_NO_CHECK_COMPRESS   0x001000 /* Don't check for compressed files */

Definition at line 46 of file magic.h.

#define MAGIC_NO_CHECK_ELF   0x010000 /* Don't check for elf details */

Definition at line 50 of file magic.h.

#define MAGIC_NO_CHECK_ENCODING   0x200000 /* Don't check text encodings */

Definition at line 54 of file magic.h.

#define MAGIC_NO_CHECK_FORTRAN   0x000000 /* Don't check ascii/fortran */

Definition at line 60 of file magic.h.

#define MAGIC_NO_CHECK_SOFT   0x004000 /* Don't check magic entries */

Definition at line 48 of file magic.h.

#define MAGIC_NO_CHECK_TAR   0x002000 /* Don't check for tar files */

Definition at line 47 of file magic.h.

#define MAGIC_NO_CHECK_TEXT   0x020000 /* Don't check for text files */

Definition at line 51 of file magic.h.

#define MAGIC_NO_CHECK_TOKENS   0x100000 /* Don't check tokens */

Definition at line 53 of file magic.h.

#define MAGIC_NO_CHECK_TROFF   0x000000 /* Don't check ascii/troff */

Definition at line 61 of file magic.h.

#define MAGIC_NONE   0x000000 /* No flags */

Definition at line 32 of file magic.h.

#define MAGIC_PRESERVE_ATIME   0x000080 /* Restore access time on exit */

Definition at line 40 of file magic.h.

#define MAGIC_RAW   0x000100 /* Don't translate unprintable chars */

Definition at line 41 of file magic.h.

#define MAGIC_SYMLINK   0x000002 /* Follow symlinks */

Definition at line 34 of file magic.h.


Typedef Documentation

typedef struct magic_set* magic_t

Definition at line 68 of file magic.h.


Function Documentation

const char* magic_buffer ( magic_t  ,
const void *  ,
size_t   
)
void magic_close ( magic_t  )
int magic_compile ( magic_t  ,
const char *   
)
const char* magic_descriptor ( magic_t  ,
int   
)
const char* magic_error ( magic_t  )
const char* magic_file ( magic_t  ,
const char *   
)
int magic_load ( magic_t  ,
const char *   
)
magic_t magic_open ( int  ) [read]

Definition at line 96 of file magic.c.

{
       struct magic_set *ms;

       ms = ecalloc((size_t)1, sizeof(struct magic_set));

       if (magic_setflags(ms, flags) == -1) {
              errno = EINVAL;
              goto free;
       }

       ms->o.buf = ms->o.pbuf = NULL;

       ms->c.li = emalloc((ms->c.len = 10) * sizeof(*ms->c.li));
       
       ms->event_flags = 0;
       ms->error = -1;
       ms->mlist = NULL;
       ms->file = "unknown";
       ms->line = 0;
       return ms;
free:
       efree(ms);
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int magic_setflags ( magic_t  ,
int   
)
const char* magic_stream ( magic_t  ,
php_stream *   
)