* This program un-does what "strfile" makes, thereby obtaining the
* original file again. This can be invoked with the name of the output
* file, the input file, or both. If invoked with only a single argument
* ending in ".dat", it is pressumed to be the input file and the output
* file will be the same stripped of the ".dat". If the single argument
* doesn't end in ".dat", then it is presumed to be the output file, and
* the input file is that name prepended by a ".dat". If both are given
* they are treated literally as the input and output files.
* Ken Arnold Aug 13, 1978
char infile
[50], /* name of input file */
outfile
[50], /* name of output file */
STRFILE tbl
; /* description table */
if ((inf
= fopen(infile
, "r")) == NULL
) {
fread(&tbl
,sizeof tbl
,1,inf
);
if ((seekpts
= calloc(sizeof *seekpts
, nstr
)) == NULL
) {
fread(seekpts
, (sizeof seekpts
[0]), nstr
, inf
);
if ((outf
= fopen(outfile
, "w")) == NULL
) {
while ((c
= getc(inf
)) != EOF
)
if (ftell(inf
) == tbl
.str_delims
[delim
]) {
printf("usage: %s datafile[.dat] [ outfile ]\n",av
[0]);
if ((sp
= rindex(av
[1])) && strcmp(sp
, ".dat") == 0)
outfile
[strlen(outfile
) - 4] = '\0';