From 252971afdbab7bef8aaa7a223c5078bcfeb1962e Mon Sep 17 00:00:00 2001 From: kleink Date: Wed, 15 Sep 1999 14:21:01 +0000 Subject: [PATCH] Add indirect reference stubs for inet_[ap]ton() for environments not supporting weak aliases; addresses PR lib/7435 but leaves the original file intact. --- lib/libc/include/namespace.h | 6 +++--- lib/libc/net/Makefile.inc | 4 ++-- lib/libc/net/_inet_aton.c | 28 ++++++++++++++++++++++++++++ lib/libc/net/_inet_pton.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 lib/libc/net/_inet_aton.c create mode 100644 lib/libc/net/_inet_pton.c diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h index 1742ea823c4d..49743785073e 100644 --- a/lib/libc/include/namespace.h +++ b/lib/libc/include/namespace.h @@ -1,4 +1,4 @@ -/* $NetBSD: namespace.h,v 1.38 1999/08/17 05:20:23 mycroft Exp $ */ +/* $NetBSD: namespace.h,v 1.39 1999/09/15 14:21:01 kleink Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ #define catopen _catopen #define err _err #define errx _errx +#define inet_aton _inet_aton +#define inet_pton _inet_pton #define strtoq _strtoq #define strtouq _strtouq #define sys_errlist _sys_errlist @@ -223,7 +225,6 @@ #define hesiod_init _hesiod_init #define hesiod_resolve _hesiod_resolve #define hesiod_to_bind _hesiod_to_bind -#define inet_aton _inet_aton #define inet_lnaof _inet_lnaof #define inet_makeaddr _inet_makeaddr #define inet_net_ntop _inet_net_ntop @@ -235,7 +236,6 @@ #define inet_nsap_ntoa _inet_nsap_ntoa #define inet_ntoa _inet_ntoa #define inet_ntop _inet_ntop -#define inet_pton _inet_pton #define initgroups _initgroups #define initstate _initstate #define innetgr _innetgr diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index d743f2933649..97318d48b742 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.43 1999/07/01 18:23:53 itojun Exp $ +# $NetBSD: Makefile.inc,v 1.44 1999/09/15 14:21:02 kleink Exp $ # @(#)Makefile.inc 8.2 (Berkeley) 9/5/93 # net sources @@ -13,7 +13,7 @@ SRCS+= base64.c ethers.c gethnamaddr.c getnetnamadr.c getnetent.c getproto.c \ rcmd.c recv.c res_comp.c res_data.c res_debug.c res_init.c \ res_mkquery.c res_query.c res_send.c send.c sethostent.c -SRCS+= __dn_comp.c __res_close.c __res_send.c +SRCS+= __dn_comp.c __res_close.c __res_send.c _inet_aton.c _inet_pton.c CPPFLAGS+=-DRESOLVSORT -I. # IPv6 diff --git a/lib/libc/net/_inet_aton.c b/lib/libc/net/_inet_aton.c new file mode 100644 index 000000000000..5d39f33f9e5b --- /dev/null +++ b/lib/libc/net/_inet_aton.c @@ -0,0 +1,28 @@ +/* $NetBSD: _inet_aton.c,v 1.1 1999/09/15 14:21:03 kleink Exp $ */ + +/* + * Written by Klaus Klein, September 14, 1999. + * Public domain. + */ + +#include + +#ifdef __indr_reference +__indr_reference(_inet_aton,inet_aton) +#else + +#include +#include +#include + +extern int _inet_aton __P((const char *, struct in_addr *)); + +int +inet_aton(cp, addr) + const char *cp; + struct in_addr *addr; +{ + + return _inet_aton(cp, addr); +} +#endif diff --git a/lib/libc/net/_inet_pton.c b/lib/libc/net/_inet_pton.c new file mode 100644 index 000000000000..887cae6359c4 --- /dev/null +++ b/lib/libc/net/_inet_pton.c @@ -0,0 +1,29 @@ +/* $NetBSD: _inet_pton.c,v 1.1 1999/09/15 14:21:03 kleink Exp $ */ + +/* + * Written by Klaus Klein, September 14, 1999. + * Public domain. + */ + +#include + +#ifdef __indr_reference +__indr_reference(_inet_pton,inet_pton) +#else + +#include +#include +#include + +extern int _inet_pton __P((int, const char *, void *)); + +int +inet_pton(af, src, dst) + int af; + const char *src; + void *dst; +{ + + return _inet_pton(af, src, dst); +} +#endif