file/src/softmagic.c File Reference

#include "file.h"
#include "magic.h"
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include <regex.h>

Go to the source code of this file.

Functions

static const char * rcsid (const char *p)
static int match (struct magic_set *ms, struct magic *magic, uint32_t nmagic, const unsigned char *s, size_t nbytes)
static int mget (struct magic_set *ms, union VALUETYPE *p, const unsigned char *s, struct magic *m, size_t nbytes, unsigned int cont_level)
static int mymcheck (struct magic_set *ms, union VALUETYPE *p, struct magic *m)
static int32_t mprint (struct magic_set *ms, union VALUETYPE *p, struct magic *m)
static void mdebug (uint32_t offset, const char *str, size_t len)
static int mcopy (struct magic_set *ms, union VALUETYPE *p, int type, int indir, const unsigned char *s, size_t offset, size_t nbytes)
static int mconvert (struct magic_set *ms, union VALUETYPE *p, struct magic *m)
static int check_mem (struct magic_set *ms, unsigned int level)
int file_softmagic (struct magic_set *ms, const unsigned char *buf, size_t nbytes)


Function Documentation

static int check_mem ( struct magic_set ms,
unsigned int  level 
) [static]

Definition at line 251 of file softmagic.c.

References magic_set::c, file_oomem(), magic_set::cont::len, and magic_set::cont::off.

Referenced by match().

int file_softmagic ( struct magic_set ms,
const unsigned char *  buf,
size_t  nbytes 
)

Definition at line 82 of file softmagic.c.

References mlist::magic, match(), magic_set::mlist, mlist::next, and mlist::nmagic.

static int match ( struct magic_set ms,
struct magic magic,
uint32_t  nmagic,
const unsigned char *  s,
size_t  nbytes 
) [static]

Definition at line 120 of file softmagic.c.

References magic_set::c, check_mem(), file_printf(), magic_set::flags, magic, mget(), mprint(), mymcheck(), magic_set::cont::off, and OFFADD.

Referenced by file_softmagic(), readLine(), and rpmalAllSatisfiesDepend().

static int mconvert ( struct magic_set ms,
union VALUETYPE *  p,
struct magic m 
) [static]

Definition at line 359 of file softmagic.c.

References FILE_BEDATE, FILE_BELDATE, FILE_BELONG, FILE_BESHORT, FILE_BESTRING16, FILE_BYTE, FILE_DATE, file_error(), FILE_LDATE, FILE_LEDATE, FILE_LELDATE, FILE_LELONG, FILE_LESHORT, FILE_LESTRING16, FILE_LONG, FILE_OPADD, FILE_OPAND, FILE_OPDIVIDE, FILE_OPINVERSE, FILE_OPMINUS, FILE_OPMODULO, FILE_OPMULTIPLY, FILE_OPOR, FILE_OPXOR, FILE_PSTRING, FILE_REGEX, FILE_SEARCH, FILE_SHORT, FILE_STRING, magic::mask, magic::mask_op, and magic::type.

Referenced by mget().

static int mcopy ( struct magic_set ms,
union VALUETYPE *  p,
int  type,
int  indir,
const unsigned char *  s,
size_t  offset,
size_t  nbytes 
) [static]

Definition at line 638 of file softmagic.c.

References FILE_BESTRING16, FILE_LESTRING16, file_oomem(), and FILE_REGEX.

Referenced by mget().

static void mdebug ( uint32_t  offset,
const char *  str,
size_t  len 
) [static]

Definition at line 629 of file softmagic.c.

References file_showstr().

Referenced by mget().

static int mget ( struct magic_set ms,
union VALUETYPE *  p,
const unsigned char *  s,
struct magic m,
size_t  nbytes,
unsigned int  cont_level 
) [static]

Definition at line 706 of file softmagic.c.

References magic_set::c, errno, FILE_BEDATE, FILE_BELDATE, FILE_BELONG, FILE_BESHORT, FILE_BYTE, FILE_DATE, file_error(), FILE_LDATE, FILE_LEDATE, FILE_LELDATE, FILE_LELONG, FILE_LESHORT, FILE_LONG, file_mdump(), FILE_OPADD, FILE_OPAND, FILE_OPDIVIDE, FILE_OPINDIRECT, FILE_OPINVERSE, FILE_OPMINUS, FILE_OPMODULO, FILE_OPMULTIPLY, FILE_OPOR, FILE_OPXOR, FILE_PSTRING, FILE_SEARCH, FILE_SHORT, FILE_STRING, magic::flag, magic_set::flags, magic::in_offset, magic::in_op, magic::in_type, INDIR, INDIROFFADD, magic::mask, mconvert(), mcopy(), mdebug(), magic_set::cont::off, magic::offset, magic::type, and magic::vallen.

Referenced by match().

static int32_t mprint ( struct magic_set ms,
union VALUETYPE *  p,
struct magic m 
) [static]

Definition at line 267 of file softmagic.c.

References magic::desc, FILE_BEDATE, FILE_BELDATE, FILE_BELONG, FILE_BESHORT, FILE_BESTRING16, FILE_BYTE, FILE_DATE, file_error(), file_fmttime(), FILE_LDATE, FILE_LEDATE, FILE_LELDATE, FILE_LELONG, FILE_LESHORT, FILE_LESTRING16, FILE_LONG, file_printf(), FILE_PSTRING, FILE_REGEX, FILE_SEARCH, FILE_SHORT, file_signextend(), FILE_STRING, magic::offset, magic::reln, magic::VALUETYPE::s, magic::type, magic::vallen, and magic::value.

Referenced by match().

static int mymcheck ( struct magic_set ms,
union VALUETYPE *  p,
struct magic m 
) [static]

Definition at line 1177 of file softmagic.c.

References FILE_BEDATE, FILE_BELDATE, FILE_BELONG, FILE_BESHORT, FILE_BESTRING16, FILE_BYTE, FILE_DATE, file_error(), FILE_LDATE, FILE_LEDATE, FILE_LELDATE, FILE_LELONG, FILE_LESHORT, FILE_LESTRING16, FILE_LONG, FILE_PSTRING, FILE_REGEX, FILE_SEARCH, FILE_SHORT, file_signextend(), FILE_STRING, magic::flag, magic_set::flags, magic::VALUETYPE::l, magic::mask, magic::offset, magic::reln, magic::VALUETYPE::s, STRING_COMPACT_BLANK, STRING_COMPACT_OPTIONAL_BLANK, STRING_IGNORE_LOWERCASE, magic::type, UNSIGNED, magic::vallen, and magic::value.

Referenced by match().

static const char* rcsid ( const char *  p  )  [static]

Definition at line 47 of file softmagic.c.


Generated on Fri Oct 12 08:44:55 2007 for rpm by  doxygen 1.5.2