From ef6722750b4518fcb29bf983755b5f02451ef224 Mon Sep 17 00:00:00 2001 From: John Denker Date: Tue, 31 Jul 2012 22:34:58 -0700 Subject: a bunch of files added by the ipv6 patch --- ucspi-tcp-0.88/scan_xlong.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ucspi-tcp-0.88/scan_xlong.c (limited to 'ucspi-tcp-0.88/scan_xlong.c') diff --git a/ucspi-tcp-0.88/scan_xlong.c b/ucspi-tcp-0.88/scan_xlong.c new file mode 100644 index 0000000..6e46d74 --- /dev/null +++ b/ucspi-tcp-0.88/scan_xlong.c @@ -0,0 +1,23 @@ +#include "scan.h" + +static int fromhex(unsigned char c) { + if (c>='0' && c<='9') + return c-'0'; + else if (c>='A' && c<='F') + return c-'A'+10; + else if (c>='a' && c<='f') + return c-'a'+10; + return -1; +} + +unsigned int scan_xlong(char *src,unsigned long *dest) { + register const char *tmp=src; + register int l=0; + register unsigned char c; + while ((c=fromhex(*tmp))<16) { + l=(l<<4)+c; + ++tmp; + } + *dest=l; + return tmp-src; +} -- cgit v1.2.3