options.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mtio.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <minix/paths.h>
#include <strings.h>
#include "pax.h"
#include "options.h"
#include "cpio.h"
#include "tar.h"
#include "extern.h"

Include dependency graph for options.c:

Go to the source code of this file.

Defines

#define _POSIX_SOURCE   1
#define _MINIX   1
#define GETLINE_FILE_CORRUPT   1
#define GETLINE_OUT_OF_MEM   2
#define GZIP_CMD   "gzip"
#define COMPRESS_CMD   "compress"
#define BZIP2_CMD   "bzip2"
#define F_OCPIO   0
#define F_ACPIO   1
#define F_CPIO   3
#define F_OTAR   4
#define F_TAR   5
#define DEFLT   5

Functions

static int no_op (void)
static void printflg (unsigned int)
static int c_frmt (const void *, const void *)
static off_t str_offt (char *)
static char * getline (FILE *fp)
static void pax_options (int, char **)
static void pax_usage (void)
static void tar_options (int, char **)
static void tar_usage (void)
static void cpio_options (int, char **)
static void cpio_usage (void)
void options (int argc, char **argv)
static int mkpath (char *path)
OPLISTopt_next (void)
int bad_opt (void)
int opt_add (const char *str)
char * fgetln (FILE *f, size_t *)

Variables

static char flgch [] = FLGCH
static OPLISTophead = NULL
static OPLISToptail = NULL
static int getline_error
FSUB fsub []
int ford [] = {5, 4, 3, 2, 1, 0, -1 }


Define Documentation

#define _MINIX   1
 

Definition at line 35 of file options.c.

#define _POSIX_SOURCE   1
 

Definition at line 34 of file options.c.

#define BZIP2_CMD   "bzip2"
 

Definition at line 95 of file options.c.

Referenced by tar_options().

#define COMPRESS_CMD   "compress"
 

Definition at line 94 of file options.c.

Referenced by cpio_options(), and tar_options().

#define DEFLT   5
 

Definition at line 142 of file options.c.

#define F_ACPIO   1
 

Definition at line 138 of file options.c.

Referenced by cpio_options().

#define F_CPIO   3
 

Definition at line 139 of file options.c.

Referenced by cpio_options().

#define F_OCPIO   0
 

Definition at line 137 of file options.c.

Referenced by cpio_options().

#define F_OTAR   4
 

Definition at line 140 of file options.c.

Referenced by tar_options().

#define F_TAR   5
 

Definition at line 141 of file options.c.

Referenced by tar_options().

#define GETLINE_FILE_CORRUPT   1
 

Definition at line 88 of file options.c.

Referenced by getline().

#define GETLINE_OUT_OF_MEM   2
 

Definition at line 89 of file options.c.

Referenced by getline().

#define GZIP_CMD   "gzip"
 

Definition at line 93 of file options.c.

Referenced by cpio_options(), pax_options(), and tar_options().


Function Documentation

int bad_opt void   ) 
 

Definition at line 1333 of file options.c.

References fprintf(), oplist::name, NULL, ophead, opt_next(), pax_usage(), paxwarn(), stderr, and oplist::value.

static int c_frmt const void *  ,
const void * 
[static]
 

Definition at line 1303 of file options.c.

References strcmp.

Referenced by cpio_options(), and pax_options().

static void cpio_options int  ,
char ** 
[static]
 

Definition at line 1021 of file options.c.

References act, APPND, ARCHIVE, arcname, atoi, bsearch(), c, c_frmt(), cflag, COMPRESS_CMD, COPY, cpio_usage(), dflag, dirptr, EXTRACT, F_ACPIO, F_CPIO, F_OCPIO, fclose(), fopen(), fp, fprintf(), fputs(), frmt, fsub, ftree_add(), getline(), getline_error, getopt(), GZIP_CMD, gzip_program, i, iflag, kflag, Lflag, lflag, LIST, listf, maxflt, mkpath(), nodirs, NULL, optarg, pat_add(), paxwarn(), pids, pmode, pmtime, stderr, stdin, stdout, tflag, tmp, vflag, and wrblksz.

Referenced by options().

static void cpio_usage void   )  [static]
 

Definition at line 1583 of file options.c.

References exit(), fputs(), and stderr.

Referenced by cpio_options().

char* fgetln FILE f,
size_t
 

Definition at line 7 of file fgetln.c.

References b, EXTRA, fgets(), fp, free, NULL, r, realloc(), and strlen().

Referenced by getline().

static char * getline FILE fp  )  [static]
 

Definition at line 1493 of file options.c.

References f, ferror, fgetln(), getline_error, GETLINE_FILE_CORRUPT, GETLINE_OUT_OF_MEM, malloc(), and memcpy().

static int mkpath char *  path  )  [static]
 

Definition at line 983 of file options.c.

References done, ENOENT, ENOTDIR, errno, mkdir, paxwarn(), S_ISDIR, sb, slash(), stat, strcspn(), strspn(), and syswarn().

Referenced by cpio_options().

static int no_op void   )  [static]
 

Definition at line 1523 of file options.c.

int opt_add const char *  str  ) 
 

Definition at line 1359 of file options.c.

References endpt, oplist::fow, free, malloc(), oplist::name, NULL, ophead, optail, paxwarn(), strchr, strdup(), and oplist::value.

Referenced by pax_options(), and tar_options().

OPLIST* opt_next void   ) 
 

Definition at line 1317 of file options.c.

References oplist::fow, NULL, and ophead.

Referenced by bad_opt(), and tar_opt().

void options int  argc,
char **  argv
 

Definition at line 158 of file options.c.

References argv0, cpio_options(), NM_CPIO, NM_PAX, NM_TAR, NULL, pax_options(), strcmp, strrchr(), and tar_options().

static void pax_options int  ,
char ** 
[static]
 

Definition at line 192 of file options.c.

References AF, arcname, atoi, BF, BLKMULT, bsearch(), c, c_frmt(), CBF, CDF, CEF, CF, cflag, CGF, CHF, CLF, CPF, CTF, CUF, CXF, CYF, CZF, DF, Dflag, dflag, FF, fprintf(), fputs(), frmt, fsub, getopt(), grp_add(), GZIP_CMD, gzip_program, Hflag, i, IF, iflag, KF, kflag, LF, Lflag, lflag, maxflt, NF, nflag, NONE, NULL, OF, opt_add(), optarg, patime, pax_usage(), paxwarn(), PF, pids, pmode, pmtime, rep_add(), RF, SF, stderr, str_offt(), strcmp, TF, tflag, tmp, trng_add(), UF, uflag, usr_add(), VF, vflag, WF, wrblksz, wrlimit, XF, Xflag, Yflag, and Zflag.

Referenced by options().

static void pax_usage void   )  [static]
 

Definition at line 1534 of file options.c.

References exit(), fputs(), and stderr.

Referenced by bad_opt(), and pax_options().

static void printflg unsigned  int  )  [static]
 

static off_t str_offt char *   )  [static]
 

Definition at line 1429 of file options.c.

References expr(), int(), LONG_MAX, num(), strtol(), and t.

Referenced by pax_options(), and tar_options().

static void tar_options int  ,
char ** 
[static]
 

Definition at line 590 of file options.c.

References _PATH_DEFTAPE, act, APPND, ARCHIVE, arcname, BZIP2_CMD, c, chdname, COMPRESS_CMD, exit(), EXTRACT, F_OTAR, F_TAR, fclose(), fopen(), fp, frmt, fsub, ftree_add(), getenv(), getline(), getline_error, getoldopt(), GZIP_CMD, gzip_program, Hflag, iflag, Lflag, LIST, listf, maxflt, nflag, NULL, opt_add(), optarg, pat_add(), paxwarn(), pids, pmode, pmtime, realloc(), rep_add(), rmleadslash, stderr, stdin, stdout, str_offt(), strcmp, tar_usage(), vflag, wrblksz, and Xflag.

Referenced by options().

static void tar_usage void   )  [static]
 

Definition at line 1568 of file options.c.

References exit(), fputs(), and stderr.

Referenced by tar_options().


Variable Documentation

char flgch[] = FLGCH [static]
 

Definition at line 71 of file options.c.

int ford[] = {5, 4, 3, 2, 1, 0, -1 }
 

Definition at line 149 of file options.c.

Referenced by get_arc().

FSUB fsub[]
 

Definition at line 106 of file options.c.

Referenced by cpio_options(), pax_options(), and tar_options().

int getline_error [static]
 

Definition at line 90 of file options.c.

Referenced by cpio_options(), getline(), and tar_options().

OPLIST* ophead = NULL [static]
 

Definition at line 72 of file options.c.

Referenced by bad_opt(), opt_add(), and opt_next().

OPLIST* optail = NULL [static]
 

Definition at line 73 of file options.c.

Referenced by opt_add().


Generated on Fri Apr 14 22:58:59 2006 for minix by  doxygen 1.4.6