Undo my last change: These files are used by systems only that need sys/types.h

anyway (see Guys remark on inet_pton.c).

svn path=/trunk/; revision=5947
This commit is contained in:
Jörg Mayer 2002-08-04 00:45:59 +00:00
parent 183929aad4
commit 48aa93c9ee
2 changed files with 29 additions and 13 deletions

View File

@ -43,6 +43,14 @@ static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
#include <sys/param.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@ -63,12 +71,12 @@ inet_aton(cp_arg, addr)
const char *cp_arg;
struct in_addr *addr;
{
register const guchar *cp = cp_arg;
register gulong val;
register const u_char *cp = cp_arg;
register u_long val;
register int base, n;
register guchar c;
guint parts[4];
register guint *pp = parts;
register u_char c;
u_int parts[4];
register u_int *pp = parts;
for (;;) {
/*
@ -144,6 +152,6 @@ inet_aton(cp_arg, addr)
break;
}
if (addr)
addr->s_addr = g_htonl(val);
addr->s_addr = htonl(val);
return (1);
}

View File

@ -20,13 +20,17 @@
#endif
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$Id: inet_ntop.c,v 1.4 2002/08/02 21:29:39 jmayer Exp $";
static char rcsid[] = "$Id: inet_ntop.c,v 1.5 2002/08/04 00:45:59 jmayer Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
@ -36,6 +40,10 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.4 2002/08/02 21:29:39 jmayer Exp $";
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@ -69,8 +77,8 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.4 2002/08/02 21:29:39 jmayer Exp $";
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
static const char *inet_ntop4 __P((const guchar *src, char *dst, size_t size));
static const char *inet_ntop6 __P((const guchar *src, char *dst, size_t size));
static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size));
static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size));
/* char *
* inet_ntop(af, src, dst, size)
@ -106,13 +114,13 @@ inet_ntop(af, src, dst, size)
* `dst' (as a const)
* notes:
* (1) uses no statics
* (2) takes a guchar* not an in_addr as input
* (2) takes a u_char* not an in_addr as input
* author:
* Paul Vixie, 1996.
*/
static const char *
inet_ntop4(src, dst, size)
const guchar *src;
const u_char *src;
char *dst;
size_t size;
{
@ -139,7 +147,7 @@ inet_ntop4(src, dst, size)
*/
static const char *
inet_ntop6(src, dst, size)
const guchar *src;
const u_char *src;
char *dst;
size_t size;
{
@ -152,7 +160,7 @@ inet_ntop6(src, dst, size)
*/
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
struct { int base, len; } best, cur;
guint words[NS_IN6ADDRSZ / NS_INT16SZ];
u_int words[NS_IN6ADDRSZ / NS_INT16SZ];
int i;
/*