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:
@@ -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" : "");
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user