Diff for /libaitio/src/Attic/tools.c between versions 1.5 and 1.6

version 1.5, 2011/06/07 11:49:39 version 1.6, 2011/10/31 13:53:51
Line 295  io_FreeNullTerm(char *** __restrict arr) Line 295  io_FreeNullTerm(char *** __restrict arr)
                 *arr = NULL;                  *arr = NULL;
         }          }
 }  }
   
   /*
    * io_ether_ntoa() Convert ethernet address to string
    * @n = ethernet address structure, like struct ether_addr
    * @a = string
    * @len = string length
    * return: NULL error or !=NULL string a
    */
   inline char *
   io_ether_ntoa(const struct io_ether_addr *n, char * __restrict a, int len)
   {
           if (!n || !a)
                   return NULL;
   
           memset(a, 0, len);
           if (snprintf(a, len, "%02x:%02x:%02x:%02x:%02x:%02x", 
                           n->ether_addr_octet[0], n->ether_addr_octet[1], 
                           n->ether_addr_octet[2], n->ether_addr_octet[3], 
                           n->ether_addr_octet[4], n->ether_addr_octet[5]) < 17)
                   return NULL;
   
           return a;
   }
   
   /*
    * io_ether_aton() Convert string to ethernet address
    * @a = string
    * @e = ethernet address structure, like struct ether_addr
    * return: NULL error or !=NULL ethernet address structure
    */
   inline struct io_ether_addr *
   io_ether_aton(const char *a, struct io_ether_addr *e)
   {                       
           int i;
           u_int o0, o1, o2, o3, o4, o5;
   
           if (!a || !e)
                   return NULL;
   
           i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o0, &o1, &o2, &o3, &o4, &o5);
           if (i != 6)
                   return NULL;
   
           e->ether_addr_octet[0] = o0;
           e->ether_addr_octet[1] = o1;
           e->ether_addr_octet[2] = o2;
           e->ether_addr_octet[3] = o3;
           e->ether_addr_octet[4] = o4;
           e->ether_addr_octet[5] = o5;
   
           return e;
   }

Removed from v.1.5  
changed lines
  Added in v.1.6


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>