]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
PREFIX instead NETMASK in --prefix option
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sun, 27 Jun 1999 17:34:25 +0000 (17:34 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Sun, 27 Jun 1999 17:34:25 +0000 (17:34 +0000)
svn-id: @387

src/ipcalc.1
src/ipcalc.c

index 38126be8487cafe60e6488f5cc8a0c9fdb2a7a81..6242e1f262b081cb4516ecac639424aac2cc7e0c 100644 (file)
@@ -24,9 +24,8 @@ address is in a complete Class A, B, or C network. Many networks do
 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.
index f97f0e10fdc5d3010ac376310899f12ea1e8ab60..03d08cc1b57c8e7ac27eff3101fc67ca3441a400 100644 (file)
@@ -22,7 +22,7 @@ int main(int argc, char ** argv) {
            { "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 },
     };
 
@@ -71,17 +71,20 @@ int main(int argc, char ** argv) {
        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";
@@ -89,9 +92,10 @@ int main(int argc, char ** argv) {
                     chptr = "255.255.0.0";
                 else
                     chptr = "255.255.255.0";
+
+               printf("NETMASK=%s\n", chptr);
        }
 
-       printf("NETMASK=%s\n", chptr);
     }
 
     if (showBroadcast) {
This page took 0.293105 seconds and 4 git commands to generate.