]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
lzmainfo: Use tuklib_mbstr_nonprint
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 18 Dec 2024 12:00:09 +0000 (14:00 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 18 Dec 2024 15:09:32 +0000 (17:09 +0200)
CMakeLists.txt
src/lzmainfo/Makefile.am
src/lzmainfo/lzmainfo.c

index 1f8d55ade741ad1d65be5e0f129495b10686a091..f800396d6875456696d9935bc13928354dda5532 100644 (file)
@@ -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.
index 9a5bc68b39cd3b976363876b34e1e82c7dfb9377..3b0d22391d9a2a2b7fa12b98169d20f6fac53130 100644 (file)
@@ -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
index b83d286ab7e779ad55b9d72a2a9f9f7564070be0..e94b26fae082f1b425a2bfb3e1469f26f1cfc905 100644 (file)
@@ -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;
                                }