Advertisement
LucaVinci110898

IndIP/es12_main.c

Mar 8th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.71 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include "es12.h"
  4.  
  5. /*
  6.  * Compilare con il comando `gcc -std=gnu89 -Wall -pedantic -o es12 es12.c es12_main.c`.
  7.  */
  8. int main() {
  9.     int ris1,ris2,ris3,ris4,ris5,ris6,ris7;
  10.     unsigned int ris8,ris9,risA,risB;
  11.     char a,b,c;
  12.     char ind_ip1[] = "255.255.255.255";
  13.     char ind_ip2[] = "123.123.lol.255";
  14.     char ind_ip3[] = "172.16.0.254";
  15.     char ind_ip4[] = "s45.123.lol.23";
  16.     char ind_ip5[] = "192.168.0.1";
  17.     char ind_ip6[] = "172.16.0.254";
  18.     char ind_ip7[] = "1.2.3.4";
  19.  
  20.     printf("\n-----------------vail_ip----------------------\n");
  21.     ris1 = valid_ip(ind_ip1);
  22.     printf("%20s ->%2d\n",ind_ip1,ris1);
  23.  
  24.     ris2 = valid_ip(ind_ip2);
  25.     printf("%20s ->%2d\n",ind_ip2,ris2);
  26.    
  27.     ris3 = valid_ip(ind_ip3);
  28.     printf("%20s ->%2d\n",ind_ip3,ris3);
  29.  
  30.     ris4 = valid_ip(ind_ip4);
  31.     printf("%20s ->%2d\n",ind_ip4,ris4);
  32.  
  33.     ris5 = valid_ip(ind_ip5);
  34.     printf("%20s ->%2d\n",ind_ip5,ris5);
  35.  
  36.     ris6 = valid_ip(ind_ip6);
  37.     printf("%20s ->%2d\n",ind_ip6,ris6);
  38.  
  39.     ris7 = valid_ip(ind_ip7);
  40.     printf("%20s ->%2d\n",ind_ip7,ris7);
  41.    
  42.     printf("-------------------ip2int-----------------------\n");
  43.    
  44.     ris8 = ip2int(ind_ip1);
  45.     printf("%20s ->%11u\n",ind_ip1,ris8);
  46.  
  47.     ris9 = ip2int(ind_ip3);
  48.     printf("%20s ->%11u\n",ind_ip3,ris9);
  49.  
  50.     risA = ip2int(ind_ip5);
  51.     printf("%20s ->%11u\n",ind_ip5,risA);
  52.  
  53.     risB = ip2int(ind_ip7);
  54.     printf("%20s ->%11u\n",ind_ip7,risB);
  55.  
  56.     printf("-------------------ip_class---------------------\n");
  57.    
  58.     a = ip_class(ind_ip5);
  59.     printf("%20s ->%2c\n",ind_ip5,a);
  60.  
  61.     b = ip_class(ind_ip6);
  62.     printf("%20s ->%2c\n",ind_ip6,b);
  63.  
  64.     c = ip_class(ind_ip7);
  65.     printf("%20s ->%2c\n",ind_ip7,c);
  66.    
  67.     printf("------------------------------------------------\n");
  68.  
  69.     return EXIT_SUCCESS;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement