summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-05 12:14:43 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-05 12:14:43 -0800
commitc52082c6e4811958dd741d67e1178b4e36a09923 (patch)
tree00c2155f76040b27c1217916ab03df5b8696da6d /src
parent77e3b389eb92b8d8f94f5b83c1d3d7cd4db5b037 (diff)
open-zfile: Make compress & uncompress commands optional
If compress is not found, we disable writing to .Z files, but leave the rest of the compression code active. If uncompress is not found, we use gzip to read .Z files. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r--src/RdFToI.c4
-rw-r--r--src/WrFFrI.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/RdFToI.c b/src/RdFToI.c
index 141c485..a16af88 100644
--- a/src/RdFToI.c
+++ b/src/RdFToI.c
@@ -246,7 +246,11 @@ OpenReadFile(
if ( ext && !strcmp(ext, ".Z") )
{
mdata->type = XPMPIPE;
+#ifdef XPM_PATH_UNCOMPRESS
mdata->stream.file = xpmPipeThrough(fd, XPM_PATH_UNCOMPRESS, "-c", "r");
+#else
+ mdata->stream.file = xpmPipeThrough(fd, XPM_PATH_GZIP, "-dqc", "r");
+#endif
}
else if ( ext && !strcmp(ext, ".gz") )
{
diff --git a/src/WrFFrI.c b/src/WrFFrI.c
index d59098f..234197a 100644
--- a/src/WrFFrI.c
+++ b/src/WrFFrI.c
@@ -342,7 +342,11 @@ OpenWriteFile(
#ifndef NO_ZPIPE
len = strlen(filename);
if (len > 2 && !strcmp(".Z", filename + (len - 2))) {
+#ifdef XPM_PATH_COMPRESS
mdata->stream.file = xpmPipeThrough(fd, XPM_PATH_COMPRESS, NULL, "w");
+#else
+ mdata->stream.file = NULL;
+#endif
mdata->type = XPMPIPE;
} else if (len > 3 && !strcmp(".gz", filename + (len - 3))) {
mdata->stream.file = xpmPipeThrough(fd, XPM_PATH_GZIP, "-q", "w");