Uninitialized vector entry?
[minix3.git] / lib / ip / ethera2n.c
blob35f25d41f7361e73af36bf20d7193bf67ed53b20
1 /*
2 ethera2n.c
4 Convert an ASCII string with an ethernet address into a struct ether_addr.
6 Created: Nov 17, 1992 by Philip Homburg
7 */
9 #include <sys/types.h>
10 #include <stdlib.h>
11 #include <net/netlib.h>
12 #include <net/gen/ether.h>
13 #include <net/gen/if_ether.h>
15 struct ether_addr *ether_aton(s)
16 _CONST char *s;
18 static struct ether_addr ea;
20 int i;
21 long v;
22 char *check;
24 if (s == NULL)
25 return NULL;
27 for (i=0; i<6; i++)
29 v= strtol(s, &check, 16);
30 if (v<0 || v>255)
31 return NULL;
32 if ((i<5 && check[0] != ':') || (i == 5 && check[0] != '\0'))
33 return NULL;
34 ea.ea_addr[i]= v;
35 s= check+1;
37 return &ea;
41 * $PchId: ethera2n.c,v 1.3 1996/02/22 21:10:01 philip Exp $