]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libip/parseether.c
nusb: resolve endpoint id conflict with different input and output types
[plan9front.git] / sys / src / libip / parseether.c
1 #include <u.h>
2 #include <libc.h>
3
4 int
5 parseether(uchar *to, char *from)
6 {
7         char nip[4];
8         char *p;
9         int i;
10
11         p = from;
12         for(i = 0; i < 6; i++){
13                 if(*p == 0)
14                         return -1;
15                 nip[0] = *p++;
16                 if(*p == 0)
17                         return -1;
18                 nip[1] = *p++;
19                 nip[2] = 0;
20                 to[i] = strtoul(nip, 0, 16);
21                 if(*p == ':')
22                         p++;
23         }
24         return 0;
25 }