home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / duucp-1.17 / AU-117b4-src.lha / src / lib / uncomp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-27  |  719 b   |  43 lines

  1.  
  2. /*
  3.  *  UNCOMP.C
  4.  *
  5.  *  uncompress a file pointer into a file destination.
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include "config.h"
  12.  
  13. Prototype int uncompress_to_file(FILE *, char *);
  14. Prototype int uncompress_to_fp(FILE *, FILE *);
  15.  
  16. int
  17. uncompress_to_file (FILE *fi, char *outName)
  18. {
  19.     FILE *fo;
  20.     int r = -1;
  21.  
  22.     if (initcomp(fi, NULL, 0, 1, 1) >= 0) {
  23.         if (fo = fopen(outName, "w")) {
  24.             r = decompress(fi, fo, 0);
  25.             fclose(fo);
  26.         }
  27.     }
  28.     deletecomp();
  29.     return r;
  30. }
  31.  
  32. int
  33. uncompress_to_fp (FILE *fi, FILE *fo)
  34. {
  35.     int r = -1;
  36.  
  37.     if (initcomp(fi, NULL, 0, 1, 1) >= 0) {
  38.         r = decompress(fi, fo, 0);
  39.     }
  40.     deletecomp();
  41.     return r;
  42. }
  43.