summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2005-08-18 21:17:45 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2005-08-18 21:17:45 +0000
commited9829ff68d33442e1f835fbae13c18846fcf69f (patch)
treead71e0fad38cc74ce29701659f40fca6aa42b748 /strings
parent3672c3fea32f6ef79feef57f753a9a149a6203e3 (diff)
downloadlibapr-ed9829ff68d33442e1f835fbae13c18846fcf69f.tar.gz
* strings/apr_snprintf.c (apr_vformatter): Add support for %pm to
print the error string corresponding to an apr_status_t. * test/testfmt.c (error_fmt): New test. * include/apr_lib.h: Document %pm and note the versioning constraint. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@233381 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'strings')
-rw-r--r--strings/apr_snprintf.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/strings/apr_snprintf.c b/strings/apr_snprintf.c
index 313a778cf..e903d2d31 100644
--- a/strings/apr_snprintf.c
+++ b/strings/apr_snprintf.c
@@ -21,6 +21,7 @@
#include "apr_strings.h"
#include "apr_network_io.h"
#include "apr_portable.h"
+#include "apr_errno.h"
#include <math.h>
#if APR_HAVE_CTYPE_H
#include <ctype.h>
@@ -1166,6 +1167,24 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *),
}
break;
+ /* print the error for an apr_status_t */
+ case 'm':
+ {
+ apr_status_t *mrv;
+
+ mrv = va_arg(ap, apr_status_t *);
+ if (mrv != NULL) {
+ s = apr_strerror(*mrv, num_buf, NUM_BUF_SIZE-1);
+ s_len = strlen(s);
+ }
+ else {
+ s = S_NULL;
+ s_len = S_NULL_LEN;
+ }
+ pad_char = ' ';
+ }
+ break;
+
case 'T':
#if APR_HAS_THREADS
{