2N/A * Copyright 2001 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Misc routines that are used by tcpd and by tcpdchk. 2N/A * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. 2N/A/* xgets - fgets() with backslash-newline stripping */ 2N/A/* split_at - break string at delimiter or return NULL */ 2N/A/* dot_quad_addr - convert dotted quad to internal form */ 2N/A /* Count the number of runs of non-dot characters. */ 2N/A/* numeric_addr - convert textual IP address to binary form */ 2N/A/* For none RFC 2553 compliant systems */ 2N/A/* tcpd_gethostbyname - an IP family neutral gethostbyname */ 2N/A }
else {
/* Try INET6 */ 2N/A * When using IPv6 addresses, we'll be seeing lots of ":"s; 2N/A * we require the addresses to be specified as [address]. 2N/A * An IPv6 address can be specified in 3 ways: 2N/A * x:x:x:x:x:x:x:x (fully specified) 2N/A * x::x:x:x:x (zeroes squashed) 2N/A * ::FFFF:1.2.3.4 (IPv4 mapped) 2N/A * These need to be skipped to get at the ":" delimeters. 2N/A * We also allow a '/prefix' specifier. 2N/A * Quick and dirty parse, cheaper than inet_pton 2N/A * Could count colons and dots (must be 0 or 3 dots, no 2N/A * colons after dots seens, only one double :, etc, etc) 2N/A if (*q !=
':' && *q !=
'.' && *q !=
'/' && !
isxdigit(*q &
0xff))
2N/A#
endif /* HAVE_IPV6 */