diff options
author | Werner Koch <[email protected]> | 2007-03-19 15:44:59 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2007-03-19 15:44:59 +0000 |
commit | 9e95c2dff6374fea6007711635063d8c1ab4fb2b (patch) | |
tree | 257f186fed764c911913911ff35037a28ff11532 /common/miscellaneous.c | |
parent | Changes to let the key listing use estream to help systems without (diff) | |
download | gnupg-9e95c2dff6374fea6007711635063d8c1ab4fb2b.tar.gz gnupg-9e95c2dff6374fea6007711635063d8c1ab4fb2b.zip |
Allow export to work on systems without funopen/fopencookie.
Diffstat (limited to 'common/miscellaneous.c')
-rw-r--r-- | common/miscellaneous.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/common/miscellaneous.c b/common/miscellaneous.c index 948c8ef48..498c2ab60 100644 --- a/common/miscellaneous.c +++ b/common/miscellaneous.c @@ -67,6 +67,22 @@ print_utf8_string( FILE *fp, const byte *p, size_t n ) print_utf8_string2 (fp, p, n, 0); } +/* Write LENGTH bytes of BUFFER to FP as a hex encoded string. + RESERVED must be 0. */ +void +print_hexstring (FILE *fp, const void *buffer, size_t length, int reserved) +{ +#define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A')) + const unsigned char *s; + + for (s = buffer; length; s++, length--) + { + putc ( tohex ((*s>>4)&15), fp); + putc ( tohex (*s&15), fp); + } +#undef tohex +} + char * make_printable_string (const void *p, size_t n, int delim ) { |