Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include "es12.h"
- /*
- * Compilare con il comando `gcc -std=gnu89 -Wall -pedantic -o es12 es12.c es12_main.c`.
- */
- int main() {
- int ris1,ris2,ris3,ris4,ris5,ris6,ris7;
- unsigned int ris8,ris9,risA,risB;
- char a,b,c;
- char ind_ip1[] = "255.255.255.255";
- char ind_ip2[] = "123.123.lol.255";
- char ind_ip3[] = "172.16.0.254";
- char ind_ip4[] = "s45.123.lol.23";
- char ind_ip5[] = "192.168.0.1";
- char ind_ip6[] = "172.16.0.254";
- char ind_ip7[] = "1.2.3.4";
- printf("\n-----------------vail_ip----------------------\n");
- ris1 = valid_ip(ind_ip1);
- printf("%20s ->%2d\n",ind_ip1,ris1);
- ris2 = valid_ip(ind_ip2);
- printf("%20s ->%2d\n",ind_ip2,ris2);
- ris3 = valid_ip(ind_ip3);
- printf("%20s ->%2d\n",ind_ip3,ris3);
- ris4 = valid_ip(ind_ip4);
- printf("%20s ->%2d\n",ind_ip4,ris4);
- ris5 = valid_ip(ind_ip5);
- printf("%20s ->%2d\n",ind_ip5,ris5);
- ris6 = valid_ip(ind_ip6);
- printf("%20s ->%2d\n",ind_ip6,ris6);
- ris7 = valid_ip(ind_ip7);
- printf("%20s ->%2d\n",ind_ip7,ris7);
- printf("-------------------ip2int-----------------------\n");
- ris8 = ip2int(ind_ip1);
- printf("%20s ->%11u\n",ind_ip1,ris8);
- ris9 = ip2int(ind_ip3);
- printf("%20s ->%11u\n",ind_ip3,ris9);
- risA = ip2int(ind_ip5);
- printf("%20s ->%11u\n",ind_ip5,risA);
- risB = ip2int(ind_ip7);
- printf("%20s ->%11u\n",ind_ip7,risB);
- printf("-------------------ip_class---------------------\n");
- a = ip_class(ind_ip5);
- printf("%20s ->%2c\n",ind_ip5,a);
- b = ip_class(ind_ip6);
- printf("%20s ->%2c\n",ind_ip6,b);
- c = ip_class(ind_ip7);
- printf("%20s ->%2c\n",ind_ip7,c);
- printf("------------------------------------------------\n");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement