mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Allow export to work on systems without funopen/fopencookie.
This commit is contained in:
parent
12b661166c
commit
9e95c2dff6
14 changed files with 214 additions and 73 deletions
|
@ -1,5 +1,6 @@
|
|||
2007-03-19 Werner Koch <wk@g10code.com>
|
||||
|
||||
* miscellaneous.c (print_hexstring): New.
|
||||
* estream.c (es_fprintf_unlocked): New.
|
||||
(es_write_sanitized): New.
|
||||
(es_write_hexstring): New.
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -185,6 +185,8 @@ const char *print_fname_stdin (const char *s);
|
|||
void print_string (FILE *fp, const byte *p, size_t n, int delim);
|
||||
void print_utf8_string2 ( FILE *fp, const byte *p, size_t n, int delim);
|
||||
void print_utf8_string (FILE *fp, const byte *p, size_t n);
|
||||
void print_hexstring (FILE *fp, const void *buffer, size_t length,
|
||||
int reserved);
|
||||
char *make_printable_string (const void *p, size_t n, int delim);
|
||||
|
||||
int is_file_compressed (const char *s, int *ret_rc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue