home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
misc
/
volume17
/
freeze
/
part02
/
decode.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-25
|
1KB
|
62 lines
#include "freeze.h"
/*
* Melt stdin to stdout.
*/
melt ()
{
register short i, j, k, n, r, c;
#ifdef COMPAT
if(new_flg)
#endif
if(read_header() == EOF)
return;
StartHuff();
n = N;
for (i = 0; i < n - F; i++)
text_buf[i] = ' ';
r = n - F;
n --; /* array size --> mask */
for (in_count = 0;; ) {
c =
#ifdef COMPAT
new_flg ? DecodeChar() : DecodeCOld();
#else
DecodeChar();
#endif
if (c == ENDOF)
break;
if (c < 256) {
putchar (c);
text_buf[r++] = c;
r &= n;
in_count++;
} else {
i = (r -
#ifdef COMPAT
(new_flg ? DecodePosition() : DecodePOld())
#else
DecodePosition()
#endif
- 1) & n;
j = c - 256 + THRESHOLD;
for (k = 0; k < j; k++) {
c = text_buf[(i + k) & n];
putchar (c);
text_buf[r++] = c;
r &= n;
in_count++;
}
}
if (!quiet && (in_count > indicator_count)) {
fprintf(stderr, "%5dK\b\b\b\b\b\b", in_count / 1024);
fflush (stderr);
indicator_count += indicator_threshold;
indicator_threshold += 1024;
}
}
}