summaryrefslogtreecommitdiffstats
path: root/text-utils/hexdump.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:34 +0000
commit1272be04be0cb803eec87f602edb2e3e6f111aea (patch)
treebce17f6478cdd9f3c4ec3d751135dc42786d6a56 /text-utils/hexdump.c
parentReleasing progress-linux version 2.39.3-11~progress7.99u1. (diff)
downloadutil-linux-1272be04be0cb803eec87f602edb2e3e6f111aea.tar.xz
util-linux-1272be04be0cb803eec87f602edb2e3e6f111aea.zip
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'text-utils/hexdump.c')
-rw-r--r--text-utils/hexdump.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c
index 73b3a94..3674455 100644
--- a/text-utils/hexdump.c
+++ b/text-utils/hexdump.c
@@ -66,6 +66,7 @@ parse_args(int argc, char **argv, struct hexdump *hex)
static const struct option longopts[] = {
{"one-byte-octal", no_argument, NULL, 'b'},
+ {"one-byte-hex", no_argument, NULL, 'X'},
{"one-byte-char", no_argument, NULL, 'c'},
{"canonical", no_argument, NULL, 'C'},
{"two-bytes-decimal", no_argument, NULL, 'd'},
@@ -82,12 +83,16 @@ parse_args(int argc, char **argv, struct hexdump *hex)
{NULL, no_argument, NULL, 0}
};
- while ((ch = getopt_long(argc, argv, "bcCde:f:L::n:os:vxhV", longopts, NULL)) != -1) {
+ while ((ch = getopt_long(argc, argv, "bXcCde:f:L::n:os:vxhV", longopts, NULL)) != -1) {
switch (ch) {
case 'b':
add_fmt(hex_offt, hex);
add_fmt("\"%07.7_ax \" 16/1 \"%03o \" \"\\n\"", hex);
break;
+ case 'X':
+ add_fmt("\"%07.7_Ax\n\"", hex);
+ add_fmt("\"%07.7_ax \" 16/1 \" %02x \" \"\\n\"", hex);
+ break;
case 'c':
add_fmt(hex_offt, hex);
add_fmt("\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"", hex);
@@ -166,6 +171,7 @@ void __attribute__((__noreturn__)) usage(void)
fputs(USAGE_OPTIONS, out);
fputs(_(" -b, --one-byte-octal one-byte octal display\n"), out);
+ fputs(_(" -X, --one-byte-hex one-byte hexadecimal display\n"), out);
fputs(_(" -c, --one-byte-char one-byte character display\n"), out);
fputs(_(" -C, --canonical canonical hex+ASCII display\n"), out);
fputs(_(" -d, --two-bytes-decimal two-byte decimal display\n"), out);
@@ -181,12 +187,12 @@ void __attribute__((__noreturn__)) usage(void)
fputs(_(" -v, --no-squeezing output identical lines\n"), out);
fputs(USAGE_SEPARATOR, out);
- printf(USAGE_HELP_OPTIONS(27));
+ fprintf(out, USAGE_HELP_OPTIONS(27));
fputs(USAGE_ARGUMENTS, out);
- printf(USAGE_ARG_SIZE(_("<length> and <offset>")));
+ fprintf(out, USAGE_ARG_SIZE(_("<length> and <offset>")));
- printf(USAGE_MAN_TAIL("hexdump(1)"));
+ fprintf(out, USAGE_MAN_TAIL("hexdump(1)"));
exit(EXIT_SUCCESS);
}