aboutsummaryrefslogtreecommitdiffstats
path: root/util/miscutil.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1997-12-01 10:33:23 +0000
committerWerner Koch <[email protected]>1997-12-01 10:33:23 +0000
commit5c1cca042e6bc0de22c7913f08457c7b8a46e592 (patch)
tree234246f67cf2e7deb79b94e7491fdd7111c1c65e /util/miscutil.c
parentImproved prime number test (diff)
downloadgnupg-5c1cca042e6bc0de22c7913f08457c7b8a46e592.tar.gz
gnupg-5c1cca042e6bc0de22c7913f08457c7b8a46e592.zip
List and check sigs works
Diffstat (limited to 'util/miscutil.c')
-rw-r--r--util/miscutil.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/util/miscutil.c b/util/miscutil.c
index 9fecf4488..18fff2c08 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -21,6 +21,7 @@
#include <config.h>
#include <stdio.h>
#include <time.h>
+#include <ctype.h>
#include "types.h"
#include "util.h"
@@ -31,3 +32,23 @@ make_timestamp()
}
+/****************
+ * Print a string to FP, but filter all control characters out.
+ */
+void
+print_string( FILE *fp, byte *p, size_t n )
+{
+ for( ; n; n--, p++ )
+ if( iscntrl( *p ) ) {
+ putc('\\', fp);
+ if( *p == '\n' )
+ putc('n', fp);
+ else if( !*p )
+ putc('0', fp);
+ else
+ printf("x%02x", *p );
+ }
+ else
+ putc(*p, fp);
+}
+