#ifdef _WIN32 # include <direct.h> # include <io.h> # include <windows.h> # ifndef F_OK # define F_OK 0 # endif # define mkdir(dirname,mode) _mkdir(dirname) # ifdef _MSC_VER # define access(path,mode) _access(path,mode) # define chmod(path,mode) _chmod(path,mode) # define strdup(str) _strdup(str) # endif #else # include <sys/stat.h> # include <unistd.h> # include <utime.h> #endif
/* values used in typeflag field */
#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 */
/* GNU tar extensions */
#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 */
/* convert octal digits to int */ /* on error return -1 */
int getoct (char *p,int width)
{ int result = 0; char c;
while (width--)
{
c = *p++; if (c == 0) break; if (c == ' ') continue; if (c < '0' || c > '7') return -1;
result = result * 8 + (c - '0');
} return result;
}
/* convert time_t to string */ /* use the "YYYY/MM/DD hh:mm:ss" format */
int matchname (int arg,int argc,char **argv,char *fname)
{ if (arg == argc) /* no arguments given (untgz tgzarchive) */ return1;
while (arg < argc) if (ExprMatch(fname,argv[arg++])) return1;
return0; /* ignore this for the moment being */
}
/* tar file list or extract */
int tar (gzFile in,int action,int arg,int argc,char **argv)
{ union tar_buffer buffer; int len; int err; int getheader = 1; int remaining = 0;
FILE *outfile = NULL; char fname[BLOCKSIZE]; int tarmode;
time_t tartime; struct attr_item *attributes = NULL;
if (action == TGZ_LIST)
printf(" date time size file\n" " ---------- -------- --------- -------------------------------------\n"); while (1)
{
len = gzread(in, &buffer, BLOCKSIZE); if (len < 0)
error(gzerror(in, &err)); /* *Alwaysexpectcompleteblockstoprocess *thetarinformation.
*/ if (len != BLOCKSIZE)
{
action = TGZ_INVALID; /* force error exit */
remaining = 0; /* force I/O cleanup */
}
if ((TGZfile = TGZfname(argv[arg])) == NULL)
TGZnotfound(argv[arg]);
++arg; if ((action == TGZ_LIST) && (arg != argc))
help(1);
/* *ProcesstheTGZfile
*/ switch(action)
{ case TGZ_LIST: case TGZ_EXTRACT:
f = gzopen(TGZfile,"rb"); if (f == NULL)
{
fprintf(stderr,"%s: Couldn't gzopen %s\n",prog,TGZfile); return1;
} exit(tar(f, action, arg, argc, argv)); break;
default:
error("Unknown option"); exit(1);
}
return0;
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:
(vorverarbeitet am 2026-06-17)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.