From 495e12aeadb02bfda8621984ff0a4e07e1fcd89f Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 8 Aug 2012 14:05:58 +0200 Subject: [PATCH] Add support for '+' in custom format specifiers --- src/libstrongswan/printf_hook.c | 2 ++ src/libstrongswan/printf_hook.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/libstrongswan/printf_hook.c b/src/libstrongswan/printf_hook.c index 2ae8043..8bd513c 100644 --- a/src/libstrongswan/printf_hook.c +++ b/src/libstrongswan/printf_hook.c @@ -93,6 +93,7 @@ static int custom_print(FILE *stream, const struct printf_info *info, }; spec.hash = info->alt; + spec.plus = info->showsign; spec.minus = info->left; spec.width = info->width; @@ -164,6 +165,7 @@ static int custom_fmt_cb(Vstr_base *base, size_t pos, Vstr_fmt_spec *fmt_spec) } spec.hash = fmt_spec->fmt_hash; + spec.plus = fmt_spec->fmt_plus; spec.minus = fmt_spec->fmt_minus; spec.width = fmt_spec->fmt_field_width; diff --git a/src/libstrongswan/printf_hook.h b/src/libstrongswan/printf_hook.h index 93026cc..96e5a19 100644 --- a/src/libstrongswan/printf_hook.h +++ b/src/libstrongswan/printf_hook.h @@ -163,6 +163,11 @@ struct printf_hook_spec_t { int minus; /** + * TRUE if a '+' was used in the format specifier + */ + int plus; + + /** * The width as given in the format specifier. */ int width; -- 2.7.4