aboutsummaryrefslogtreecommitdiff
path: root/src/lzma/help.c
blob: 2e59f3b5775e5199a5b558840fa4e9a986252063 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
///////////////////////////////////////////////////////////////////////////////
//
/// \file       help.c
/// \brief      Help messages
//
//  Copyright (C) 2007 Lasse Collin
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
///////////////////////////////////////////////////////////////////////////////

#include "private.h"


extern void
show_try_help(void)
{
	// Print this with V_WARNING instead of V_ERROR to prevent it from
	// showing up when --quiet has been specified.
	errmsg(V_WARNING, _("Try `%s --help' for more information."), argv0);
	return;
}


extern void lzma_attribute((noreturn))
show_help(void)
{
	printf(_("Usage: %s [OPTION]... [FILE]...\n"
			"Compress or decompress FILEs in the .lzma format.\n"
			"\n"), argv0);

	puts(_("Mandatory arguments to long options are mandatory for "
			"short options too.\n"));

	puts(_(
" Operation mode:\n"
"\n"
"  -z, --compress      force compression\n"
"  -d, --decompress    force decompression\n"
"  -t, --test          test compressed file integrity\n"
"  -l, --list          list information about files\n"
));

	puts(_(
" Operation modifiers:\n"
"\n"
"  -k, --keep          keep (don't delete) input files\n"
"  -f, --force         force overwrite of output file and (de)compress links\n"
"  -c, --stdout        write to standard output and don't delete input files\n"
"  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
"  -F, --format=FMT    file format to encode or decode; possible values are\n"
"                      `auto' (default), `xz', `lzma', and `raw'\n"
"      --files=[FILE]  read filenames to process from FILE; if FILE is\n"
"                      omitted, filenames are read from the standard input;\n"
"                      filenames must be terminated with the newline character\n"
"      --files0=[FILE] like --files but use the nul byte as terminator\n"
));

	puts(_(
" Compression presets and basic compression options:\n"
"\n"
"  -1 .. -2            fast compression\n"
"  -3 .. -6            good compression\n"
"  -7 .. -9            excellent compression, but needs a lot of memory;\n"
"                      default is -7 if memory limit allows\n"
"\n"
"  -C, --check=CHECK   integrity check type: `crc32', `crc64' (default),\n"
"                      or `sha256'\n"
));

	puts(_(
" Custom filter chain for compression (alternative for using presets):\n"
"\n"
"  --lzma1=[OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
"  --lzma2=[OPTS]      more of the following options (valid values; default):\n"
"                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
"                        lc=NUM     number of literal context bits (0-4; 3)\n"
"                        lp=NUM     number of literal position bits (0-4; 0)\n"
"                        pb=NUM     number of position bits (0-4; 2)\n"
"                        mode=MODE  compression mode (fast, normal; normal)\n"
"                        nice=NUM   nice length of a match (2-273; 64)\n"
"                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
"                        depth=NUM  maximum search depth; 0=automatic (default)\n"
"\n"
"  --x86               x86 filter (sometimes called BCJ filter)\n"
"  --powerpc           PowerPC (big endian) filter\n"
"  --ia64              IA64 (Itanium) filter\n"
"  --arm               ARM filter\n"
"  --armthumb          ARM-Thumb filter\n"
"  --sparc             SPARC filter\n"
"\n"
"  --delta=[OPTS]      Delta filter; valid OPTS (valid values; default):\n"
"                        dist=NUM   distance between bytes being subtracted\n"
"                                   from each other (1-256; 1)\n"
"\n"
"  --subblock=[OPTS]   Subblock filter; valid OPTS (valid values; default):\n"
"                        size=NUM   number of bytes of data per subblock\n"
"                                   (1 - 256Mi; 4Ki)\n"
"                        rle=NUM    run-length encoder chunk size (0-256; 0)\n"
));

	puts(_(
" Resource usage options:\n"
"\n"
"  -M, --memory=NUM    use roughly NUM bytes of memory at maximum\n"
"  -T, --threads=NUM   use a maximum of NUM (de)compression threads\n"
// "      --threading=STR threading style; possible values are `auto' (default),\n"
// "                      `files', and `stream'
));

	puts(_(
" Other options:\n"
"\n"
"  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
"  -v, --verbose       be verbose; specify twice for even more verbose\n"
"\n"
"  -h, --help          display this help and exit\n"
"  -V, --version       display version and license information and exit\n"));

	puts(_("With no FILE, or when FILE is -, read standard input.\n"));

	size_t mem_limit = opt_memory / (1024 * 1024);
	if (mem_limit == 0)
		mem_limit = 1;

	// We use PRIu64 instead of %zu to support pre-C99 libc.
	puts(_("On this system and configuration, the tool will use"));
	printf(_("  * roughly %" PRIu64 " MiB of memory at maximum; and\n"),
			(uint64_t)(mem_limit));
	printf(N_("  * at maximum of one thread for (de)compression.\n\n",
		"  * at maximum of %" PRIu64
		" threads for (de)compression.\n\n",
		(uint64_t)(opt_threads)), (uint64_t)(opt_threads));

	printf(_("Report bugs to <%s> (in English or Finnish).\n"),
			PACKAGE_BUGREPORT);

	my_exit(SUCCESS);
}


extern void lzma_attribute((noreturn))
show_version(void)
{
	printf(
"lzma (LZMA Utils) " PACKAGE_VERSION "\n"
"\n"
"Copyright (C) 1999-2008 Igor Pavlov\n"
"Copyright (C) 2007-2008 Lasse Collin\n"
"\n"
"This program is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 2 of the License, or\n"
"(at your option) any later version.\n"
"\n"
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
"GNU General Public License for more details.\n"
"\n");
	my_exit(SUCCESS);
}