file/src/file.c File Reference

#include "file.h"
#include "magic.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <netinet/in.h>
#include "patchlevel.h"

Go to the source code of this file.

Defines

#define SYMLINKFLAG   ""
#define USAGE   "Usage: %s [-bcik" SYMLINKFLAG "nNsvz] [-f namefile] [-F separator] [-m magicfiles] file...\n %s -C -m magicfiles\n"
#define MAXPATHLEN   512
#define OPTSTRING   "bcCdf:F:ikLm:nNprsvz"

Functions

static const char * rcsid (const char *p)
static void unwrap (char *fn)
static void usage (void)
static void process (const char *inname, int wid)
static void load (const char *m, int flags)
int main (int argc, char *argv[])
size_t file_mbswidth (const char *s)

Variables

static int bflag = 0
static int nopad = 0
static int nobuffer = 0
static const char * magicfile = 0
static const char * default_magicfile = "/etc/magic"
static const char * separator = ":"
static char * progname
static struct magic_setmagic


Define Documentation

#define MAXPATHLEN   512

Definition at line 88 of file file.c.

#define OPTSTRING   "bcCdf:F:ikLm:nNprsvz"

Referenced by main().

#define SYMLINKFLAG   ""

Definition at line 82 of file file.c.

#define USAGE   "Usage: %s [-bcik" SYMLINKFLAG "nNsvz] [-f namefile] [-F separator] [-m magicfiles] file...\n %s -C -m magicfiles\n"

Definition at line 85 of file file.c.


Function Documentation

size_t file_mbswidth ( const char *  s  ) 

Definition at line 474 of file file.c.

Referenced by main(), and unwrap().

static void load ( const char *  m,
int  flags 
) [static]

Definition at line 344 of file file.c.

Referenced by main().

int main ( int  argc,
char *  argv[] 
)

Definition at line 140 of file file.c.

References bflag, magic_set::c, errno, FILE_CHECK, FILE_COMPILE, file_mbswidth(), magic_set::flags, getenv(), load(), nobuffer, nopad, OPTSTRING, process(), setlocale, strerror, unwrap(), and usage().

static void process ( const char *  inname,
int  wid 
) [static]

Definition at line 401 of file file.c.

Referenced by main(), and unwrap().

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

Definition at line 75 of file file.c.

static void unwrap ( char *  fn  )  [static]

Definition at line 364 of file file.c.

References errno, EXIT_FAILURE, file_mbswidth(), MAXPATHLEN, nobuffer, process(), and strerror.

Referenced by main().

static void usage ( void   )  [static]

Definition at line 508 of file file.c.

Referenced by main().


Variable Documentation

int bflag = 0 [static]

Definition at line 93 of file file.c.

Referenced by main().

const char* default_magicfile = "/etc/magic" [static]

Definition at line 100 of file file.c.

struct magic_set* magic [static]

Definition at line 108 of file file.c.

const char* magicfile = 0 [static]

Definition at line 98 of file file.c.

int nobuffer = 0 [static]

Definition at line 95 of file file.c.

Referenced by main(), and unwrap().

int nopad = 0 [static]

Definition at line 94 of file file.c.

Referenced by main().

char* progname [static]

Definition at line 105 of file file.c.

Referenced by main().

const char* separator = ":" [static]

Definition at line 102 of file file.c.


Generated on Sun Jun 1 21:56:23 2008 for rpm by  doxygen 1.5.4