Don't print hosts as %any if %+H is used

That is, the plus sign can be used in the format string to force a numeric
string representation of all host_t objects even 0.0.0.0 and :: which
would otherwise be printed as %any and %any6.
This commit is contained in:
Tobias Brunner
2012-08-13 11:00:29 +02:00
parent 495e12aead
commit f12b3ad2c9
2 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ int host_printf_hook(printf_hook_data_t *data, printf_hook_spec_t *spec,
{
snprintf(buffer, sizeof(buffer), "(null)");
}
else if (is_anyaddr(this))
else if (is_anyaddr(this) && !spec->plus)
{
snprintf(buffer, sizeof(buffer), "%%any%s",
this->address.sa_family == AF_INET6 ? "6" : "");
+1
View File
@@ -212,6 +212,7 @@ host_t *host_create_any(int family);
* Arguments are:
* host_t *host
* Use #-modifier to include port number
* Use +-modifier to force numeric representation (instead of e.g. %any)
*/
int host_printf_hook(printf_hook_data_t *data, printf_hook_spec_t *spec,
const void *const *args);