home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progc
/
djsrc106.arj
/
DJTART.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-18
|
1KB
|
70 lines
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
#include <io.h>
#include "oread.h"
void Fatal(char *msg)
{
fprintf(stderr, "Fatal! %s!\n", msg);
exit(1);
}
/*------------------------------------------------------------------------*/
main(int argc, char **argv)
{
int i = 1;
for (; i < argc; i++)
tarlist(argv[i]);
}
/*------------------------------------------------------------------------*/
typedef struct {
char name[100];
char operm[8];
char ouid[8];
char ogid[8];
char osize[11];
char otime[12];
char ocsum[8];
char flags[2];
char filler[355];
} TARREC;
char buf[512];
tarlist(char *fname)
{
TARREC header;
int r;
void *f;
long perm, uid, gid, size, time, csum, posn=0;
int dsize;
char *changed_name;
f = oread_open(fname);
while (1)
{
oread_read(f, &header);
if (header.name[0] == 0)
break;
sscanf(header.operm, "%lo", &perm);
sscanf(header.ouid, "%lo", &uid);
sscanf(header.ogid, "%lo", &gid);
sscanf(header.osize, "%lo", &size);
sscanf(header.otime, "%lo", &time);
printf("%08lx %6lo %12ld %s", posn, perm, size, header.name, posn);
if (header.flags[1] == 0x32)
printf(" -> %s", header.filler);
printf("\n");
oread_skip(f, (size+511) & ~511);
posn += 512 + (size+511) & ~511;
}
oread_close(f);
}