/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* pax rar format
*/
#include <paxlib.h>
#include <codex.h>
#include <swap.h>
#include <tm.h>
typedef struct Ar_s
{
unsigned long checksum;
int solid;
unsigned short level;
} Ar_t;
static int
{
if (!ar)
return -1;
return 0;
}
static int
rar_getprologue(Pax_t* pax, Paxformat_t* fp, register Paxarchive_t* ap, Paxfile_t* f, unsigned char* buf, size_t size)
{
if (size < 7 || buf[0] != 0x52 || buf[1] != 0x61 || buf[2] != 0x72 || buf[3] != 0x21 || buf[4] != 0x1a || buf[5] != 0x07 || buf[6] != 0x00)
return 0;
{
if (ar)
return paxnospace(pax);
}
{
return -1;
}
return 1;
}
static int
{
register unsigned char* buf;
char* s;
unsigned short checksum;
unsigned short flags;
unsigned short type;
unsigned short size;
unsigned long data;
unsigned long dostime;
int i;
char* msg;
msg = 0;
for (;;)
{
return 0;
if (flags & 0x0008)
break;
if (!(size -= 7))
continue;
{
msg = "unexpected EOF";
break;
}
if (type != 0x74)
{
break;
continue;
}
return -1;
if (flags & 0x0100)
{
}
i = 0;
if (flags & 0x0004)
i += sfsprintf(ar->method, sizeof(ar->method), "crypt-rar-%u%s+SIZE=%I*u|", buf[17], ar->solid ? "-RETAIN" : "", sizeof(f->st->st_size), f->st->st_size);
else
i += sfsprintf(ar->method + i, sizeof(ar->method) - i, "rar-%u%s+SIZE=%I*u", buf[17], ar->solid ? "-RETAIN" : "", sizeof(f->uncompressed), f->uncompressed);
f->name[i] = 0;
f->linkpath = 0;
{
if (i & 0x10)
else if (i & 0x01)
else
{
if ((s = strrchr(f->name, '.')) && (s[1]=='e' || s[1]=='E') && (s[1]=='x' || s[1]=='X') && (s[1]=='e' || s[1]=='E'))
}
}
{
else
{
else
}
}
return 1;
}
}
static int
{
ssize_t n;
int r;
int pop;
return 1;
r = -1;
r = 1;
{
else
{
for (;;)
{
{
break;
}
else if (n == 0)
{
r = 1;
break;
}
break;
}
}
}
{
(*pax->errorf)(NiL, pax, 2, "%s: %s: cannot seek past %s format data", ap->name, f->name, ap->format->name);
r = -1;
}
return r;
}
{
"rar",
0,
"rar archive",
0,
0,
0,
};