fprintf(STDERR, "Parameters are from command line or one-at-a-time from standard\ninput and are output drives and input file names. Empty to quit.\n");
}
do {
fprintf(STDERR, "\n*");
for(i = 0; i < 16; ++i) {
if((c = getchar()) == EOF)
c = '\n'; /* force empty (exit) command */
if((inparg[i] = c) == '\n') {
inparg[i] = '\0';
break;
}
}
if(inparg[0] != '\0')
obey(inparg);
} while(inparg[0] != '\0');
}
dioflush(); /* clean up any directed io */
if (Sentinel != SENTINEL)
fprintf(STDERR,"out of memory: translation suspect\007\n");
}
obey(p)
char *p;
{
char *q;
if(*p == '-') {
if('n' ==tolower(p[1])) {
++nlmode; return;
}
if(ffflag = (toupper(*(p+1)) == 'F'))
++p;
/* Set number of lines of each file to view */
dispcnt = 65535; /* default */
if(*(p+1))
if((dispcnt = atoi(p + 1)) == 0)
fprintf(STDERR, "\nBAD COUNT %s", p + 1);
return;
}
if(*(p + 1) == ':') {
/* Got a drive */
if(isalpha(*p)) {
if(*(p+2) == '\0') {
/* Change output drive */
dispcnt = 0; /* cancel previewing */
printf("\nOutput drive =%s",p);
outdrv[0] = *p;
return;
}
} else {
fprintf(STDERR, "\nERROR - Ignoring %s", p);
return;
}
}
/* Check for ambiguous (wild-card) name */
for(q = p; *q != '\0'; ++q)
if(*q == '*' || *q == '?') {
fprintf(STDERR, "\nCan't accept ambiguous name %s", p);
return;
}
unsqueeze(p);
}
unsqueeze(infile)
char *infile;
{
struct _buf inbuff, outbuff; /* file buffers */
int i, c;
char cc;
char *p;
unsigned filecrc; /* checksum */
int numnodes; /* size of decoding tree */
char outfile[257]; /* output file name */
unsigned linect; /* count of number of lines previewed */
if(fopen(infile, &inbuff) == ERROR) {
fprintf(STDERR, "Can't open %s\n", infile);
return;
}
/* Initialization */
linect = 0;
crc = 0;
init_cr();
init_huff();
/* Process header */
if(getw(&inbuff) != RECOGNIZE) {
fprintf(STDERR, "%s is not a squeezed file\n", infile);
goto closein;
}
filecrc = getw(&inbuff);
/* Get original file name */
p = origname; /* send it to array */
do {
*p = getc(&inbuff);
} while(*p++ != '\0');
/* Combine with output drive */
outfile[0] = '\0'; /* empty */
strcat(outfile, outdrv); /* drive */
strcat(outfile, origname); /* name */
printf("\n%s -> %s: ", infile, outfile);
numnodes = getw(&inbuff);
if(numnodes < 0 || numnodes >= NUMVALS) {
fprintf(STDERR, "%s has invalid decode tree size\n", infile);
goto closein;
}
/* Initialize for possible empty tree (SPEOF only) */