not use the default netmasks, in which case an inappropriate value will
be returned.
-.IP \fI--short-netmask\fR
-That same as \fB--netmask\fR but returns netmask in short style. For example
-for netmask 255.255.255.0 it returns 24.
+.IP \fI--prefix\fR
+That same as \fB--netmask\fR but returns prefix (see CIDR specyfication)
.IP \fI--network\fR
Display the network address for the given IP address and netmask.
{ "netmask", '\0', 0, &showNetmask, 0 },
{ "network", '\0', 0, &showNetwork, 0 },
{ "silent", '\0', 0, &beSilent, 0 },
- { "short-netmask", '\0', 0, &showShortNetmask, 0 },
+ { "prefix", '\0', 0, &showPrefix, 0 },
{ NULL, '\0', 0, 0, 0 },
};
return 1;
}
- if (showShortNetmask)
+ if (showPrefix)
showNetmask = 1;
if (showNetmask) {
- if (showShortNetmask) {
+ if (showPrefix) {
if (((ntohl(ip) & 0xFF000000) >> 24) <= 127)
chptr = "8";
else if (((ntohl(ip) & 0xFF000000) >> 24) <= 191)
chptr = "16";
else
chptr = "24";
+
+ printf("PREFIX=%s\n", chptr);
+
} else {
if (((ntohl(ip) & 0xFF000000) >> 24) <= 127)
chptr = "255.0.0.0";
chptr = "255.255.0.0";
else
chptr = "255.255.255.0";
+
+ printf("NETMASK=%s\n", chptr);
}
- printf("NETMASK=%s\n", chptr);
}
if (showBroadcast) {