]> git.ipfire.org Git - thirdparty/bacula.git/commit
add built-in hexdump to bsnprintf()
authorAlain Spineux <alain@baculasystems.com>
Fri, 20 Aug 2021 11:52:43 +0000 (13:52 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:03 +0000 (09:03 +0100)
commitcaefa582e8d844ea75f2a72ca746e40227e0dc17
treeae49f8aba1c63db76262784a0ce75e990ffeeacc
parentb5340459233d99da7922df265c9e2a81fb0a9435
add built-in hexdump to bsnprintf()

- sample
char hash[MAX_HASH_SIZE];
int hash_size=32;

/* notice that the length is the length in the output "buffer" not the
   length of the input buffer. This is like in any printf() "length"
   any char in the input will generate 2 digit in the output, you must
   multiply by 2 the size of the input buffer or get a small output!
   It is safe because bnsprintf() knows the length of its output buffer
   and truncate any overload
*/
Mmsg(0, "the hash is :%64W", hash);             // fixed size
Mmsg(0, "the hash is :%*W", 2*hash_size, hash); // variable size
bacula/src/lib/bsnprintf.c