mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-15 11:20:03 +00:00
25 lines
318 B
C
25 lines
318 B
C
#include <u.h>
|
|
#include <libc.h>
|
|
|
|
int
|
|
parseether(uchar *to, char *from)
|
|
{
|
|
char nip[4];
|
|
char *p;
|
|
int i;
|
|
|
|
p = from;
|
|
for(i = 0; i < 6; i++){
|
|
if(*p == 0)
|
|
return -1;
|
|
nip[0] = *p++;
|
|
if(*p == 0)
|
|
return -1;
|
|
nip[1] = *p++;
|
|
nip[2] = 0;
|
|
to[i] = strtoul(nip, 0, 16);
|
|
if(*p == ':')
|
|
p++;
|
|
}
|
|
return 0;
|
|
}
|