diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 15:46:40 +0300 |
commit | e5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch) | |
tree | d8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/libip/parseether.c |
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/libip/parseether.c')
-rwxr-xr-x | sys/src/libip/parseether.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/src/libip/parseether.c b/sys/src/libip/parseether.c new file mode 100755 index 000000000..f199eb6f1 --- /dev/null +++ b/sys/src/libip/parseether.c @@ -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; +} |