aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-02-22 09:22:23 +0000
committerRon Yorston <rmy@pobox.com>2018-02-22 09:22:23 +0000
commitbd4bcdbd66163a0f2132ba386dd575fdfbf6f6d7 (patch)
treedac97cbaafedf1156071498d943b12c21524b2f3
parentb407c7256674c12c3d81fa11b01b5739eccd43dd (diff)
downloadbusybox-w32-bd4bcdbd66163a0f2132ba386dd575fdfbf6f6d7.tar.gz
busybox-w32-bd4bcdbd66163a0f2132ba386dd575fdfbf6f6d7.tar.bz2
busybox-w32-bd4bcdbd66163a0f2132ba386dd575fdfbf6f6d7.zip
win32: tailor inet_pton.c for use in busybox-w32
-rw-r--r--win32/inet_pton.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/win32/inet_pton.c b/win32/inet_pton.c
index ba8770d2c..310c2ce58 100644
--- a/win32/inet_pton.c
+++ b/win32/inet_pton.c
@@ -6,20 +6,11 @@
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */ 7 */
8 8
9/*! \file */ 9#include "libbb.h"
10
11#if defined(LIBC_SCCS) && !defined(lint)
12static char rcsid[] =
13 "$Id: inet_pton.c,v 1.19 2007/06/19 23:47:17 tbox Exp $";
14#endif /* LIBC_SCCS and not lint */
15
16#include <config.h>
17 10
18#include <errno.h> 11#include <errno.h>
19#include <string.h> 12#include <string.h>
20 13
21#include <isc/net.h>
22
23/*% INT16 Size */ 14/*% INT16 Size */
24#define NS_INT16SZ 2 15#define NS_INT16SZ 2
25/*% IPv4 Address Size */ 16/*% IPv4 Address Size */
@@ -33,7 +24,9 @@ static char rcsid[] =
33 */ 24 */
34 25
35static int inet_pton4(const char *src, unsigned char *dst); 26static int inet_pton4(const char *src, unsigned char *dst);
27#if ENABLE_FEATURE_IPV6
36static int inet_pton6(const char *src, unsigned char *dst); 28static int inet_pton6(const char *src, unsigned char *dst);
29#endif
37 30
38/*% 31/*%
39 * convert from presentation format (which usually means ASCII printable) 32 * convert from presentation format (which usually means ASCII printable)
@@ -46,12 +39,14 @@ static int inet_pton6(const char *src, unsigned char *dst);
46 * Paul Vixie, 1996. 39 * Paul Vixie, 1996.
47 */ 40 */
48int 41int
49isc_net_pton(int af, const char *src, void *dst) { 42inet_pton(int af, const char *src, void *dst) {
50 switch (af) { 43 switch (af) {
51 case AF_INET: 44 case AF_INET:
52 return (inet_pton4(src, dst)); 45 return (inet_pton4(src, dst));
46#if ENABLE_FEATURE_IPV6
53 case AF_INET6: 47 case AF_INET6:
54 return (inet_pton6(src, dst)); 48 return (inet_pton6(src, dst));
49#endif
55 default: 50 default:
56 errno = EAFNOSUPPORT; 51 errno = EAFNOSUPPORT;
57 return (-1); 52 return (-1);
@@ -122,6 +117,7 @@ inet_pton4(const char *src, unsigned char *dst) {
122 * \author 117 * \author
123 * Paul Vixie, 1996. 118 * Paul Vixie, 1996.
124 */ 119 */
120#if ENABLE_FEATURE_IPV6
125static int 121static int
126inet_pton6(const char *src, unsigned char *dst) { 122inet_pton6(const char *src, unsigned char *dst) {
127 static const char xdigits_l[] = "0123456789abcdef", 123 static const char xdigits_l[] = "0123456789abcdef",
@@ -204,3 +200,4 @@ inet_pton6(const char *src, unsigned char *dst) {
204 memmove(dst, tmp, NS_IN6ADDRSZ); 200 memmove(dst, tmp, NS_IN6ADDRSZ);
205 return (1); 201 return (1);
206} 202}
203#endif