Use C89 definitions

This commit is contained in:
matt 2012-03-20 17:08:13 +00:00
parent 56a38fd9b4
commit 1f0437222e
4 changed files with 30 additions and 44 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet_cidr_pton.c,v 1.7 2012/03/13 21:13:38 christos Exp $ */
/* $NetBSD: inet_cidr_pton.c,v 1.8 2012/03/20 17:08:13 matt Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@ -22,7 +22,7 @@
#if 0
static const char rcsid[] = "Id: inet_cidr_pton.c,v 1.6 2005/04/27 04:56:19 sra Exp";
#else
__RCSID("$NetBSD: inet_cidr_pton.c,v 1.7 2012/03/13 21:13:38 christos Exp $");
__RCSID("$NetBSD: inet_cidr_pton.c,v 1.8 2012/03/20 17:08:13 matt Exp $");
#endif
#endif
@ -55,10 +55,9 @@ __RCSID("$NetBSD: inet_cidr_pton.c,v 1.7 2012/03/13 21:13:38 christos Exp $");
__weak_alias(inet_cidr_pton,_inet_cidr_pton)
#endif
static int inet_cidr_pton_ipv4 __P((const char *src, u_char *dst,
int *bits, int ipv6));
static int inet_cidr_pton_ipv6 __P((const char *src, u_char *dst,
int *bits));
static int inet_cidr_pton_ipv4(const char *src, u_char *dst,
int *bits, int ipv6);
static int inet_cidr_pton_ipv6(const char *src, u_char *dst, int *bits);
static int getbits(const char *, int ipv6);

View File

@ -20,7 +20,7 @@
#ifdef notdef
static const char rcsid[] = "Id: inet_net_ntop.c,v 1.1.2.1 2002/08/02 02:17:21 marka Exp ";
#else
__RCSID("$NetBSD: inet_net_ntop.c,v 1.2 2009/02/07 07:25:22 lukem Exp $");
__RCSID("$NetBSD: inet_net_ntop.c,v 1.3 2012/03/20 17:08:13 matt Exp $");
#endif
#endif
@ -49,10 +49,10 @@ __weak_alias(inet_net_ntop,_inet_net_ntop)
# define SPRINTF(x) sprintf x
#endif
static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
char *dst, size_t size));
static char * inet_net_ntop_ipv6 __P((const u_char *src, int bits,
char *dst, size_t size));
static char * inet_net_ntop_ipv4(const u_char *src, int bits,
char *dst, size_t size);
static char * inet_net_ntop_ipv6(const u_char *src, int bits,
char *dst, size_t size);
/*
* char *
@ -65,12 +65,7 @@ static char * inet_net_ntop_ipv6 __P((const u_char *src, int bits,
* Paul Vixie (ISC), July 1996
*/
char *
inet_net_ntop(af, src, bits, dst, size)
int af;
const void *src;
int bits;
char *dst;
size_t size;
inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
{
switch (af) {
case AF_INET:
@ -97,11 +92,7 @@ inet_net_ntop(af, src, bits, dst, size)
* Paul Vixie (ISC), July 1996
*/
static char *
inet_net_ntop_ipv4(src, bits, dst, size)
const u_char *src;
int bits;
char *dst;
size_t size;
inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
{
char *odst = dst;
char *t;
@ -176,7 +167,8 @@ inet_net_ntop_ipv4(src, bits, dst, size)
*/
static char *
inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) {
inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size)
{
u_int m;
int b;
size_t p;

View File

@ -20,7 +20,7 @@
#if 0
static const char rcsid[] = "Id: inet_net_pton.c,v 1.4.2.1 2002/08/02 02:17:21 marka Exp ";
#else
__RCSID("$NetBSD: inet_net_pton.c,v 1.3 2012/03/13 21:13:38 christos Exp $");
__RCSID("$NetBSD: inet_net_pton.c,v 1.4 2012/03/20 17:08:13 matt Exp $");
#endif
#endif
@ -71,7 +71,8 @@ __weak_alias(inet_net_pton,_inet_net_pton)
* Paul Vixie (ISC), June 1996
*/
static int
inet_net_pton_ipv4( const char *src, u_char *dst, size_t size) {
inet_net_pton_ipv4(const char *src, u_char *dst, size_t size)
{
static const char xdigits[] = "0123456789abcdef";
static const char digits[] = "0123456789";
int ch, dirty, bits;
@ -197,7 +198,8 @@ inet_net_pton_ipv4( const char *src, u_char *dst, size_t size) {
}
static int
getbits(const char *src, int *bitsp) {
getbits(const char *src, int *bitsp)
{
static const char digits[] = "0123456789";
int n;
int val;
@ -227,7 +229,8 @@ getbits(const char *src, int *bitsp) {
}
static int
getv4(const char *src, u_char *dst, int *bitsp) {
getv4(const char *src, u_char *dst, int *bitsp)
{
static const char digits[] = "0123456789";
u_char *odst = dst;
int n;
@ -270,7 +273,8 @@ getv4(const char *src, u_char *dst, int *bitsp) {
}
static int
inet_net_pton_ipv6(const char *src, u_char *dst, size_t size) {
inet_net_pton_ipv6(const char *src, u_char *dst, size_t size)
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
@ -402,7 +406,8 @@ inet_net_pton_ipv6(const char *src, u_char *dst, size_t size) {
* Paul Vixie (ISC), June 1996
*/
int
inet_net_pton(int af, const char *src, void *dst, size_t size) {
inet_net_pton(int af, const char *src, void *dst, size_t size)
{
switch (af) {
case AF_INET:
return (inet_net_pton_ipv4(src, dst, size));

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet_ntop.c,v 1.8 2009/04/12 17:07:17 christos Exp $ */
/* $NetBSD: inet_ntop.c,v 1.9 2012/03/20 17:08:13 matt Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@ -22,7 +22,7 @@
#if 0
static const char rcsid[] = "Id: inet_ntop.c,v 1.5 2005/11/03 22:59:52 marka Exp";
#else
__RCSID("$NetBSD: inet_ntop.c,v 1.8 2009/04/12 17:07:17 christos Exp $");
__RCSID("$NetBSD: inet_ntop.c,v 1.9 2012/03/20 17:08:13 matt Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -66,11 +66,7 @@ static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size);
* Paul Vixie, 1996.
*/
const char *
inet_ntop(af, src, dst, size)
int af;
const void *src;
char *dst;
socklen_t size;
inet_ntop(int af, const void *src, char *dst, socklen_t size)
{
_DIAGASSERT(src != NULL);
@ -100,10 +96,7 @@ inet_ntop(af, src, dst, size)
* Paul Vixie, 1996.
*/
static const char *
inet_ntop4(src, dst, size)
const u_char *src;
char *dst;
socklen_t size;
inet_ntop4(const u_char *src, char *dst, socklen_t size)
{
char tmp[sizeof "255.255.255.255"];
int l;
@ -128,10 +121,7 @@ inet_ntop4(src, dst, size)
* Paul Vixie, 1996.
*/
static const char *
inet_ntop6(src, dst, size)
const u_char *src;
char *dst;
socklen_t size;
inet_ntop6(const u_char *src, char *dst, socklen_t size)
{
/*
* Note that int32_t and int16_t need only be "at least" large enough