/***********************************************************************
* *
* 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 lha format
*/
#include <paxlib.h>
#include <codex.h>
#include <ctype.h>
#include <swap.h>
#include <tm.h>
typedef struct Ar_s
{
unsigned short checksum;
unsigned char check;
unsigned char system;
unsigned char minor_version;
} Ar_t;
static int
lha_method(register unsigned char* s)
{
}
static int
{
if (!ar)
return -1;
return 0;
}
static int
lha_getprologue(Pax_t* pax, Paxformat_t* fp, register Paxarchive_t* ap, Paxfile_t* f, unsigned char* buf, size_t size)
{
int n;
int h;
int i;
return 0;
for (h = 0, i = 2; i < n; i++)
h += buf[i];
return 0;
{
if (ar)
return paxnospace(pax);
}
return 1;
}
static int
{
register unsigned char* hdr;
char* s;
unsigned long dostime;
long n;
int h;
int i;
int mode;
if (paxread(pax, ap, ss, sizeof(ss), 0, 0) != sizeof(ss) || !(hdr = paxget(pax, ap, n = ss[0], NiL)) || lha_method(hdr))
return 0;
for (h = 0, i = 0; i < n; i++)
h += hdr[i];
i = hdr[19];
f->name[i] = 0;
hdr += i + 20;
n -= i;
if (n >= 24)
{
hdr += 4;
}
else if (n == 22)
{
hdr += 2;
}
else if (n == 20)
{
}
else
n = 7;
n += sfsprintf(ar->method + n, sizeof(ar->method) - n, "+SIZE=%I*u", sizeof(f->uncompressed), f->uncompressed);
{
}
else
{
if (mode & 0x10)
else if (mode & 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'))
}
}
f->linkpath = 0;
return 1;
}
static int
{
ssize_t n;
int r;
int pop;
return 1;
r = -1;
if (fd < 0)
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;
}
{
"lha",
"lharc",
"lha archive",
0,
0,
0,
};