add libip

This commit is contained in:
rsc 2003-11-23 18:23:20 +00:00
parent 99947423b1
commit d709423926
13 changed files with 875 additions and 0 deletions

25
src/libip/parseether.c Normal file
View file

@ -0,0 +1,25 @@
#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;
}