diff --git a/man/xd.1 b/man/xd.1 index cffe2db..5d351ba 100644 --- a/man/xd.1 +++ b/man/xd.1 @@ -26,7 +26,7 @@ Disables the file offsets column at the generated hexdump table. Enables the file offsets column at the generated hexdump table (default). .TP .B \-L text -Displays the specified text as the separator of the file hexdump to the file contents ASCII representation. Displays a space before the specified text. +Displays the specified text as the separator of the file hexdump to the file contents ASCII representation. .TP .B \-K text Displays the specified text as the separator of the file offsets to the file hexdump. diff --git a/src/xd.c b/src/xd.c index c3c6d0b..594e330 100644 --- a/src/xd.c +++ b/src/xd.c @@ -13,7 +13,7 @@ #define __XD_USAGE__ \ "Usage: %s [-D|-O][-L text][-K text][-R when][-b][-d|-o][-c cols][-g size][-p][-t type][-u] [file...]\n" \ - " %s -i [-b][-c columns][-n name][-u] [file...]\n" \ + " %s -i [-c columns][-n name][-u] [file...]\n" \ " %s -?\n" \ "Displays a hexdump of the specified file(s) or standard input.\n" \ "This utility is not a part of POSIX® specification.\n" \ @@ -21,7 +21,7 @@ "\t-?: Displays this message and then exits.\n" \ "General options:\n" \ "\t-D: Disables the printing of offsets.\n" \ - "\t-L text: Specifies the dump separator. A space is added before it.\n" \ + "\t-L text: Specifies the dump separator.\n" \ "\t-K text: Specifies the offset separator.\n" \ "\t-O: Enables the printing of offsets (default).\n" \ "\t-R when: Specifies when to color output. When may be: never, always or auto.\n" \ @@ -182,7 +182,9 @@ int hexdump(FILE *restrict stream, FILE *restrict source, struct hexdumping *res } if (hexfl->hex_flags & HEXDFL_C) return chexdump(stream, source, hexfl); + dumplen = (hexfl->hex_columns * digits) + (hexfl->hex_columns / hexfl->hex_wordsize); + if (hexfl->hex_columns % hexfl->hex_wordsize == 0) dumplen -= 1; while (fpeek(source) != EOF) { fpos_t initpos; @@ -311,7 +313,6 @@ int main(int argc, char **argv) case 'p': hexfl->hex_flags &= ~(HEXDFL_C | HEXDFL_MASK_COLOR); hexfl->hex_flags |= (HEXDFL_NOCOUNT | HEXDFL_PLAIN | HEXDFL_NOCOLOR); - hexfl->hex_off_separator = ""; break; case 't': if (optarg[1]) goto illegal_optarg;