summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils/identification.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2009-03-22 10:06:21 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2009-03-22 10:06:21 +0000
commit7b88a5ce44f52abb13390c6c105bdd58a590a626 (patch)
treeabfb7e16a76d3d65af2c809c949b747a874e33fd /src/libstrongswan/utils/identification.c
parent3c810543672b76a7c9b871420866f822f8b067d8 (diff)
downloadvyos-strongswan-7b88a5ce44f52abb13390c6c105bdd58a590a626.tar.gz
vyos-strongswan-7b88a5ce44f52abb13390c6c105bdd58a590a626.zip
- New upstream version.
Diffstat (limited to 'src/libstrongswan/utils/identification.c')
-rw-r--r--src/libstrongswan/utils/identification.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/src/libstrongswan/utils/identification.c b/src/libstrongswan/utils/identification.c
index 529e62509..ff97f3610 100644
--- a/src/libstrongswan/utils/identification.c
+++ b/src/libstrongswan/utils/identification.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2009 Tobias Brunner
* Copyright (C) 2005-2008 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
@@ -13,7 +14,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * $Id: identification.c 4856 2009-02-05 22:13:48Z andreas $
+ * $Id: identification.c 4936 2009-03-12 18:07:32Z tobias $
*/
#define _GNU_SOURCE
@@ -23,7 +24,6 @@
#include <string.h>
#include <stdio.h>
#include <ctype.h>
-#include <printf.h>
#include "identification.h"
@@ -879,10 +879,10 @@ static id_match_t matches_dn(private_identification_t *this,
}
/**
- * output handler in printf()
+ * Described in header.
*/
-static int print(FILE *stream, const struct printf_info *info,
- const void *const *args)
+int identification_printf_hook(char *dst, size_t len, printf_hook_spec_t *spec,
+ const void *const *args)
{
private_identification_t *this = *((private_identification_t**)(args[0]));
char buf[BUF_LEN];
@@ -890,7 +890,7 @@ static int print(FILE *stream, const struct printf_info *info,
if (this == NULL)
{
- return fprintf(stream, "%*s", info->width, "(null)");
+ return print_in_hook(dst, len, "%*s", spec->width, "(null)");
}
switch (this->type)
@@ -940,33 +940,11 @@ static int print(FILE *stream, const struct printf_info *info,
snprintf(buf, sizeof(buf), "(unknown ID type: %d)", this->type);
break;
}
- if (info->left)
- {
- return fprintf(stream, "%-*s", info->width, buf);
- }
- return fprintf(stream, "%*s", info->width, buf);
-}
-
-/**
- * arginfo handler
- */
-static int arginfo(const struct printf_info *info, size_t n, int *argtypes)
-{
- if (n > 0)
+ if (spec->minus)
{
- argtypes[0] = PA_POINTER;
+ return print_in_hook(dst, len, "%-*s", spec->width, buf);
}
- return 1;
-}
-
-/**
- * Get printf hook functions
- */
-printf_hook_functions_t identification_get_printf_hooks()
-{
- printf_hook_functions_t hook = {print, arginfo};
-
- return hook;
+ return print_in_hook(dst, len, "%*s", spec->width, buf);
}
/**