]> icculus.org git repositories - icculus/xz.git/blob - src/lzma/help.c
2e59f3b5775e5199a5b558840fa4e9a986252063
[icculus/xz.git] / src / lzma / help.c
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       help.c
4 /// \brief      Help messages
5 //
6 //  Copyright (C) 2007 Lasse Collin
7 //
8 //  This program is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU Lesser General Public
10 //  License as published by the Free Software Foundation; either
11 //  version 2.1 of the License, or (at your option) any later version.
12 //
13 //  This program is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //  Lesser General Public License for more details.
17 //
18 ///////////////////////////////////////////////////////////////////////////////
19
20 #include "private.h"
21
22
23 extern void
24 show_try_help(void)
25 {
26         // Print this with V_WARNING instead of V_ERROR to prevent it from
27         // showing up when --quiet has been specified.
28         errmsg(V_WARNING, _("Try `%s --help' for more information."), argv0);
29         return;
30 }
31
32
33 extern void lzma_attribute((noreturn))
34 show_help(void)
35 {
36         printf(_("Usage: %s [OPTION]... [FILE]...\n"
37                         "Compress or decompress FILEs in the .lzma format.\n"
38                         "\n"), argv0);
39
40         puts(_("Mandatory arguments to long options are mandatory for "
41                         "short options too.\n"));
42
43         puts(_(
44 " Operation mode:\n"
45 "\n"
46 "  -z, --compress      force compression\n"
47 "  -d, --decompress    force decompression\n"
48 "  -t, --test          test compressed file integrity\n"
49 "  -l, --list          list information about files\n"
50 ));
51
52         puts(_(
53 " Operation modifiers:\n"
54 "\n"
55 "  -k, --keep          keep (don't delete) input files\n"
56 "  -f, --force         force overwrite of output file and (de)compress links\n"
57 "  -c, --stdout        write to standard output and don't delete input files\n"
58 "  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
59 "  -F, --format=FMT    file format to encode or decode; possible values are\n"
60 "                      `auto' (default), `xz', `lzma', and `raw'\n"
61 "      --files=[FILE]  read filenames to process from FILE; if FILE is\n"
62 "                      omitted, filenames are read from the standard input;\n"
63 "                      filenames must be terminated with the newline character\n"
64 "      --files0=[FILE] like --files but use the nul byte as terminator\n"
65 ));
66
67         puts(_(
68 " Compression presets and basic compression options:\n"
69 "\n"
70 "  -1 .. -2            fast compression\n"
71 "  -3 .. -6            good compression\n"
72 "  -7 .. -9            excellent compression, but needs a lot of memory;\n"
73 "                      default is -7 if memory limit allows\n"
74 "\n"
75 "  -C, --check=CHECK   integrity check type: `crc32', `crc64' (default),\n"
76 "                      or `sha256'\n"
77 ));
78
79         puts(_(
80 " Custom filter chain for compression (alternative for using presets):\n"
81 "\n"
82 "  --lzma1=[OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
83 "  --lzma2=[OPTS]      more of the following options (valid values; default):\n"
84 "                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
85 "                        lc=NUM     number of literal context bits (0-4; 3)\n"
86 "                        lp=NUM     number of literal position bits (0-4; 0)\n"
87 "                        pb=NUM     number of position bits (0-4; 2)\n"
88 "                        mode=MODE  compression mode (fast, normal; normal)\n"
89 "                        nice=NUM   nice length of a match (2-273; 64)\n"
90 "                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
91 "                        depth=NUM  maximum search depth; 0=automatic (default)\n"
92 "\n"
93 "  --x86               x86 filter (sometimes called BCJ filter)\n"
94 "  --powerpc           PowerPC (big endian) filter\n"
95 "  --ia64              IA64 (Itanium) filter\n"
96 "  --arm               ARM filter\n"
97 "  --armthumb          ARM-Thumb filter\n"
98 "  --sparc             SPARC filter\n"
99 "\n"
100 "  --delta=[OPTS]      Delta filter; valid OPTS (valid values; default):\n"
101 "                        dist=NUM   distance between bytes being subtracted\n"
102 "                                   from each other (1-256; 1)\n"
103 "\n"
104 "  --subblock=[OPTS]   Subblock filter; valid OPTS (valid values; default):\n"
105 "                        size=NUM   number of bytes of data per subblock\n"
106 "                                   (1 - 256Mi; 4Ki)\n"
107 "                        rle=NUM    run-length encoder chunk size (0-256; 0)\n"
108 ));
109
110         puts(_(
111 " Resource usage options:\n"
112 "\n"
113 "  -M, --memory=NUM    use roughly NUM bytes of memory at maximum\n"
114 "  -T, --threads=NUM   use a maximum of NUM (de)compression threads\n"
115 // "      --threading=STR threading style; possible values are `auto' (default),\n"
116 // "                      `files', and `stream'
117 ));
118
119         puts(_(
120 " Other options:\n"
121 "\n"
122 "  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
123 "  -v, --verbose       be verbose; specify twice for even more verbose\n"
124 "\n"
125 "  -h, --help          display this help and exit\n"
126 "  -V, --version       display version and license information and exit\n"));
127
128         puts(_("With no FILE, or when FILE is -, read standard input.\n"));
129
130         size_t mem_limit = opt_memory / (1024 * 1024);
131         if (mem_limit == 0)
132                 mem_limit = 1;
133
134         // We use PRIu64 instead of %zu to support pre-C99 libc.
135         puts(_("On this system and configuration, the tool will use"));
136         printf(_("  * roughly %" PRIu64 " MiB of memory at maximum; and\n"),
137                         (uint64_t)(mem_limit));
138         printf(N_("  * at maximum of one thread for (de)compression.\n\n",
139                 "  * at maximum of %" PRIu64
140                 " threads for (de)compression.\n\n",
141                 (uint64_t)(opt_threads)), (uint64_t)(opt_threads));
142
143         printf(_("Report bugs to <%s> (in English or Finnish).\n"),
144                         PACKAGE_BUGREPORT);
145
146         my_exit(SUCCESS);
147 }
148
149
150 extern void lzma_attribute((noreturn))
151 show_version(void)
152 {
153         printf(
154 "lzma (LZMA Utils) " PACKAGE_VERSION "\n"
155 "\n"
156 "Copyright (C) 1999-2008 Igor Pavlov\n"
157 "Copyright (C) 2007-2008 Lasse Collin\n"
158 "\n"
159 "This program is free software; you can redistribute it and/or modify\n"
160 "it under the terms of the GNU General Public License as published by\n"
161 "the Free Software Foundation; either version 2 of the License, or\n"
162 "(at your option) any later version.\n"
163 "\n"
164 "This program is distributed in the hope that it will be useful,\n"
165 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
166 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
167 "GNU General Public License for more details.\n"
168 "\n");
169         my_exit(SUCCESS);
170 }