diff options
author | rsc <devnull@localhost> | 2003-11-23 18:23:20 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-11-23 18:23:20 +0000 |
commit | d7094239263eac816ebb3af32641079b7924c666 (patch) | |
tree | 61b016942d567560042adf110f5fb558dc328a98 /src/libip/parseether.c | |
parent | 99947423b136903263513b9022aab6586c8c6cc5 (diff) | |
download | plan9port-d7094239263eac816ebb3af32641079b7924c666.tar.gz plan9port-d7094239263eac816ebb3af32641079b7924c666.tar.bz2 plan9port-d7094239263eac816ebb3af32641079b7924c666.zip |
add libip
Diffstat (limited to 'src/libip/parseether.c')
-rw-r--r-- | src/libip/parseether.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libip/parseether.c b/src/libip/parseether.c new file mode 100644 index 00000000..f199eb6f --- /dev/null +++ b/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; +} |