You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
364 B
C
22 lines
364 B
C
#include "ip6.h"
|
|
|
|
static char tohex(char num) {
|
|
if (num<10)
|
|
return num+'0';
|
|
else if (num<16)
|
|
return num-10+'a';
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
unsigned int fmt_ip6_flat(char *s,const char ip[16])
|
|
{
|
|
int i;
|
|
if (!s) return 32;
|
|
for (i=0; i<16; i++) {
|
|
*s++=tohex((unsigned char)ip[i] >> 4);
|
|
*s++=tohex((unsigned char)ip[i] & 15);
|
|
}
|
|
return 32;
|
|
}
|