Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
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.

Classes

struct  tar_header
 
union  tar_buffer
 
struct  attr_item
 

Macros

#define REGTYPE   '0' /* regular file */
 
#define AREGTYPE   '\0' /* regular file */
 
#define LNKTYPE   '1' /* link */
 
#define SYMTYPE   '2' /* reserved */
 
#define CHRTYPE   '3' /* character special */
 
#define BLKTYPE   '4' /* block special */
 
#define DIRTYPE   '5' /* directory */
 
#define FIFOTYPE   '6' /* FIFO special */
 
#define CONTTYPE   '7' /* reserved */
 
#define GNUTYPE_DUMPDIR   'D' /* file names from dumped directory */
 
#define GNUTYPE_LONGLINK   'K' /* long link name */
 
#define GNUTYPE_LONGNAME   'L' /* long file name */
 
#define GNUTYPE_MULTIVOL   'M' /* continuation of file from another volume */
 
#define GNUTYPE_NAMES   'N' /* file name that does not fit into main hdr */
 
#define GNUTYPE_SPARSE   'S' /* sparse file */
 
#define GNUTYPE_VOLHDR   'V' /* tape/volume header */
 
#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 }
 

Class Documentation

struct tar_header

Definition at line 68 of file untgz.c.

Collaboration diagram for tar_header:
Collaboration graph
Class Members
char chksum[8]
char devmajor[8]
char devminor[8]
char gid[8]
char gname[32]
char linkname[100]
char magic[6]
char mode[8]
char mtime[12]
char name[100]
char prefix[155]
char size[12]
char typeflag
char uid[8]
char uname[32]
char version[2]
union tar_buffer

Definition at line 89 of file untgz.c.

Collaboration diagram for tar_buffer:
Collaboration graph
Class Members
char buffer[512]
struct tar_header header
struct attr_item

Definition at line 95 of file untgz.c.

Collaboration diagram for attr_item:
Collaboration graph
Class Members
char * fname
int mode
struct attr_item * next
time_t time

Macro Definition Documentation

#define AREGTYPE   '\0' /* regular file */

Definition at line 43 of file untgz.c.

#define BLKTYPE   '4' /* block special */

Definition at line 47 of file untgz.c.

#define BLOCKSIZE   512

Definition at line 65 of file untgz.c.

#define CHRTYPE   '3' /* character special */

Definition at line 46 of file untgz.c.

#define CONTTYPE   '7' /* reserved */

Definition at line 50 of file untgz.c.

#define DIRTYPE   '5' /* directory */

Definition at line 48 of file untgz.c.

#define FIFOTYPE   '6' /* FIFO special */

Definition at line 49 of file untgz.c.

#define GNUTYPE_DUMPDIR   'D' /* file names from dumped directory */

Definition at line 54 of file untgz.c.

#define GNUTYPE_LONGLINK   'K' /* long link name */

Definition at line 55 of file untgz.c.

#define GNUTYPE_LONGNAME   'L' /* long file name */

Definition at line 56 of file untgz.c.

#define GNUTYPE_MULTIVOL   'M' /* continuation of file from another volume */

Definition at line 57 of file untgz.c.

#define GNUTYPE_NAMES   'N' /* file name that does not fit into main hdr */

Definition at line 58 of file untgz.c.

#define GNUTYPE_SPARSE   'S' /* sparse file */

Definition at line 59 of file untgz.c.

#define GNUTYPE_VOLHDR   'V' /* tape/volume header */

Definition at line 60 of file untgz.c.

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

Definition at line 288 of file untgz.c.

#define LNKTYPE   '1' /* link */

Definition at line 44 of file untgz.c.

#define REGTYPE   '0' /* regular file */

Definition at line 42 of file untgz.c.

#define SHORTNAMESIZE   100

Definition at line 66 of file untgz.c.

#define SYMTYPE   '2' /* reserved */

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.

int ExprMatch ( char *  string,
char *  expr 
)

Definition at line 290 of file untgz.c.

int getoct ( char *  p,
int  width 
)

Definition at line 168 of file untgz.c.

void help ( int  exitval)

Definition at line 581 of file untgz.c.

int main ( int  argc,
char **  argv 
)

Definition at line 606 of file untgz.c.

int makedir ( char *  newdir)

Definition at line 328 of file untgz.c.

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

Definition at line 371 of file untgz.c.

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 **)  )
void push_attr ( struct attr_item **  list,
char *  fname,
int  mode,
time_t  time 
)

Definition at line 253 of file untgz.c.

void restore_attr ( struct attr_item **  list)

Definition at line 270 of file untgz.c.

int setfiletime ( char *  fname,
time_t  ftime 
)

Definition at line 206 of file untgz.c.

char* strtime ( time_t *  t)

Definition at line 191 of file untgz.c.

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

Definition at line 386 of file untgz.c.

char* TGZfname ( const char *  arcname)

Definition at line 132 of file untgz.c.

void TGZnotfound ( const char *  arcname)

Definition at line 152 of file untgz.c.

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.