Changes in lib/misc.c [d444c09:e9b755e]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/misc.c
rd444c09 re9b755e 322 322 } 323 323 324 #ifdef IPV6325 /* Wrap an IPv4 address into IPv6 space. Not thread-safe... */326 char *ipv6_wrap( char *src )327 {328 static char dst[64];329 int i;330 331 for( i = 0; src[i]; i ++ )332 if( ( src[i] < '0' || src[i] > '9' ) && src[i] != '.' )333 break;334 335 /* Hmm, it's not even an IP... */336 if( src[i] )337 return src;338 339 g_snprintf( dst, sizeof( dst ), "::ffff:%s", src );340 341 return dst;342 }343 344 /* Unwrap an IPv4 address into IPv6 space. Thread-safe, because it's very simple. :-) */345 char *ipv6_unwrap( char *src )346 {347 int i;348 349 if( g_strncasecmp( src, "::ffff:", 7 ) != 0 )350 return src;351 352 for( i = 7; src[i]; i ++ )353 if( ( src[i] < '0' || src[i] > '9' ) && src[i] != '.' )354 break;355 356 /* Hmm, it's not even an IP... */357 if( src[i] )358 return src;359 360 return ( src + 7 );361 }362 #endif363 364 324 /* Convert from one charset to another. 365 325
Note: See TracChangeset
for help on using the changeset viewer.