/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1987-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 mime format
*/
#include "format.h"
typedef struct Mime_s
{
} Mime_t;
static int
mime_getprologue(Pax_t* pax, Format_t* fp, register Archive_t* ap, File_t* f, unsigned char* buf, size_t size)
{
char* s;
char* t;
size_t n;
return 0;
if (s[0] != '-' || s[1] != '-' || !(t = (char*)memchr(s, '\n', MIME_HEADER - 2)) || (t - s + 8) >= MIME_HEADER || strncasecmp(t + 1, "Content", 7))
return 0;
n = t - s + 1;
if (t > s && *(t - 1) == '\r')
t--;
n = t - s;
{
nospace();
return -1;
}
return 1;
}
static int
{
{
}
return 0;
}
static int
{
register char* s;
register char* t;
register char* v;
off_t m;
off_t b;
size_t n;
int loop;
if (paxread(pax, ap, s = state.tmp.buffer, mime->length + 2, mime->length + 2, 1) <= 0 || memcmp(s, mime->magic, mime->length))
{
return 0;
}
else if (*s == '\n')
else if (*s != '\r' && *(s + 1) != '\n')
error(3, "%s: corrupt %s format member header -- separator line not found", ap->name, ap->format->name);
f->name = 0;
for (;;)
{
else if (*s == '\n')
{
s--;
*s = 0;
break;
}
if (!*s)
break;
if (t = strchr(s, ':'))
s = t + 1;
while (isspace(*s))
s++;
for (;;)
{
for (t = s; *s && *s != ';' && *s != '='; s++);
if (!(n = s - t))
break;
if (*s == '=')
{
if (*++s == '"')
for (v = ++s; *s && *s != '"'; s++);
else
for (v = s; *s && *s != ';'; s++);
}
else
v = s;
m = s - v;
if (*s)
*s++ = 0;
for (; *s == ';' || isspace(*s); s++);
}
}
if (!f->name)
{
s++;
else
}
loop = 0;
{
{
if (loop++)
continue;
}
v = s;
{
if (s > v && *(s - 1) == '\n')
{
if (s > (v + 1) && *(s - 2) == '\r')
}
f->linkpath = 0;
f->uidname = 0;
f->gidname = 0;
return 1;
}
}
return 0;
}
{
"mime",
0,
"encapsulated mime",
0,
0,
0,
};