From patchwork Mon Sep 3 17:33:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10586255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04CD414E0 for ; Mon, 3 Sep 2018 17:44:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E11F228BF1 for ; Mon, 3 Sep 2018 17:44:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D26FD292C6; Mon, 3 Sep 2018 17:44:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49D6328BF1 for ; Mon, 3 Sep 2018 17:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727289AbeICWFJ (ORCPT ); Mon, 3 Sep 2018 18:05:09 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:33576 "EHLO laurent.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729986AbeICVye (ORCPT ); Mon, 3 Sep 2018 17:54:34 -0400 Received: from ramsan.of.borg ([84.194.111.163]) by laurent.telenet-ops.be with bizsmtp id X5ZQ1y00D3XaVaC015ZQqT; Mon, 03 Sep 2018 19:33:24 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1fwsj6-0001Al-7M; Mon, 03 Sep 2018 19:33:24 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1fwsj6-0001wh-5Z; Mon, 03 Sep 2018 19:33:24 +0200 From: Geert Uytterhoeven To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] spi: spidev_test: Improve decoded text part of hex dump Date: Mon, 3 Sep 2018 19:33:23 +0200 Message-Id: <20180903173323.7436-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - Print spaces as spaces, - Do not print characters > 126, as they will be shown as garbage in the modern UTF-8 era, - Use a normal period instead of its hexadecimal ASCII value, - Delimit the text part with pipe symbols on both sides (was left side only), without any spaces, to make it clear where the decoded text starts and ends, - Drop a useless comment. Signed-off-by: Geert Uytterhoeven --- tools/spi/spidev_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/spi/spidev_test.c b/tools/spi/spidev_test.c index 8c590cd1171a99c2..4c12e6aea5d5d0d1 100644 --- a/tools/spi/spidev_test.c +++ b/tools/spi/spidev_test.c @@ -73,12 +73,12 @@ static void hex_dump(const void *src, size_t length, size_t line_size, while (i++ % line_size) printf("__ "); } - printf(" | "); /* right close */ + printf(" |"); while (line < address) { c = *line++; - printf("%c", (c < 33 || c == 255) ? 0x2E : c); + printf("%c", (c < 32 || c > 126) ? '.' : c); } - printf("\n"); + printf("|\n"); if (length > 0) printf("%s | ", prefix); }