home *** CD-ROM | disk | FTP | other *** search
- /*
- * COMP.C
- *
- * compress a file source to a destination file pointer, used by
- * BATCHNEWS.
- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "config.h"
-
- Prototype int compress_from_file(char *, FILE *, short);
- Prototype int compress_from_fp(FILE *, FILE *, short);
-
- int
- compress_from_file (char *inName, FILE *fo, short bits)
- {
- FILE *fi;
- int r = -1;
-
- if (initcomp(NULL, fo, bits, 1, 0) >= 0) {
- if (fi = fopen(inName, "r")) {
- r = compress(fi, fo);
- fclose(fi);
- }
- }
- deletecomp();
- return(r);
- }
-
- int
- compress_from_fp (FILE *fi, FILE *fo, short bits)
- {
- int r = -1;
-
- if (initcomp(NULL, fo, bits, 1, 0) >= 0) {
- r = compress(fi, fo);
- }
- deletecomp();
- return(r);
- }
-