/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2002-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
/*
* dss file support
*
* Glenn Fowler
* AT&T Research
*/
#include "dsshdr.h"
#include <ls.h>
#include <pzip.h>
/*
* not open for read
*/
static int
{
return -1;
}
/*
* empty input
*/
static int
{
return 0;
}
/*
* not open for write
*/
static int
{
return -1;
}
/*
* file open
*/
{
char* s;
size_t n;
int i;
if (flags & DSS_FILE_WRITE)
{
if (io)
{
{
if (n)
{
}
}
}
flags |= DSS_FILE_APPEND;
}
{
if (flags & DSS_FILE_WRITE)
{
if (io)
path = "output-stream";
else
{
}
}
else if (io)
path = "input-stream";
else
{
}
flags |= DSS_FILE_KEEP;
}
else if (io)
flags |= DSS_FILE_KEEP;
else if (flags & DSS_FILE_WRITE)
{
{
return 0;
}
}
return 0;
else
{
return 0;
}
{
if (!(flags & DSS_FILE_KEEP))
return 0;
}
if (flags & DSS_FILE_WRITE)
{
{
if (!(flags & DSS_FILE_KEEP))
return 0;
}
}
else
{
#ifdef S_ISSOCK
#endif
))
{
{
return 0;
}
if (!s)
{
return 0;
}
for (file->format = (Dssformat_t*)dtfirst(dss->meth->formats); file->format && !(i = (*file->format->identf)(file, s, n, dss->disc)); file->format = (Dssformat_t*)dtnext(dss->meth->formats, file->format));
{
return 0;
}
if (i < 0)
return 0;
{
(*dss->disc->errorf)(NiL, dss->disc, 2, "%s: %s file format %s incompatible with %s", file->path, dss->meth->name, file->format->name, format->name);
return 0;
}
(*dss->disc->errorf)(dss, dss->disc, 1, "%s: %s method %s format", file->path, dss->meth->name, file->format->name);
}
else
{
file->format = format ? format : dss->format ? dss->format : (Dssformat_t*)dtfirst(dss->meth->formats);
}
}
{
(*dss->disc->errorf)(NiL, dss->disc, 2, "%s: %s method did not set file format", file->path, dss->meth->name);
return 0;
}
{
return 0;
}
return file;
}
/*
* file close
*/
int
{
int r;
if (!file)
return -1;
r = -1;
else
{
{
r = -1;
}
r = -1;
}
return r;
}
/*
* file read
*/
{
int r;
{
if (r < 0)
return 0;
}
}
/*
* file write
*/
int
{
}
/*
* file tell
*/
{
}
/*
* file seek
*/
int
{
return (file->seekf ? (*file->seekf)(file, offset, file->dss->disc) : sfseek(file->io, offset, SEEK_SET)) == offset ? 0 : -1;
}
/*
* save record state
*/
{
return record->file->format->savef ? (*record->file->format->savef)(record->file, record, record->file->dss->disc) : (Dssrecord_t*)0;
}
/*
* drop saved record
*/
int
{
return record->file->format->dropf ? (*record->file->format->dropf)(record->file, record, record->file->dss->disc) : -1;
}
/*
* common diagnostics
*/
{
(*disc->errorf)(NiL, disc, 2, "%s: %s file format %s read not implemented", file->path, file->dss->meth->name, file->format->name);
return 0;
}
int
{
(*disc->errorf)(NiL, disc, 2, "%s: %s file format %s write not implemented", file->path, file->dss->meth->name, file->format->name);
return -1;
}
{
(*disc->errorf)(NiL, disc, 2, "%s: %s file format %s seek not implemented", file->path, file->dss->meth->name, file->format->name);
return -1;
}