Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/lib/libc/net Pull up rev. 1.45 (itojun):



details:   https://anonhg.NetBSD.org/src/rev/6a9e9142e982
branches:  netbsd-1-5
changeset: 488481:6a9e9142e982
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jul 13 01:10:58 2000 +0000

description:
Pull up rev. 1.45 (itojun):
use strtoul() to check for all-digit string, not isdigit().  sync with kame.

diffstat:

 lib/libc/net/getaddrinfo.c |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (42 lines):

diff -r 704ba68f0fff -r 6a9e9142e982 lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Thu Jul 13 01:09:23 2000 +0000
+++ b/lib/libc/net/getaddrinfo.c        Thu Jul 13 01:10:58 2000 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: getaddrinfo.c,v 1.42 2000/04/27 05:30:22 itojun Exp $  */
-/*     $KAME: getaddrinfo.c,v 1.15 2000/04/27 03:36:25 itojun Exp $    */
+/*     $NetBSD: getaddrinfo.c,v 1.42.4.1 2000/07/13 01:10:58 thorpej Exp $     */
+/*     $KAME: getaddrinfo.c,v 1.24 2000/07/09 04:19:22 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -79,7 +79,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.42 2000/04/27 05:30:22 itojun Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.42.4.1 2000/07/13 01:10:58 thorpej Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -341,13 +341,14 @@
 str_isnumber(p)
        const char *p;
 {
-       const char *q = (const char *)p;
-       while (*q) {
-               if (!isdigit(*q))
-                       return NO;
-               q++;
-       }
-       return YES;
+       char *ep;
+
+       ep = NULL;
+       (void)strtoul(p, &ep, 10);
+       if (ep && *ep == '\0')
+               return YES;
+       else
+               return NO;
 }
 
 int



Home | Main Index | Thread Index | Old Index