/***********************************************************************
* *
* 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 vdb format
*/
#include "format.h"
#include <vdb.h>
typedef struct Vdb_s
{
struct
{
} header;
} Vdb_t;
static int
vdb_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 i;
off_t n;
return 0;
if (size < n)
return 0;
s = (char*)buf;
if (s[0] != VDB_DELIMITER || !strneq(s + 1, VDB_MAGIC, sizeof(VDB_MAGIC) - 1) || s[sizeof(VDB_MAGIC)] != VDB_DELIMITER)
return 0;
{
s[n] = 0;
if (t = strchr(s, '\n'))
*t = 0;
}
return 0;
return 0;
if (!vdb)
{
nospace();
}
goto nope;
nospace();
goto nope;
goto nope;
goto nope;
goto nope;
return 1;
nope:
return 0;
}
static int
{
if (vdb)
{
}
return 0;
}
static int
{
char* s;
char* t;
off_t n;
goto eof;
f->name = t;
goto eof;
*t++ = 0;
n = strtol(t, &t, 10);
goto eof;
goto eof;
{
*s++ = 0;
} while (t = s);
f->linkpath = 0;
f->uidname = 0;
f->gidname = 0;
return 1;
eof:
return 0;
}
static int
{
if (!vdb)
{
nospace();
}
if (append)
return 0;
return 1;
}
static int
{
register unsigned char* s;
register int c;
int n;
else
{
}
{
c = VDB_DELIMITER;
n = 1024;
if (f->fd >= 0)
{
if (n > 0)
{
int dp;
int ds;
int mp = 0;
int ms = 0;
/*
* to determine the delimiter, if any
*/
while (--n > 0)
hit[*(s + n)]++;
for (n = 0; n <= UCHAR_MAX; n++)
if (n == '_' || n == '/' || n == '.' || n == '\n' || n == '\\')
/* nop */;
else if (isspace(n))
{
{
ds = n;
}
}
{
dp = n;
}
if (mp)
c = dp;
else if (ms)
c = ds;
}
}
}
n = (c == '=') ? ':' : '=';
sfprintf(vdb->directory, "%c%s%c%I*u%c%I*u%c%s%c%I*u%c%s%c0%o\n", c, f->name, c, sizeof(ap->io->offset), ap->io->offset + ap->io->count, c, sizeof(f->st->st_size), f->st->st_size, c, VDB_DATE, n, sizeof(f->st->st_mtime), f->st->st_mtime, c, VDB_MODE, n, modex(f->st->st_mode & X_IPERM));
return 1;
}
static int
{
return 0;
}
static off_t
{
sfprintf(vdb->directory, "%c%s%c%0*I*d%c%0*I*d\n", VDB_DELIMITER, VDB_DIRECTORY, VDB_DELIMITER, VDB_FIXED, sizeof(ap->io->offset), ap->io->offset + ap->io->count + sizeof(VDB_DIRECTORY), VDB_DELIMITER, VDB_FIXED, sizeof(Sfoff_t), sftell(vdb->directory) - sizeof(VDB_DIRECTORY) + VDB_LENGTH + 1);
}
{
"vdb",
0,
"virtual database",
0,
0,
0,
0,
0,
0,
0,
};