home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * UNIX_COMP.C
- *
- * compress a file source to a destination file pointer, used by
- * BATCHNEWS.
- *
- * This differs from COMP.C in that the AmigaUUCP ulog() call is not
- * used.
- */
-
- #define LOGERROR
- #define NO_ULOG
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "config.h"
-
- Prototype int unix_compress_from_file(char *, FILE *, short);
- Prototype int unix_compress_from_fp(FILE *, FILE *, short);
- Prototype int unix_uncompress_to_file(FILE *, char *, short *);
- Prototype int unix_uncompress_to_fp(FILE *, FILE *, short *);
-
- int
- unix_compress_from_file (char *inName, FILE *fo, short bits)
- {
- FILE *fi;
- int r = -1;
-
- if (initcomp(NULL, fo, bits, 0, 0) >= 0) {
- if (fi = fopen(inName, "r")) {
- r = compress(fo, fo);
- fclose(fi);
- }
- }
- deletecomp();
- return r;
- }
-
- int
- unix_compress_from_fp (FILE *fi, FILE *fo, short bits)
- {
- int r = -1;
-
- if (initcomp(NULL, fo, bits, 0, 0) >= 0) {
- r = compress(fi, fo);
- }
- deletecomp();
- return r;
- }
-
- int
- unix_uncompress_to_file (FILE *fi, char *outName, short *pbits)
- {
- FILE *fo;
- int r = -1;
-
- if (initcomp(fi, NULL, 0, 0, 0) >= 0) {
- if (fo = fopen(outName, "w")) {
- r = decompress(fi, fo, pbits);
- fclose(fo);
- }
- }
- deletecomp();
- return r;
- }
-
- int
- unix_uncompress_to_fp (FILE *fi, FILE *fo, short *pbits)
- {
- int r = -1;
-
- if (initcomp(fi, NULL, 0, 0, 0) >= 0) {
- r = decompress(fi, fo, pbits);
- }
- deletecomp();
- return r;
- }
-