file/src/file.h File Reference

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <regex.h>
#include <sys/types.h>
#include <sys/stat.h>

Include dependency graph for file.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  magic
union  magic::VALUETYPE
struct  mlist
struct  magic_set
struct  magic_set::cont
struct  magic_set::cont::level_info
struct  magic_set::out

Defines

#define ENABLE_CONDITIONALS
#define MAGIC   "/etc/magic"
#define PATHSEP   ':'
#define private   static
#define public
#define __GNUC_PREREQ__(x, y)   0
#define f__unused
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
#define HOWMANY   (256 * 1024)
#define MAXMAGIS   8192
#define MAXDESC   64
#define MAXstring   32
#define MAGICNO   0xF11E041C
#define VERSIONNO   4
#define FILE_MAGICSIZE   (32 * 4)
#define FILE_LOAD   0
#define FILE_CHECK   1
#define FILE_COMPILE   2
#define INDIR   1
#define OFFADD   2
#define INDIROFFADD   4
#define UNSIGNED   8
#define FILE_INVALID   0
#define FILE_BYTE   1
#define FILE_SHORT   2
#define FILE_DEFAULT   3
#define FILE_LONG   4
#define FILE_STRING   5
#define FILE_DATE   6
#define FILE_BESHORT   7
#define FILE_BELONG   8
#define FILE_BEDATE   9
#define FILE_LESHORT   10
#define FILE_LELONG   11
#define FILE_LEDATE   12
#define FILE_PSTRING   13
#define FILE_LDATE   14
#define FILE_BELDATE   15
#define FILE_LELDATE   16
#define FILE_REGEX   17
#define FILE_BESTRING16   18
#define FILE_LESTRING16   19
#define FILE_SEARCH   20
#define FILE_MEDATE   21
#define FILE_MELDATE   22
#define FILE_MELONG   23
#define FILE_QUAD   24
#define FILE_LEQUAD   25
#define FILE_BEQUAD   26
#define FILE_QDATE   27
#define FILE_LEQDATE   28
#define FILE_BEQDATE   29
#define FILE_QLDATE   30
#define FILE_LEQLDATE   31
#define FILE_BEQLDATE   32
#define FILE_NAMES_SIZE   33
#define IS_STRING(t)
#define FILE_FMT_NONE   0
#define FILE_FMT_NUM   1
#define FILE_FMT_STR   2
#define FILE_FMT_QUAD   3
#define FILE_OPS   "&|^+-*/%"
#define FILE_OPAND   0
#define FILE_OPOR   1
#define FILE_OPXOR   2
#define FILE_OPADD   3
#define FILE_OPMINUS   4
#define FILE_OPMULTIPLY   5
#define FILE_OPDIVIDE   6
#define FILE_OPMODULO   7
#define FILE_OPS_MASK   0x07
#define FILE_UNUSED_1   0x08
#define FILE_UNUSED_2   0x10
#define FILE_UNUSED_3   0x20
#define FILE_OPINVERSE   0x40
#define FILE_OPINDIRECT   0x80
#define COND_NONE   0
#define COND_IF   1
#define COND_ELIF   2
#define COND_ELSE   3
#define num_mask   _u._mask
#define str_count   _u._s._count
#define str_flags   _u._s._flags
#define BIT(A)   (1 << (A))
#define STRING_COMPACT_BLANK   BIT(0)
#define STRING_COMPACT_OPTIONAL_BLANK   BIT(1)
#define STRING_IGNORE_LOWERCASE   BIT(2)
#define STRING_IGNORE_UPPERCASE   BIT(3)
#define REGEX_OFFSET_START   BIT(4)
#define CHAR_COMPACT_BLANK   'B'
#define CHAR_COMPACT_OPTIONAL_BLANK   'b'
#define CHAR_IGNORE_LOWERCASE   'c'
#define CHAR_IGNORE_UPPERCASE   'C'
#define CHAR_REGEX_OFFSET_START   's'
#define STRING_IGNORE_CASE   (STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)
#define strerror(e)   (((e) >= 0 && (e) < sys_nerr) ? sys_errlist[(e)] : "Unknown error")
#define strtoul(a, b, c)   strtol(a, b, c)
#define O_BINARY   0
#define FILE_RCSID(id)

Functions

const char * file_fmttime (uint32_t, int)
int file_buffer (struct magic_set *ms, int fd, const char *inname, const void *buf, size_t nb)
int file_fsmagic (struct magic_set *ms, const char *, struct stat *sb)
int file_pipe2file (struct magic_set *ms, int, const void *, size_t)
int file_printf (struct magic_set *ms, const char *,...)
int file_reset (struct magic_set *ms)
int file_tryelf (struct magic_set *ms, int, const unsigned char *, size_t)
int file_zmagic (struct magic_set *ms, int fd, const char *name, const unsigned char *buf, size_t nbytes)
int file_ascmagic (struct magic_set *ms, const unsigned char *, size_t)
int file_is_tar (struct magic_set *ms, const unsigned char *, size_t)
int file_softmagic (struct magic_set *ms, const unsigned char *, size_t)
mlistfile_apprentice (struct magic_set *ms, const char *, int)
uint64_t file_signextend (struct magic_set *ms, struct magic *, uint64_t)
void file_delmagic (struct magic *p, int type, size_t entries)
void file_badread (struct magic_set *ms)
void file_badseek (struct magic_set *ms)
void file_oomem (struct magic_set *ms, size_t)
void file_error (struct magic_set *ms, int error, const char *f,...)
void file_magerror (struct magic_set *ms, const char *,...)
void file_magwarn (struct magic_set *ms, const char *,...)
void file_mdump (struct magic *)
void file_showstr (FILE *fp, const char *, size_t)
size_t file_mbswidth (const char *)
const char * file_getbuffer (struct magic_set *ms)
ssize_t sread (int fd, void *buf, size_t n, int canbepipe)
int file_check_mem (struct magic_set *ms, unsigned int)
int snprintf (char *, size_t, const char *,...)

Variables

const char * file_names []
const size_t file_nnames
int sys_nerr
char * sys_errlist []


Define Documentation

#define __GNUC_PREREQ__ ( x,
 )     0

Definition at line 78 of file file.h.

#define BIT (  )     (1 << (A))

Definition at line 240 of file file.h.

#define CHAR_COMPACT_BLANK   'B'

Definition at line 246 of file file.h.

Referenced by file_mdump(), parse(), and string_modifier_check().

#define CHAR_COMPACT_OPTIONAL_BLANK   'b'

Definition at line 247 of file file.h.

Referenced by file_mdump(), parse(), and string_modifier_check().

#define CHAR_IGNORE_LOWERCASE   'c'

Definition at line 248 of file file.h.

Referenced by file_mdump(), and parse().

#define CHAR_IGNORE_UPPERCASE   'C'

Definition at line 249 of file file.h.

Referenced by file_mdump(), and parse().

#define CHAR_REGEX_OFFSET_START   's'

Definition at line 250 of file file.h.

Referenced by file_mdump(), parse(), and string_modifier_check().

#define COND_ELIF   2

Definition at line 203 of file file.h.

Referenced by check_cond(), get_cond(), and match().

#define COND_ELSE   3

Definition at line 204 of file file.h.

Referenced by check_cond(), get_cond(), and match().

#define COND_IF   1

Definition at line 202 of file file.h.

Referenced by check_cond(), and get_cond().

#define COND_NONE   0

Definition at line 201 of file file.h.

Referenced by check_cond(), file_check_mem(), and get_cond().

#define ENABLE_CONDITIONALS

Definition at line 54 of file file.h.

#define f__unused

Definition at line 86 of file file.h.

#define FILE_BEDATE   9

Definition at line 133 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_BELDATE   15

Definition at line 139 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_BELONG   8

Definition at line 132 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), mprint(), and parse().

#define FILE_BEQDATE   29

Definition at line 153 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_BEQLDATE   32

Definition at line 156 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_BEQUAD   26

Definition at line 150 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_BESHORT   7

Definition at line 131 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), mprint(), and parse().

#define FILE_BESTRING16   18

Definition at line 142 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), getvalue(), magiccheck(), mconvert(), mcopy(), mprint(), and string_modifier_check().

#define FILE_BYTE   1

Definition at line 125 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), mprint(), and parse().

#define FILE_CHECK   1

Definition at line 106 of file file.h.

Referenced by apprentice_file(), magic_check(), main(), and parse().

#define FILE_COMPILE   2

Definition at line 107 of file file.h.

Referenced by apprentice_1(), getstr(), magic_compile(), and main().

#define FILE_DATE   6

Definition at line 130 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_DEFAULT   3

Definition at line 127 of file file.h.

Referenced by apprentice_file(), apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), match(), mconvert(), mget(), and mprint().

#define FILE_FMT_NONE   0

Definition at line 168 of file file.h.

Referenced by check_format().

#define FILE_FMT_NUM   1

Definition at line 169 of file file.h.

Referenced by check_format_type().

#define FILE_FMT_QUAD   3

Definition at line 171 of file file.h.

Referenced by check_format_type().

#define FILE_FMT_STR   2

Definition at line 170 of file file.h.

Referenced by check_format_type().

#define FILE_INVALID   0

Definition at line 124 of file file.h.

Referenced by parse().

#define FILE_LDATE   14

Definition at line 138 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_LEDATE   12

Definition at line 136 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_LELDATE   16

Definition at line 140 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_LELONG   11

Definition at line 135 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), mprint(), and parse().

#define FILE_LEQDATE   28

Definition at line 152 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_LEQLDATE   31

Definition at line 155 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_LEQUAD   25

Definition at line 149 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_LESHORT   10

Definition at line 134 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), mprint(), and parse().

#define FILE_LESTRING16   19

Definition at line 143 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), getvalue(), magiccheck(), mconvert(), mcopy(), mprint(), and string_modifier_check().

#define FILE_LOAD   0

Definition at line 105 of file file.h.

Referenced by magic_load().

#define FILE_LONG   4

Definition at line 128 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), mprint(), and parse().

#define FILE_MAGICSIZE   (32 * 4)

Definition at line 103 of file file.h.

Referenced by apprentice_1().

#define FILE_MEDATE   21

Definition at line 145 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_MELDATE   22

Definition at line 146 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_MELONG   23

Definition at line 147 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), mprint(), and parse().

#define FILE_NAMES_SIZE   33

Definition at line 157 of file file.h.

Referenced by init_file_tables().

#define FILE_OPADD   3

Definition at line 188 of file file.h.

Referenced by get_op(), and mget().

#define FILE_OPAND   0

Definition at line 185 of file file.h.

Referenced by get_op(), and mget().

#define FILE_OPDIVIDE   6

Definition at line 191 of file file.h.

Referenced by get_op(), mget(), and parse().

#define FILE_OPINDIRECT   0x80

Definition at line 198 of file file.h.

Referenced by mget(), and parse().

#define FILE_OPINVERSE   0x40

Definition at line 197 of file file.h.

Referenced by file_mdump(), mget(), and parse().

#define FILE_OPMINUS   4

Definition at line 189 of file file.h.

Referenced by get_op(), and mget().

#define FILE_OPMODULO   7

Definition at line 192 of file file.h.

Referenced by get_op(), and mget().

#define FILE_OPMULTIPLY   5

Definition at line 190 of file file.h.

Referenced by get_op(), and mget().

#define FILE_OPOR   1

Definition at line 186 of file file.h.

Referenced by get_op(), and mget().

#define FILE_OPS   "&|^+-*/%"

Definition at line 184 of file file.h.

Referenced by file_mdump().

#define FILE_OPS_MASK   0x07

Definition at line 193 of file file.h.

Referenced by file_mdump(), and mget().

#define FILE_OPXOR   2

Definition at line 187 of file file.h.

Referenced by get_op(), and mget().

#define FILE_PSTRING   13

Definition at line 137 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), getvalue(), magiccheck(), mconvert(), mcopy(), mget(), mprint(), and string_modifier_check().

#define FILE_QDATE   27

Definition at line 151 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_QLDATE   30

Definition at line 154 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_QUAD   24

Definition at line 148 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), and mprint().

#define FILE_RCSID ( id   ) 

Value:

static const char *rcsid(const char *p) /*@*/ { \
        return rcsid(p = id); \
}

Definition at line 409 of file file.h.

#define FILE_REGEX   17

Definition at line 141 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), getvalue(), magiccheck(), mconvert(), mcopy(), mget(), mprint(), and string_modifier_check().

#define FILE_SEARCH   20

Definition at line 144 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), getvalue(), magiccheck(), mconvert(), mcopy(), mget(), mprint(), and string_modifier_check().

#define FILE_SHORT   2

Definition at line 126 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), magiccheck(), mconvert(), mget(), and mprint().

#define FILE_STRING   5

Definition at line 129 of file file.h.

Referenced by apprentice_magic_strength(), file_mdump(), file_signextend(), getvalue(), magiccheck(), mconvert(), mcopy(), mget(), mprint(), and string_modifier_check().

#define FILE_UNUSED_1   0x08

Definition at line 194 of file file.h.

#define FILE_UNUSED_2   0x10

Definition at line 195 of file file.h.

#define FILE_UNUSED_3   0x20

Definition at line 196 of file file.h.

#define HOWMANY   (256 * 1024)

Definition at line 95 of file file.h.

Referenced by magic_file(), and uncompressbuf().

#define INDIR   1

Definition at line 114 of file file.h.

Referenced by file_mdump(), mget(), and parse().

#define INDIROFFADD   4

Definition at line 116 of file file.h.

Referenced by mget(), and parse().

#define IS_STRING (  ) 

Value:

((t) == FILE_STRING || \
         (t) == FILE_PSTRING || \
         (t) == FILE_BESTRING16 || \
         (t) == FILE_LESTRING16 || \
         (t) == FILE_REGEX || \
         (t) == FILE_SEARCH || \
         (t) == FILE_DEFAULT)

Definition at line 159 of file file.h.

Referenced by bs1(), file_mdump(), and parse().

#define MAGIC   "/etc/magic"

Definition at line 57 of file file.h.

Referenced by file_apprentice().

#define MAGICNO   0xF11E041C

Definition at line 101 of file file.h.

Referenced by apprentice_map().

#define MAXDESC   64

Definition at line 98 of file file.h.

#define MAXMAGIS   8192

Definition at line 97 of file file.h.

Referenced by apprentice_file().

#define MAXstring   32

Definition at line 99 of file file.h.

#define MIN ( a,
 )     (((a) < (b)) ? (a) : (b))

Definition at line 91 of file file.h.

Referenced by magiccheck().

#define num_mask   _u._mask

Definition at line 221 of file file.h.

#define O_BINARY   0

Definition at line 406 of file file.h.

Referenced by apprentice_compile(), apprentice_map(), and magic_file().

#define OFFADD   2

Definition at line 115 of file file.h.

Referenced by match(), and parse().

#define PATHSEP   ':'

Definition at line 63 of file file.h.

Referenced by file_apprentice().

#define private   static

Definition at line 66 of file file.h.

#define public

Definition at line 70 of file file.h.

#define REGEX_OFFSET_START   BIT(4)

Definition at line 245 of file file.h.

Referenced by file_mdump(), mprint(), parse(), and string_modifier_check().

#define str_count   _u._s._count

Definition at line 222 of file file.h.

#define str_flags   _u._s._flags

Definition at line 223 of file file.h.

#define strerror (  )     (((e) >= 0 && (e) < sys_nerr) ? sys_errlist[(e)] : "Unknown error")

Definition at line 388 of file file.h.

Referenced by checkOwners(), checkPassPhrase(), cpioStrerror(), dbiOpen(), doScript(), fdFgets(), fdWritable(), file_error_core(), file_fsmagic(), fsmStage(), Fstrerror(), getFdErrstr(), getFilesystemList(), getOutputFrom(), load(), lzdClose(), lzdWrite(), main(), makeGPGSignature(), makePGPSignature(), packageBinaries(), prepFetch(), processSourceFiles(), rpmdbRebuild(), rpmdsGetconf(), rpmfcClassify(), rpmGetFilesystemUsage(), rpmProblemString(), rpmQueryVerify(), runScript(), ufdRead(), ufdWrite(), uncompressbuf(), unwrap(), and urlStrerror().

#define STRING_COMPACT_BLANK   BIT(0)

Definition at line 241 of file file.h.

Referenced by file_mdump(), file_strncmp(), parse(), and string_modifier_check().

#define STRING_COMPACT_OPTIONAL_BLANK   BIT(1)

Definition at line 242 of file file.h.

Referenced by file_mdump(), file_strncmp(), parse(), and string_modifier_check().

#define STRING_IGNORE_CASE   (STRING_IGNORE_LOWERCASE|STRING_IGNORE_UPPERCASE)

Definition at line 251 of file file.h.

Referenced by magiccheck().

#define STRING_IGNORE_LOWERCASE   BIT(2)

Definition at line 243 of file file.h.

Referenced by file_mdump(), file_strncmp(), and parse().

#define STRING_IGNORE_UPPERCASE   BIT(3)

Definition at line 244 of file file.h.

Referenced by file_mdump(), file_strncmp(), and parse().

#define strtoul ( a,
b,
 )     strtol(a, b, c)

Definition at line 393 of file file.h.

Referenced by addCanon(), parse(), parseFormat(), parseNum(), rpmEVRparse(), rpmQueryVerify(), and strntoul().

#define UNSIGNED   8

Definition at line 117 of file file.h.

Referenced by file_mdump(), file_signextend(), magiccheck(), and parse().

#define VERSIONNO   4

Definition at line 102 of file file.h.

Referenced by apprentice_map().


Function Documentation

struct mlist* file_apprentice ( struct magic_set ms,
const char *  ,
int   
) [read]

Definition at line 359 of file apprentice.c.

References apprentice_1(), file_error(), file_oomem(), magic_set::flags, getenv(), init_file_tables(), MAGIC, MAGIC_MIME, mime, and PATHSEP.

Referenced by magic_check(), magic_compile(), and magic_load().

int file_ascmagic ( struct magic_set ms,
const unsigned char *  ,
size_t   
)

Definition at line 83 of file ascmagic.c.

References ascmatch(), magic_set::flags, from_ebcdic(), ISSPC, looks_ascii(), looks_extended(), looks_latin1(), looks_unicode(), looks_utf8(), MAGIC_NO_CHECK_FORTRAN, MAGIC_NO_CHECK_TOKENS, MAGIC_NO_CHECK_TROFF, names::name, NNAMES, names::type, and types.

Referenced by file_buffer().

void file_badread ( struct magic_set ms  ) 

Definition at line 150 of file funcs.c.

References errno, and file_error().

Referenced by apprentice_map().

void file_badseek ( struct magic_set ms  ) 

Definition at line 144 of file funcs.c.

References errno, and file_error().

Referenced by file_pipe2file().

int file_buffer ( struct magic_set ms,
int  fd,
const char *  inname,
const void *  buf,
size_t  nb 
)

Definition at line 157 of file funcs.c.

References file_ascmagic(), file_is_tar(), file_printf(), file_softmagic(), file_tryelf(), file_zmagic(), magic_set::flags, MAGIC_MIME, MAGIC_NO_CHECK_APPTYPE, MAGIC_NO_CHECK_ASCII, MAGIC_NO_CHECK_COMPRESS, MAGIC_NO_CHECK_ELF, MAGIC_NO_CHECK_SOFT, and MAGIC_NO_CHECK_TAR.

Referenced by file_zmagic(), magic_buffer(), and magic_file().

int file_check_mem ( struct magic_set ms,
unsigned  int 
)

Definition at line 99 of file softmagic.c.

References magic_set::c, COND_NONE, file_oomem(), magic_set::cont::level_info::got_match, magic_set::cont::level_info::last_cond, magic_set::cont::level_info::last_match, magic_set::cont::len, and magic_set::cont::li.

Referenced by match(), and parse().

void file_delmagic ( struct magic p,
int  type,
size_t  entries 
)

Definition at line 336 of file apprentice.c.

Referenced by apprentice_1(), and free_mlist().

void file_error ( struct magic_set ms,
int  error,
const char *  f,
  ... 
)

Definition at line 116 of file funcs.c.

References file_error_core().

Referenced by apprentice_1(), apprentice_compile(), apprentice_file(), apprentice_map(), check_format(), file_apprentice(), file_badread(), file_badseek(), file_fsmagic(), file_oomem(), file_pipe2file(), file_reset(), getstr(), magic_file(), parse(), rcsid(), and uncompressbuf().

const char* file_fmttime ( uint32_t  ,
int   
)

Definition at line 190 of file print.c.

Referenced by file_mdump(), and mprint().

int file_fsmagic ( struct magic_set ms,
const char *  ,
struct stat *  sb 
)

Definition at line 64 of file fsmagic.c.

References errno, file_error(), file_printf(), magic_set::flags, magic_set::haderr, MAGIC_DEVICES, MAGIC_ERROR, magic_file(), MAGIC_MIME, MAGIC_SYMLINK, major, minor, S_IFSOCK, and strerror.

Referenced by magic_file().

const char* file_getbuffer ( struct magic_set ms  ) 

Definition at line 238 of file funcs.c.

References magic_set::out::buf, file_oomem(), magic_set::flags, magic_set::haderr, magic_set::out::left, MAGIC_RAW, magic_set::o, OCTALIFY, magic_set::out::pbuf, magic_set::out::psize, and magic_set::out::size.

Referenced by magic_buffer(), and magic_file().

int file_is_tar ( struct magic_set ms,
const unsigned char *  ,
size_t   
)

Definition at line 59 of file is_tar.c.

References file_printf(), is_tar(), and MAGIC_MIME.

Referenced by file_buffer().

void file_magerror ( struct magic_set ms,
const char *  ,
  ... 
)

Definition at line 129 of file funcs.c.

References file_error_core(), and magic_set::line.

Referenced by check_fmt(), magiccheck(), mconvert(), mcopy(), and mprint().

void file_magwarn ( struct magic_set ms,
const char *  ,
  ... 
)

Definition at line 174 of file print.c.

References magic_set::file, and magic_set::line.

Referenced by apprentice_1(), apprentice_file(), check_cond(), file_signextend(), getstr(), getvalue(), parse(), and string_modifier_check().

size_t file_mbswidth ( const char *   ) 

Definition at line 533 of file file.c.

Referenced by main(), process(), and unwrap().

void file_mdump ( struct magic  ) 

Definition at line 51 of file print.c.

References CHAR_COMPACT_BLANK, CHAR_COMPACT_OPTIONAL_BLANK, CHAR_IGNORE_LOWERCASE, CHAR_IGNORE_UPPERCASE, CHAR_REGEX_OFFSET_START, magic::cont_level, magic::desc, FILE_BEDATE, FILE_BELDATE, FILE_BELONG, FILE_BEQDATE, FILE_BEQLDATE, FILE_BEQUAD, FILE_BESHORT, FILE_BESTRING16, FILE_BYTE, FILE_DATE, FILE_DEFAULT, file_fmttime(), FILE_LDATE, FILE_LEDATE, FILE_LELDATE, FILE_LELONG, FILE_LEQDATE, FILE_LEQLDATE, FILE_LEQUAD, FILE_LESHORT, FILE_LESTRING16, FILE_LONG, FILE_MEDATE, FILE_MELDATE, FILE_MELONG, file_names, file_nnames, FILE_OPINVERSE, FILE_OPS, FILE_OPS_MASK, FILE_PSTRING, FILE_QDATE, FILE_QLDATE, FILE_QUAD, FILE_REGEX, FILE_SEARCH, FILE_SHORT, file_showstr(), FILE_STRING, magic::flag, magic::in_offset, magic::in_op, magic::in_type, INDIR, IS_STRING, magic::VALUETYPE::l, magic::lineno, magic::mask_op, magic::offset, magic::VALUETYPE::q, REGEX_OFFSET_START, magic::reln, magic::VALUETYPE::s, STRING_COMPACT_BLANK, STRING_COMPACT_OPTIONAL_BLANK, STRING_IGNORE_LOWERCASE, STRING_IGNORE_UPPERCASE, SZOF, magic::type, UNSIGNED, magic::vallen, and magic::value.

Referenced by mget(), and parse().

void file_oomem ( struct magic_set ms,
size_t   
)

Definition at line 138 of file funcs.c.

References errno, and file_error().

Referenced by apprentice_1(), apprentice_file(), apprentice_map(), file_apprentice(), file_check_mem(), file_getbuffer(), file_printf(), mprint(), and parse().

int file_pipe2file ( struct magic_set ms,
int  ,
const void *  ,
size_t   
)

Definition at line 236 of file compress.c.

References errno, file_badseek(), file_error(), SEEK_SET, sread(), and swrite().

int file_printf ( struct magic_set ms,
const char *  ,
  ... 
)

Definition at line 54 of file funcs.c.

References magic_set::out::buf, file_oomem(), magic_set::out::left, magic_set::o, magic_set::out::ptr, magic_set::out::size, and vsnprintf().

Referenced by file_buffer(), file_fsmagic(), file_is_tar(), file_zmagic(), info_from_stat(), magic_file(), match(), mprint(), print_sep(), and rcsid().

int file_reset ( struct magic_set ms  ) 

Definition at line 217 of file funcs.c.

References magic_set::out::buf, magic_set::error, file_error(), magic_set::haderr, magic_set::mlist, magic_set::o, and magic_set::out::ptr.

Referenced by magic_buffer(), and magic_file().

void file_showstr ( FILE *  fp,
const char *  ,
size_t   
)

Definition at line 1591 of file apprentice.c.

Referenced by file_mdump(), and mdebug().

uint64_t file_signextend ( struct magic_set ms,
struct magic ,
uint64_t   
)

Definition at line 662 of file apprentice.c.

References FILE_BEDATE, FILE_BELDATE, FILE_BELONG, FILE_BEQDATE, FILE_BEQLDATE, FILE_BEQUAD, FILE_BESHORT, FILE_BESTRING16, FILE_BYTE, FILE_DATE, FILE_DEFAULT, FILE_LDATE, FILE_LEDATE, FILE_LELDATE, FILE_LELONG, FILE_LEQDATE, FILE_LEQLDATE, FILE_LEQUAD, FILE_LESHORT, FILE_LESTRING16, FILE_LONG, file_magwarn(), FILE_MEDATE, FILE_MELDATE, FILE_MELONG, FILE_PSTRING, FILE_QDATE, FILE_QLDATE, FILE_QUAD, FILE_REGEX, FILE_SEARCH, FILE_SHORT, FILE_STRING, magic::flag, magic_set::flags, MAGIC_CHECK, magic::type, and UNSIGNED.

Referenced by getvalue(), magiccheck(), mprint(), and parse().

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

Definition at line 83 of file softmagic.c.

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

Referenced by file_buffer().

int file_tryelf ( struct magic_set ms,
int  ,
const unsigned char *  ,
size_t   
)

Referenced by file_buffer().

int file_zmagic ( struct magic_set ms,
int  fd,
const char *  name,
const unsigned char *  buf,
size_t  nbytes 
)

Definition at line 106 of file compress.c.

References file_buffer(), file_printf(), magic_set::flags, MAGIC_COMPRESS, maglen, NODATA, and uncompressbuf().

Referenced by file_buffer().

int snprintf ( char *  ,
size_t  ,
const char *  ,
  ... 
)

Definition at line 327 of file funcs.c.

Referenced by file_error_core(), headerCheck(), mkdbname(), mprint(), pgpsigFormat(), rpmfcHelper(), rpmProblemString(), rpmpsmStage(), rpmReadHeader(), rpmReadSignature(), singleSprintf(), xmlFormat(), and yamlFormat().

ssize_t sread ( int  fd,
void *  buf,
size_t  n,
int  canbepipe 
)

Definition at line 172 of file compress.c.

References check, errno, and STDIN_FILENO.

Referenced by file_pipe2file(), magic_file(), and uncompressbuf().


Variable Documentation

const char* file_names[]

Definition at line 89 of file apprentice.c.

Referenced by file_mdump().

const size_t file_nnames

Definition at line 91 of file apprentice.c.

Referenced by file_mdump().

char* sys_errlist[]

int sys_nerr


Generated on Fri May 25 21:18:41 2007 for rpm by  doxygen 1.5.2