linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Brian Norris" <norris@broadcom.com>
To: "Artem Bityutskiy" <dedekind1@gmail.com>
Cc: linux-mtd@lists.infradead.org, Brian Norris <norris@broadcom.com>
Subject: [PATCH v2 3/6] mtd-utils/nanddump.c: Add canonical (hex+ascii) flag
Date: Mon, 19 Jul 2010 10:33:15 -0700	[thread overview]
Message-ID: <1279560796-6388-2-git-send-email-norris@broadcom.com> (raw)
In-Reply-To: <1279437819.16247.19.camel@localhost.localdomain>

Added the "-c" or "--canonicalprint" flag (modelled off 'hexdump -C')
so that users can choose to print ASCII output next to the prettyprint
output. This is really an extension to the prettyprint option, so the two
options do not conflict if they are both included in the same execution.

Signed-off-by: Brian Norris <norris@broadcom.com>
---
 nanddump.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/nanddump.c b/nanddump.c
index eccb651..cd018c6 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -45,6 +45,7 @@ static void display_help (void)
 "\n"
 "           --help               Display this help and exit\n"
 "           --version            Output version information and exit\n"
+"-c         --canonicalprint     Print canonical Hex+ASCII dump\n"
 "-f file    --file=file          Dump to file\n"
 "-i         --ignoreerrors       Ignore errors\n"
 "-l length  --length=length      Length\n"
@@ -74,7 +75,7 @@ static void display_version (void)
 // Option variables
 
 static bool		ignoreerrors = false;	// ignore errors
-static bool		pretty_print = false;	// print nice in ascii
+static bool		pretty_print = false;	// print nice
 static bool		noecc = false;		// don't error correct
 static bool		omitoob = false;	// omit oob data
 static unsigned long	start_addr;		// start address
@@ -83,7 +84,7 @@ static const char	*mtddev;		// mtd device name
 static const char	*dumpfile;		// dump file name
 static bool		omitbad = false;
 static bool		quiet = false;		// suppress diagnostic output
-static bool		canonical = false;
+static bool		canonical = false;	// print nice + ascii
 
 static void process_options (int argc, char * const argv[])
 {
@@ -91,10 +92,11 @@ static void process_options (int argc, char * const argv[])
 
 	for (;;) {
 		int option_index = 0;
-		static const char *short_options = "bs:f:il:opqn";
+		static const char *short_options = "bs:f:il:opqnc";
 		static const struct option long_options[] = {
 			{"help", no_argument, 0, 0},
 			{"version", no_argument, 0, 0},
+			{"canonicalprint", no_argument, 0, 'c'},
 			{"file", required_argument, 0, 'f'},
 			{"ignoreerrors", no_argument, 0, 'i'},
 			{"prettyprint", no_argument, 0, 'p'},
@@ -145,6 +147,8 @@ static void process_options (int argc, char * const argv[])
 			case 'o':
 				omitoob = true;
 				break;
+			case 'c':
+				canonical = true;
 			case 'p':
 				pretty_print = true;
 				break;
-- 
1.7.0.4

  parent reply	other threads:[~2010-07-19 17:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-16 16:42 [PATCH] mtd-utils: formatting of odd-sized OOB in nanddump Brian Norris
2010-07-07 14:07 ` Artem Bityutskiy
2010-07-07 18:21   ` Brian Norris
2010-07-08  4:09     ` Artem Bityutskiy
2010-07-08 20:50       ` [PATCH] mtd-utils update Brian Norris
2010-07-08 20:50         ` [PATCH 1/6] mtd-utils/nanddump.c: Increase max OOB size Brian Norris
2010-07-18  7:17           ` Artem Bityutskiy
2010-07-08 20:50         ` [PATCH 2/6] mtd-utils/nanddump.c: Robust pretty hexdump Brian Norris
2010-07-18  7:18           ` Artem Bityutskiy
2010-07-08 20:50         ` [PATCH 3/6] mtd-utils/nanddump.c: Add canonical (hex+ascii) flag Brian Norris
2010-07-08 20:50         ` [PATCH 4/6] mtd-utils/mkfs.jffs2: fixed warnings Brian Norris
2010-07-18  7:19           ` Artem Bityutskiy
2010-07-08 20:50         ` [PATCH 5/6] mtd-utils/nandtest.c: Fixed indentation Brian Norris
2010-07-18  7:20           ` Artem Bityutskiy
2010-07-08 20:50         ` [PATCH 6/6] mtd-utils/nanddump.c: Add "forcebinary" flag Brian Norris
2010-07-08 22:03           ` Brian Norris
2010-07-18  7:23           ` Artem Bityutskiy
2010-07-19 17:33             ` [PATCH v2 2/6] mtd-utils/nanddump.c: Robust pretty hexdump Brian Norris
2010-07-21  9:54               ` Artem Bityutskiy
2010-07-19 17:33             ` Brian Norris [this message]
2010-07-19 17:33             ` [PATCH v2 6/6] mtd-utils/nanddump.c: Add "forcebinary" flag Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1279560796-6388-2-git-send-email-norris@broadcom.com \
    --to=norris@broadcom.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).