xxd: make -p output lines actually end with a newline
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 25 Jan 2017 16:00:38 +0000 (17:00 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 25 Jan 2017 16:00:38 +0000 (17:00 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
util-linux/hexdump_xxd.c

index cc34ea64971ac1f09862832d2b64791677bd369e..be4b4f3543ed5bbae8c4e19b424e84a6e53e19c6 100644 (file)
@@ -129,7 +129,7 @@ int xxd_main(int argc UNUSED_PARAM, char **argv)
                }
                // for -g3, this results in B B BS B B BS... B = "xxxxxx xxxxxx .....xx"
                // todo: can be more clever and use
-               // one "cols-1/B" format instead of many "B B B..." formats
+               // one 'bytes-1/1 "%02x"' format instead of many "B B B..." formats
                //bb_error_msg("ADDED:'%s'", bigbuf);
                bb_dump_add(dumper, bigbuf);
                free(bigbuf);
@@ -138,6 +138,8 @@ int xxd_main(int argc UNUSED_PARAM, char **argv)
        if (!(opt & OPT_p)) {
                sprintf(buf, "\"  \"%u/1 \"%%_p\"\"\n\"", cols); // "  ASCII\n"
                bb_dump_add(dumper, buf);
+       } else {
+               bb_dump_add(dumper, "\"\n\"");
        }
 
        return bb_dump_dump(dumper, argv);