From 7a229aeb240cc750546f55ad089022f0ca7dc44f Mon Sep 17 00:00:00 2001 From: Rene Mayrhofer Date: Sun, 22 Mar 2009 09:52:39 +0000 Subject: [svn-upgrade] Integrating new upstream version, strongswan (4.2.13) --- src/libstrongswan/utils/identification.c | 40 +++++++------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) (limited to 'src/libstrongswan/utils/identification.c') 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 #include #include -#include #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); } /** -- cgit v1.2.3