xz: Mention lzmainfo if trying to use 'lzma --list'.

This kind of fixes the problem reported here:
https://bugs.launchpad.net/ubuntu/+source/xz-utils/+bug/1291020
This commit is contained in:
Lasse Collin 2024-02-13 14:32:47 +02:00
parent 0668907ff7
commit 8af7db854f
1 changed files with 14 additions and 2 deletions

View File

@ -1275,10 +1275,22 @@ list_totals(void)
extern void extern void
list_file(const char *filename) list_file(const char *filename)
{ {
if (opt_format != FORMAT_XZ && opt_format != FORMAT_AUTO) if (opt_format != FORMAT_XZ && opt_format != FORMAT_AUTO) {
message_fatal(_("--list works only on .xz files " // The 'lzmainfo' message is printed only when --format=lzma
// is used (it is implied if using "lzma" as the command
// name). Thus instead of using message_fatal(), print
// the messages separately and then call tuklib_exit()
// like message_fatal() does.
message(V_ERROR, _("--list works only on .xz files "
"(--format=xz or --format=auto)")); "(--format=xz or --format=auto)"));
if (opt_format == FORMAT_LZMA)
message(V_ERROR,
_("Try 'lzmainfo' with .lzma files."));
tuklib_exit(E_ERROR, E_ERROR, false);
}
message_filename(filename); message_filename(filename);
if (filename == stdin_filename) { if (filename == stdin_filename) {