]> icculus.org git repositories - icculus/xz.git/blob - src/lzma/help.c
Bunch of grammar fixes from meyering.
[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 block sizes, total sizes, and possible metadata\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 suffix `.SUF' on compressed files instead of `.lzma'\n"
59 "  -F, --format=FMT    file format to encode or decode; possible values are\n"
60 "                      `auto', `native', `single', `multi', and `alone'\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 "  --lzma=[OPTS]       LZMA filter; OPTS is a comma-separated list of zero or\n"
83 "                      more of the following options (valid values; default):\n"
84 "                        dict=NUM   dictionary size in bytes (1 - 1Gi; 8Mi)\n"
85 "                        lc=NUM     number of literal context bits (0-8; 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' or `best'; `best')\n"
89 "                        fb=NUM     number of fast bytes (5-273; 128)\n"
90 "                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
91 "                        mfc=NUM    match finder cycles; 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 "                        distance=NUM  Distance between bytes being\n"
102 "                                      subtracted from each other (1-256; 1)\n"
103 "\n"
104 "  --copy              No filtering (useful only when specified alone)\n"
105 "  --subblock=[OPTS]   Subblock filter; valid OPTS (valid values; default):\n"
106 "                        size=NUM    number of bytes of data per subblock\n"
107 "                                    (1 - 256Mi; 4Ki)\n"
108 "                        rle=NUM     run-length encoder chunk size (0-256; 0)\n"
109 ));
110
111 /*
112 These aren't implemented yet.
113
114         puts(_(
115 " Metadata options:\n"
116 "\n"
117 "  -N, --name          save or restore the original filename and time stamp\n"
118 "  -n, --no-name       do not save or restore filename and time stamp (default)\n"
119 "  -S, --sign=KEY      sign the data with GnuPG when compressing, or verify\n"
120 "                      the signature when decompressing\n"));
121 */
122
123         puts(_(
124 " Resource usage options:\n"
125 "\n"
126 "  -M, --memory=NUM    use roughly NUM bytes of memory at maximum\n"
127 "  -T, --threads=NUM   use a maximum of NUM (de)compression threads\n"
128 // "      --threading=STR threading style; possible values are `auto' (default),\n"
129 // "                      `files', and `stream'
130 ));
131
132         puts(_(
133 " Other options:\n"
134 "\n"
135 "  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
136 "  -v, --verbose       be verbose; specify twice for even more verbose\n"
137 "\n"
138 "  -h, --help          display this help and exit\n"
139 "  -V, --version       display version and license information and exit\n"));
140
141         puts(_("With no FILE, or when FILE is -, read standard input.\n"));
142
143         size_t mem_limit = opt_memory / (1024 * 1024);
144         if (mem_limit == 0)
145                 mem_limit = 1;
146
147         // We use PRIu64 instead of %zu to support pre-C99 libc.
148         puts(_("On this system and configuration, the tool will use"));
149         printf(_("  * roughly %" PRIu64 " MiB of memory at maximum; and\n"),
150                         (uint64_t)(mem_limit));
151         printf(N_("  * at maximum of one thread for (de)compression.\n\n",
152                 "  * at maximum of %" PRIu64
153                 " threads for (de)compression.\n\n",
154                 (uint64_t)(opt_threads)), (uint64_t)(opt_threads));
155
156         printf(_("Report bugs to <%s> (in English or Finnish).\n"),
157                         PACKAGE_BUGREPORT);
158
159         my_exit(SUCCESS);
160 }
161
162
163 extern void lzma_attribute((noreturn))
164 show_version(void)
165 {
166         printf(
167 "lzma (LZMA Utils) " PACKAGE_VERSION "\n"
168 "\n"
169 "Copyright (C) 1999-2006 Igor Pavlov\n"
170 "Copyright (C) 2007 Lasse Collin\n"
171 "\n"
172 "This program is free software; you can redistribute it and/or modify\n"
173 "it under the terms of the GNU General Public License as published by\n"
174 "the Free Software Foundation; either version 2 of the License, or\n"
175 "(at your option) any later version.\n"
176 "\n"
177 "This program is distributed in the hope that it will be useful,\n"
178 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
179 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
180 "GNU General Public License for more details.\n"
181 "\n");
182         my_exit(SUCCESS);
183 }