diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f8d55ad..f800396d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1933,6 +1933,8 @@ if(XZ_TOOL_LZMAINFO AND HAVE_DECODERS) src/common/sysdefs.h src/common/tuklib_common.h src/common/tuklib_config.h + src/common/tuklib_mbstr_nonprint.c + src/common/tuklib_mbstr_nonprint.h src/common/tuklib_exit.c src/common/tuklib_exit.h src/common/tuklib_gettext.h @@ -1957,6 +1959,7 @@ if(XZ_TOOL_LZMAINFO AND HAVE_DECODERS) endif() tuklib_progname(lzmainfo) + tuklib_mbstr(lzmainfo) # NOTE: The translations are in the "xz" domain and the .mo files are # installed as part of the "xz" target. diff --git a/src/lzmainfo/Makefile.am b/src/lzmainfo/Makefile.am index 9a5bc68b..3b0d2239 100644 --- a/src/lzmainfo/Makefile.am +++ b/src/lzmainfo/Makefile.am @@ -6,6 +6,7 @@ bin_PROGRAMS = lzmainfo lzmainfo_SOURCES = \ lzmainfo.c \ ../common/tuklib_progname.c \ + ../common/tuklib_mbstr_nonprint.c \ ../common/tuklib_exit.c if COND_W32 diff --git a/src/lzmainfo/lzmainfo.c b/src/lzmainfo/lzmainfo.c index b83d286a..e94b26fa 100644 --- a/src/lzmainfo/lzmainfo.c +++ b/src/lzmainfo/lzmainfo.c @@ -17,6 +17,7 @@ #include "getopt.h" #include "tuklib_gettext.h" #include "tuklib_progname.h" +#include "tuklib_mbstr_nonprint.h" #include "tuklib_exit.h" #ifdef TUKLIB_DOSLIKE @@ -108,7 +109,8 @@ lzmainfo(const char *name, FILE *f) uint8_t buf[13]; const size_t size = fread(buf, 1, sizeof(buf), f); if (size != 13) { - fprintf(stderr, "%s: %s: %s\n", progname, name, + fprintf(stderr, "%s: %s: %s\n", progname, + tuklib_mask_nonprint(name), ferror(f) ? strerror(errno) : _("File is too small to be a .lzma file")); return true; @@ -122,7 +124,8 @@ lzmainfo(const char *name, FILE *f) break; case LZMA_OPTIONS_ERROR: - fprintf(stderr, "%s: %s: %s\n", progname, name, + fprintf(stderr, "%s: %s: %s\n", progname, + tuklib_mask_nonprint(name), _("Not a .lzma file")); return true; @@ -146,7 +149,7 @@ lzmainfo(const char *name, FILE *f) // this output and we don't want to break that when people move // from LZMA Utils to XZ Utils. if (f != stdin) - printf("%s\n", name); + printf("%s\n", tuklib_mask_nonprint(name)); printf("Uncompressed size: "); if (uncompressed_size == UINT64_MAX) @@ -204,9 +207,10 @@ main(int argc, char **argv) if (f == NULL) { ret = EXIT_FAILURE; fprintf(stderr, "%s: %s: %s\n", - progname, - argv[optind], - strerror(errno)); + progname, + tuklib_mask_nonprint( + argv[optind]), + strerror(errno)); continue; }