aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/ChangeLog8
-rw-r--r--util/argparse.c5
-rw-r--r--util/miscutil.c22
3 files changed, 27 insertions, 8 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index a1dc8763c..c776b17f3 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-13 David Shaw <[email protected]>
+
+ * miscutil.c (print_string2): New variation on print_string that
+ allows two delimiters.
+ (print_string): Call print_string2 to do work.
+
+ * argparse.c (default_strusage): Update copyright date.
+
2003-12-24 David Shaw <[email protected]>
* iobuf.c (block_filter): Properly handle a partial body stream
diff --git a/util/argparse.c b/util/argparse.c
index 3e772d9a7..4ff0c028a 100644
--- a/util/argparse.c
+++ b/util/argparse.c
@@ -1,5 +1,6 @@
/* [argparse.c wk 17.06.97] Argument Parser for option handling
- * Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2003
+ * 2004 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -910,7 +911,7 @@ default_strusage( int level )
switch( level ) {
case 11: p = "foo"; break;
case 13: p = "0.0"; break;
- case 14: p = "Copyright (C) 2003 Free Software Foundation, Inc."; break;
+ case 14: p = "Copyright (C) 2004 Free Software Foundation, Inc."; break;
case 15: p =
"This program comes with ABSOLUTELY NO WARRANTY.\n"
"This is free software, and you are welcome to redistribute it\n"
diff --git a/util/miscutil.c b/util/miscutil.c
index e6cc9a860..f132dc034 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -1,5 +1,6 @@
/* miscutil.c - miscellaneous utilities
- * Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2003,
+ * 2004 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -175,15 +176,18 @@ asctimestamp( u32 stamp )
return buffer;
}
+
/****************
* Print a string to FP, but filter all control characters out.
*/
void
-print_string( FILE *fp, const byte *p, size_t n, int delim )
+print_string2( FILE *fp, const byte *p, size_t n, int delim, int delim2 )
{
for( ; n; n--, p++ )
- if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0) || *p == delim ||
- (delim && *p=='\\')) {
+ if( *p < 0x20 || (*p >= 0x7f && *p < 0xa0)
+ || *p == delim || *p == delim2
+ || ((delim || delim2) && *p=='\\'))
+ {
putc('\\', fp);
if( *p == '\n' )
putc('n', fp);
@@ -199,9 +203,15 @@ print_string( FILE *fp, const byte *p, size_t n, int delim )
putc('0', fp);
else
fprintf(fp, "x%02x", *p );
- }
+ }
else
- putc(*p, fp);
+ putc(*p, fp);
+}
+
+void
+print_string( FILE *fp, const byte *p, size_t n, int delim )
+{
+ print_string2(fp,p,n,delim,0);
}
/****************