summaryrefslogtreecommitdiff
path: root/nanddump.c
diff options
context:
space:
mode:
authorBrian Norris <norris@broadcom.com>2010-07-19 10:33:15 -0700
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-07-21 12:59:33 +0300
commit48ae9d621bc8df3ca54e8e852632f7af77ec5ea0 (patch)
tree0357a9ed9c67f95f6ca7be0a011893f8ed54f494 /nanddump.c
parent6ff458433ba15b8a7cb258ce64e64e98982df26e (diff)
nanddump: add canonical (hex+ascii) flag
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> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'nanddump.c')
-rw-r--r--nanddump.c10
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;