untgz.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include "zlib.h"
#include <direct.h>
#include <io.h>
#include <utime.h>

Include dependency graph for untgz.c:

Go to the source code of this file.

Data Structures

struct  tar_header
union  tar_buffer
struct  attr_item

Defines

#define REGTYPE   '0'
#define AREGTYPE   '\0'
#define LNKTYPE   '1'
#define SYMTYPE   '2'
#define CHRTYPE   '3'
#define BLKTYPE   '4'
#define DIRTYPE   '5'
#define FIFOTYPE   '6'
#define CONTTYPE   '7'
#define GNUTYPE_DUMPDIR   'D'
#define GNUTYPE_LONGLINK   'K'
#define GNUTYPE_LONGNAME   'L'
#define GNUTYPE_MULTIVOL   'M'
#define GNUTYPE_NAMES   'N'
#define GNUTYPE_SPARSE   'S'
#define GNUTYPE_VOLHDR   'V'
#define BLOCKSIZE   512
#define SHORTNAMESIZE   100
#define ISSPECIAL(c)   (((c) == '*') || ((c) == '/'))

Enumerations

enum  { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID }

Functions

char *TGZfname OF ((const char *))
int getoct OF ((char *, int))
char *strtime OF ((time_t *))
int setfiletime OF ((char *, time_t))
void push_attr OF ((struct attr_item **, char *, int, time_t))
void restore_attr OF ((struct attr_item **))
int ExprMatch OF ((char *, char *))
int makedir OF ((char *))
int matchname OF ((int, int, char **, char *))
int tar OF ((gzFile, int, int, int, char **))
void help OF ((int))
int main OF ((int, char **))
char * TGZfname (const char *arcname)
void TGZnotfound (const char *arcname)
int getoct (char *p, int width)
char * strtime (time_t *t)
int setfiletime (char *fname, time_t ftime)
void push_attr (struct attr_item **list, char *fname, int mode, time_t time)
void restore_attr (struct attr_item **list)
int ExprMatch (char *string, char *expr)
int makedir (char *newdir)
int matchname (int arg, int argc, char **argv, char *fname)
int tar (gzFile in, int action, int arg, int argc, char **argv)
void help (int exitval)
void error (const char *msg)
int main (int argc, char **argv)

Variables

char * prog
const char * TGZsuffix [] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL }


Define Documentation

#define AREGTYPE   '\0'
 

Definition at line 43 of file untgz.c.

#define BLKTYPE   '4'
 

Definition at line 47 of file untgz.c.

#define BLOCKSIZE   512
 

Definition at line 65 of file untgz.c.

#define CHRTYPE   '3'
 

Definition at line 46 of file untgz.c.

#define CONTTYPE   '7'
 

Definition at line 50 of file untgz.c.

#define DIRTYPE   '5'
 

Definition at line 48 of file untgz.c.

#define FIFOTYPE   '6'
 

Definition at line 49 of file untgz.c.

#define GNUTYPE_DUMPDIR   'D'
 

Definition at line 54 of file untgz.c.

#define GNUTYPE_LONGLINK   'K'
 

Definition at line 55 of file untgz.c.

Referenced by tar().

#define GNUTYPE_LONGNAME   'L'
 

Definition at line 56 of file untgz.c.

Referenced by tar().

#define GNUTYPE_MULTIVOL   'M'
 

Definition at line 57 of file untgz.c.

#define GNUTYPE_NAMES   'N'
 

Definition at line 58 of file untgz.c.

#define GNUTYPE_SPARSE   'S'
 

Definition at line 59 of file untgz.c.

#define GNUTYPE_VOLHDR   'V'
 

Definition at line 60 of file untgz.c.

#define ISSPECIAL c   )     (((c) == '*') || ((c) == '/'))
 

Definition at line 288 of file untgz.c.

Referenced by ExprMatch().

#define LNKTYPE   '1'
 

Definition at line 44 of file untgz.c.

#define REGTYPE   '0'
 

Definition at line 42 of file untgz.c.

#define SHORTNAMESIZE   100
 

Definition at line 66 of file untgz.c.

Referenced by tar().

#define SYMTYPE   '2'
 

Definition at line 45 of file untgz.c.


Enumeration Type Documentation

anonymous enum
 

Enumerator:
TGZ_EXTRACT 
TGZ_LIST 
TGZ_INVALID 

Definition at line 103 of file untgz.c.


Function Documentation

void error const char *  msg  ) 
 

Definition at line 593 of file untgz.c.

References exit(), fprintf(), prog, and stderr.

int ExprMatch char *  string,
char *  expr
 

Definition at line 290 of file untgz.c.

References ISSPECIAL.

Referenced by matchname().

int getoct char *  p,
int  width
 

Definition at line 168 of file untgz.c.

References c, and result.

Referenced by tar().

void help int  exitval  ) 
 

Definition at line 581 of file untgz.c.

References exit(), printf, and zlibVersion().

int main int  argc,
char **  argv
 

Definition at line 606 of file untgz.c.

References arg, error, exit(), fprintf(), gzopen(), help(), NULL, prog, stderr, strcmp, strrchr(), tar(), TGZ_EXTRACT, TGZ_LIST, TGZfname(), and TGZnotfound().

int makedir char *  newdir  ) 
 

Definition at line 328 of file untgz.c.

References ENOENT, errno, fprintf(), free, mkdir, p, prog, stderr, strdup(), and strlen().

int matchname int  arg,
int  argc,
char **  argv,
char *  fname
 

Definition at line 371 of file untgz.c.

References ExprMatch().

Referenced by tar().

int main OF (int, char **)   ) 
 

void help OF (int)   ) 
 

int tar OF (gzFile, int, int, int, char **)   ) 
 

int matchname OF (int, int, char **, char *)   ) 
 

int makedir OF (char *)   ) 
 

int ExprMatch OF (char *, char *)   ) 
 

void restore_attr OF (struct attr_item **)   ) 
 

void push_attr OF (struct attr_item **, char *, int, time_t  ) 
 

int setfiletime OF (char *, time_t  ) 
 

char* strtime OF (time_t *)   ) 
 

int getoct OF (char *, int)   ) 
 

char* TGZfname OF (const char *)   ) 
 

void push_attr struct attr_item **  list,
char *  fname,
int  mode,
time_t  time
 

Definition at line 253 of file untgz.c.

References error, attr_item::fname, list, malloc(), attr_item::mode, attr_item::next, NULL, strdup(), and attr_item::time.

Referenced by tar().

void restore_attr struct attr_item **  list  ) 
 

Definition at line 270 of file untgz.c.

References chmod, attr_item::fname, free, list, attr_item::mode, attr_item::next, NULL, setfiletime(), and attr_item::time.

Referenced by tar().

int setfiletime char *  fname,
time_t  ftime
 

Definition at line 206 of file untgz.c.

References utimbuf::actime, if(), INVALID_HANDLE_VALUE, localtime(), utimbuf::modtime, NULL, result, st, tm::tm_hour, tm::tm_mday, tm::tm_min, tm::tm_mon, tm::tm_sec, tm::tm_wday, tm::tm_year, utime, and WORD.

Referenced by restore_attr().

char* strtime time_t t  ) 
 

Definition at line 191 of file untgz.c.

References local, localtime(), result, and sprintf().

Referenced by tar().

int tar gzFile  in,
int  action,
int  arg,
int  argc,
char **  argv
 

Definition at line 386 of file untgz.c.

References AREGTYPE, BLOCKSIZE, buffer, bytes, DIRTYPE, err, error, fclose(), fname, fopen(), fprintf(), fwrite(), getoct(), GNUTYPE_LONGLINK, GNUTYPE_LONGNAME, gzclose(), gzerror(), gzread(), makedir(), matchname(), NULL, outfile, p, printf, prog, push_attr(), REGTYPE, remove(), restore_attr(), SHORTNAMESIZE, stderr, strlen(), strncmp(), strncpy(), strrchr(), strtime(), TGZ_EXTRACT, TGZ_INVALID, TGZ_LIST, time_t, and Z_OK.

Referenced by main().

char* TGZfname const char *  arcname  ) 
 

Definition at line 132 of file untgz.c.

References access, F_OK, i, origlen, strcpy(), and strlen().

Referenced by main().

void TGZnotfound const char *  arcname  ) 
 

Definition at line 152 of file untgz.c.

References exit(), fprintf(), i, prog, stderr, and TGZsuffix.

Referenced by main().


Variable Documentation

char* prog
 

Definition at line 125 of file untgz.c.

const char* TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL }
 

Definition at line 127 of file untgz.c.

Referenced by TGZnotfound().


Generated on Fri Apr 14 23:20:37 2006 for minix by  doxygen 1.4.6