/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2005-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
/*
* sort file io vcodex discipline
*/
static const char usage[] =
"[-1lp0s5P?\n@(#)$Id: vcodex (AT&T Research) 2008-06-06 $\n]"
"[+PLUGIN?vcodex - sort io vcodex discipline library]"
"decodes input, output and temporary file data. By default temporary and "
"output encoding is the same as the encoding used on the first encoded "
"input file. Output encoding is only applied to the standard output or "
"to files with a path suffix containing 'z'. If encoding is applied to "
"a regular output file and the output file path does not have a suffix "
"containing 'z' and the input path has a suffix containing 'z' then the "
"output path is renamed by appending the input path suffix.]"
"[i:input?Decode the input files using \amethod\a. \b--noinput\b "
"disables input encoding.]:[method]"
"[o:output?Encode the output file using \amethod\a. \b--nooutput\b "
"disables output encoding.]:[method]"
"[r:regress?Massage \bverbose\b output for regression testing.]"
"[t:temporary?Encode temporary intermediate files using "
"\amethod\a. \b--notemporary\b disables temporary encoding.]:[method]"
"[T:test?Enable test code defined by \amask\a. Test code is "
"implementation specific. Consult the source for details.]#[mask]"
"[v:verbose?Enable file and stream encoding messages on the standard "
"error.]"
"[+SEE ALSO?\bsort\b(1), \bvczip\b(1), \bvcodex\b(3)]"
"\n\n--library=vcodex[,option[=value]...]\n\n"
;
#include <ast.h>
#include <error.h>
#include <ls.h>
#include <recsort.h>
#include <vcodex.h>
struct Delay_s;
struct Delay_s
{
};
typedef struct Encoding_s
{
char* trans;
int use;
} Encoding_t;
typedef struct State_s
{
unsigned long test;
int regress;
int verbose;
} State_t;
static int
{
char* s;
}
static void
{
}
static int
{
return -1;
if (code)
if (type)
return -1;
}
static int
{
char* p;
{
{
return -1;
}
{
else
path = (const char*)p;
}
}
return 0;
}
static int
{
int i;
char* s;
error(0, "sort vcodex event %s %p %s"
: "UNKNOWN"
, data
, arg);
switch (op)
{
case RS_FILE_WRITE:
if (((Sfio_t*)data == sfstdout || zipit(arg)) && (state->output.use > 0 || !state->output.use && state->input.use > 0))
if (!state->output.use && zipit(arg) && (arg || (arg = (Void_t*)"(output-stream)")) && (delay = newof(0, Delay_t, 1, strlen(arg))))
{
}
break;
case RS_FILE_READ:
{
{
return -1;
}
else if (i > 0)
{
{
i = 0;
{
}
return i;
}
}
}
break;
case RS_TEMP_WRITE:
{
{
error(2, "temporary-%d: cannot push vcodex encode discipline (%s)", tempid(state, data), state->temporary.trans);
return -1;
}
return 1;
}
break;
case RS_TEMP_READ:
{
{
return -1;
}
{
return -1;
}
return 1;
}
break;
default:
return -1;
}
return 0;
}
{
if (options)
{
for (;;)
{
{
case 0:
break;
case 'i':
else
{
}
continue;
case 'o':
else
{
}
continue;
case 'r':
continue;
case 't':
else
{
}
continue;
case 'v':
continue;
case 'T':
continue;
case '?':
goto drop;
case ':':
goto drop;
}
break;
}
}
drop:
return 0;
}