From: Jonatan Schlag Date: Tue, 4 Jul 2017 15:46:06 +0000 (+0200) Subject: inetcalc: do not print the default prefix X-Git-Tag: 009~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1901756158ec6217be10ba78507c82e95f77e46;p=network.git inetcalc: do not print the default prefix Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/inetcalc.c b/src/inetcalc.c index d08f0f3a..da3444e0 100644 --- a/src/inetcalc.c +++ b/src/inetcalc.c @@ -245,7 +245,10 @@ static void ip_address_print(const ip_address_t* ip) { if (r) return; - if (ip->prefix >= 0) { + int address_prefix = default_prefix(ip->family); + + // Only print prefix when it is not the default one + if (ip->prefix != address_prefix) { size_t len = strlen(buffer); snprintf(buffer + len, sizeof(buffer) - len, "/%d", ip->prefix); }