4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 #ident "%Z%%M% %I% %E% SMI"
25 * Copyright (c) 1994-1999, by Sun Microsystems, Inc.
30 #include <sys/types.h>
31 #include <sys/socket.h>
32 #include <netinet/in.h>
33 #include <arpa/inet.h>
39 puthostent(const struct hostent
*hp
, FILE *fp
)
43 char obuf
[INET6_ADDRSTRLEN
];
49 for (p
= hp
->h_addr_list
; *p
!= 0; p
++) {
56 if (hp
->h_addrtype
== AF_INET6
) {
57 if (IN6_IS_ADDR_V4MAPPED((struct in6_addr
*)*p
)) {
58 IN6_V4MAPPED_TO_INADDR((struct in6_addr
*)*p
,
70 res
= inet_ntop(af
, addr
, obuf
, sizeof (obuf
));
75 if (fprintf(fp
, "%s\t%s", res
, hp
->h_name
) == EOF
)
77 for (q
= hp
->h_aliases
; q
&& *q
; q
++) {
78 if (fprintf(fp
, " %s", *q
) == EOF
)
81 if (putc('\n', fp
) == EOF
)
88 * getipnodebyname/addr - get entries from ipnodes database
91 dogetipnodes(const char **list
)
101 if (list
== NULL
|| *list
== NULL
) {
102 (void) fprintf(stdout
,
103 "Enumeration not supported on ipnodes\n");
105 for (; *list
!= NULL
; list
++) {
106 if (strchr(*list
, ':') != 0) {
115 if (inet_pton(af
, *list
, addr
) == 1)
116 hp
= getipnodebyaddr(addr
, len
, af
, &err_ret
);
118 hp
= getipnodebyname(
124 rc
= EXC_NAME_NOT_FOUND
;
126 (void) puthostent(hp
, stdout
);