From 4daf22b278662721a59ccbb6ca33c8719f7f1565 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Wed, 13 Jul 2022 16:04:09 +0100 Subject: [PATCH] amidi: restore space between bytes Commit 9a8fcec ("amidi: add timestamp option for dump") removed the space between bytes when dumping MIDI, changing the output from: 90 45 40 80 45 00 to: 904540 804500 It seems that this was an unintentional side effect of refactoring the code to add the new timestamp output but the result is less readable than it was before. Restore the space between bytes in the same message. Fixes: 9a8fcec ("amidi: add timestamp option for dump") Fixes: https://github.com/alsa-project/alsa-utils/pull/158/ Signed-off-by: John Keeping Signed-off-by: Jaroslav Kysela --- amidi/amidi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/amidi/amidi.c b/amidi/amidi.c index 3d7bd0f..b7eebdf 100644 --- a/amidi/amidi.c +++ b/amidi/amidi.c @@ -433,14 +433,12 @@ static void print_byte(unsigned char byte, struct timespec *ts) fputs("\n ", stdout); } - if (newline) { - printf("\n"); - + putchar(newline ? '\n' : ' '); + if (newline && do_print_timestamp) { /* Nanoseconds does not make a lot of sense for serial MIDI (the * 31250 bps one) but I'm not sure about MIDI over USB. */ - if (do_print_timestamp) - printf("%lld.%.9ld) ", (long long)ts->tv_sec, ts->tv_nsec); + printf("%lld.%.9ld) ", (long long)ts->tv_sec, ts->tv_nsec); } printf("%02X", byte); -- 2.47.1