summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2015-09-22 14:31:00 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2015-09-22 14:54:51 +0200
commit7e053036736b16757dea5d3c7d9beb4ffa8d2488 (patch)
treeb14244873e6737a0c5a4b7377147fe0864e60a52
parent8c99421e01a48710bcfb77489b6e738ce3811a78 (diff)
downloadgnutls-7e053036736b16757dea5d3c7d9beb4ffa8d2488.tar.gz
certtool: print 16-bytes of hex values per line
Also avoid a colon on the end of the line.
-rw-r--r--src/certtool-common.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/certtool-common.c b/src/certtool-common.c
index cbf4876db9..209a10f3e8 100644
--- a/src/certtool-common.c
+++ b/src/certtool-common.c
@@ -739,8 +739,9 @@ print_hex_datum(FILE * outfile, gnutls_datum_t * dat, int cprint)
for (j = 0; j < dat->size; j++) {
fprintf(outfile, "\\x%.2x",
(unsigned char) dat->data[j]);
- if ((j + 1) % 15 == 0)
+ if ((j + 1) % 16 == 0) {
fprintf(outfile, "\"\n" SPACE "\"");
+ }
}
fprintf(outfile, "\";\n\n");
@@ -749,9 +750,12 @@ print_hex_datum(FILE * outfile, gnutls_datum_t * dat, int cprint)
fprintf(outfile, "\n" SPACE);
for (j = 0; j < dat->size; j++) {
- fprintf(outfile, "%.2x:", (unsigned char) dat->data[j]);
- if ((j + 1) % 15 == 0)
+ if ((j + 1) % 16 == 0) {
+ fprintf(outfile, "%.2x", (unsigned char) dat->data[j]);
fprintf(outfile, "\n" SPACE);
+ } else {
+ fprintf(outfile, "%.2x:", (unsigned char) dat->data[j]);
+ }
}
fprintf(outfile, "\n\n");
}