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>2016-06-28 21:09:46 +0300
commit2296778f3c9a1e3a8699973b09dd3610b8baa402 (patch)
tree3055efca9963794a43a86503d3ffe12a398c4b98 /src/xz/main.c
parentBuild: Build LZMA1/2 presets also when only decoder is wanted. (diff)
downloadxz-2296778f3c9a1e3a8699973b09dd3610b8baa402.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 'src/xz/main.c')
-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 5608229d..c2465cf9 100644
--- a/src/xz/main.c
+++ b/src/xz/main.c
@@ -207,8 +207,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.
@@ -267,6 +270,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.
@@ -274,6 +278,7 @@ main(int argc, char **argv)
assert(!user_abort);
list_totals();
}
+#endif
#ifndef NDEBUG
coder_free();