#include "file.h"
#include "magic.h"
#include <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
Include dependency graph for funcs.c:
Go to the source code of this file.
Defines | |
#define | OCTALIFY(n, o) |
Functions | |
static const char * | rcsid (const char *p) |
int | vsnprintf (char *, size_t, const char *, va_list) |
int | file_printf (struct magic_set *ms, const char *fmt,...) |
static void | file_error_core (struct magic_set *ms, int error, const char *f, va_list va, uint32_t lineno) |
void | file_error (struct magic_set *ms, int error, const char *f,...) |
void | file_magerror (struct magic_set *ms, const char *f,...) |
void | file_oomem (struct magic_set *ms, size_t len) |
void | file_badseek (struct magic_set *ms) |
void | file_badread (struct magic_set *ms) |
int | file_buffer (struct magic_set *ms, int fd, const char *inname, const void *buf, size_t nb) |
int | file_reset (struct magic_set *ms) |
const char * | file_getbuffer (struct magic_set *ms) |
int | snprintf (char *buf, size_t len, const char *fmt,...) |
#define OCTALIFY | ( | n, | |||
o | ) |
Value:
/*LINTED*/ \ (void)(*(n)++ = '\\', \ *(n)++ = (((uint32_t)*(o) >> 6) & 3) + '0', \ *(n)++ = (((uint32_t)*(o) >> 3) & 7) + '0', \ *(n)++ = (((uint32_t)*(o) >> 0) & 7) + '0', \ (o)++)
Definition at line 229 of file funcs.c.
Referenced by file_getbuffer().
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().
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().
static void file_error_core | ( | struct magic_set * | ms, | |
int | error, | |||
const char * | f, | |||
va_list | va, | |||
uint32_t | lineno | |||
) | [static] |
Definition at line 91 of file funcs.c.
References magic_set::out::buf, magic_set::error, magic_set::haderr, magic_set::o, magic_set::out::size, snprintf(), strerror, and vsnprintf().
Referenced by file_error(), and file_magerror().
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().
void file_magerror | ( | struct magic_set * | ms, | |
const char * | f, | |||
... | ||||
) |
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_oomem | ( | struct magic_set * | ms, | |
size_t | len | |||
) |
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_printf | ( | struct magic_set * | ms, | |
const char * | fmt, | |||
... | ||||
) |
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().
int snprintf | ( | char * | buf, | |
size_t | len, | |||
const char * | fmt, | |||
... | ||||
) |
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().
int vsnprintf | ( | char * | , | |
size_t | , | |||
const char * | , | |||
va_list | ||||
) |
Definition at line 318 of file funcs.c.
Referenced by file_error_core(), file_printf(), snprintf(), and vrpmlog().