home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / MISC / READER / ZVR.ZIP / DECOMP.C next >
Encoding:
C/C++ Source or Header  |  1995-03-27  |  518 b   |  28 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void)
  5. {
  6.    unsigned char line[1000];
  7.    unsigned char *def[256];
  8.    int i;
  9.    gets(line);
  10.    if (strcmp(line, "!!Compressed!!")) {
  11.       printf("not a compressed file\n");
  12.       exit(EXIT_FAILURE);
  13.    }
  14.    for (i=1; i<256; i++) {
  15.       gets(line);
  16.       if (*line == 0) {
  17.      line[0] = i;
  18.      line[1] = 0;
  19.       }
  20.       def[i] = strdup(line);
  21.    }
  22.    while (gets(line)) {
  23.       unsigned char *s = line;
  24.       while (*s) printf("%s", def[*s++]);
  25.       putchar('\n');
  26.    }
  27. }
  28.