1/*
2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (c) 1996,1999 by Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#if defined(LIBC_SCCS) && !defined(lint)
19static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.1.2.1.8.1 2004/03/09 08:33:32 marka Exp $";
20#endif
21#include <sys/cdefs.h>
22__FBSDID("$FreeBSD: head/lib/libc/inet/inet_net_ntop.c 156956 2006-03-21 15:37:16Z ume $");
23
24#include "port_before.h"
25
26#include <sys/types.h>
27#include <sys/socket.h>
28#include <netinet/in.h>
29#include <arpa/inet.h>
30
--- 230 unchanged lines hidden (view full) ---
261 if (cp != outbuf)
262 *cp++ = ':';
263 cp += SPRINTF((cp, "%x", *s * 256 + s[1]));
264 s += 2;
265 }
266 }
267 }
268 /* Format CIDR /width. */
269 SPRINTF((cp, "/%u", bits));
270 if (strlen(outbuf) + 1 > size)
271 goto emsgsize;
272 strcpy(dst, outbuf);
273
274 return (dst);
275
276emsgsize:
277 errno = EMSGSIZE;
278 return (NULL);
279}
280
281/*
282 * Weak aliases for applications that use certain private entry points,
283 * and fail to include <arpa/inet.h>.
284 */
285#undef inet_net_ntop
286__weak_reference(__inet_net_ntop, inet_net_ntop);
2 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (c) 1996,1999 by Internet Software Consortium.
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#if defined(LIBC_SCCS) && !defined(lint)
19static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.1.2.1.8.1 2004/03/09 08:33:32 marka Exp $";
20#endif
21#include <sys/cdefs.h>
22__FBSDID("$FreeBSD: head/lib/libc/inet/inet_net_ntop.c 156956 2006-03-21 15:37:16Z ume $");
23
24#include "port_before.h"
25
26#include <sys/types.h>
27#include <sys/socket.h>
28#include <netinet/in.h>
29#include <arpa/inet.h>
30
--- 230 unchanged lines hidden (view full) ---
261 if (cp != outbuf)
262 *cp++ = ':';
263 cp += SPRINTF((cp, "%x", *s * 256 + s[1]));
264 s += 2;
265 }
266 }
267 }
268 /* Format CIDR /width. */
269 SPRINTF((cp, "/%u", bits));
270 if (strlen(outbuf) + 1 > size)
271 goto emsgsize;
272 strcpy(dst, outbuf);
273
274 return (dst);
275
276emsgsize:
277 errno = EMSGSIZE;
278 return (NULL);
279}
280
281/*
282 * Weak aliases for applications that use certain private entry points,
283 * and fail to include <arpa/inet.h>.
284 */
285#undef inet_net_ntop
286__weak_reference(__inet_net_ntop, inet_net_ntop);