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

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