aboutsummaryrefslogtreecommitdiff
path: root/src/xz/main.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2015-11-03 20:29:33 +0200
committerLasse Collin <lasse.collin@tukaani.org>2015-11-03 20:29:33 +0200
commitcb3111e3ed84152912b5138d690c8d9f00c6ef02 (patch)
treea706e5bcb842a342b8e3290e5b961e15467ee3c8 /src/xz/main.c
parentBuild: Build LZMA1/2 presets also when only decoder is wanted. (diff)
downloadxz-cb3111e3ed84152912b5138d690c8d9f00c6ef02.tar.xz
xz: Make xz buildable even when encoders or decoders are disabled.
The patch is quite long but it's mostly about adding new #ifdefs to omit code when encoders or decoders have been disabled. This adds two new #defines to config.h: HAVE_ENCODERS and HAVE_DECODERS.
Diffstat (limited to '')
-rw-r--r--src/xz/main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/xz/main.c b/src/xz/main.c
index 5e0789ad..af550c45 100644
--- a/src/xz/main.c
+++ b/src/xz/main.c
@@ -225,8 +225,11 @@ main(int argc, char **argv)
// coder_run() handles compression, decompression, and testing.
// list_file() is for --list.
- void (*run)(const char *filename) = opt_mode == MODE_LIST
- ? &list_file : &coder_run;
+ void (*run)(const char *filename) = &coder_run;
+#ifdef HAVE_DECODERS
+ if (opt_mode == MODE_LIST)
+ run = &list_file;
+#endif
// Process the files given on the command line. Note that if no names
// were given, args_parse() gave us a fake "-" filename.
@@ -285,6 +288,7 @@ main(int argc, char **argv)
(void)fclose(args.files_file);
}
+#ifdef HAVE_DECODERS
// All files have now been handled. If in --list mode, display
// the totals before exiting. We don't have signal handlers
// enabled in --list mode, so we don't need to check user_abort.
@@ -292,6 +296,7 @@ main(int argc, char **argv)
assert(!user_abort);
list_totals();
}
+#endif
#ifndef NDEBUG
coder_free();