diff options
author | peter <peter@FreeBSD.org> | 1997-06-27 07:25:32 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-06-27 07:25:32 +0000 |
commit | 47492cc08d0e2630b8140cc5b25e635606858ad8 (patch) | |
tree | 4a0ba15135b768bdfb39308718e7a43d6d4bada2 /contrib/bind/res/res_debug.c | |
parent | b13db018fbb01d60dabb34ce9bd3f06994fd81b7 (diff) | |
download | FreeBSD-src-47492cc08d0e2630b8140cc5b25e635606858ad8.zip FreeBSD-src-47492cc08d0e2630b8140cc5b25e635606858ad8.tar.gz |
Clean (trimmed down) import of bind-4.9.6 onto vendor branch. This is
to buy time to allow v8.1.1 to be done right rather than rushing it.
Diffstat (limited to 'contrib/bind/res/res_debug.c')
-rw-r--r-- | contrib/bind/res/res_debug.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/contrib/bind/res/res_debug.c b/contrib/bind/res/res_debug.c index 74dda53..48512fa 100644 --- a/contrib/bind/res/res_debug.c +++ b/contrib/bind/res/res_debug.c @@ -77,7 +77,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_debug.c,v 8.19 1996/11/26 10:11:23 vixie Exp $"; +static char rcsid[] = "$Id: res_debug.c,v 8.20 1997/06/01 20:34:37 vixie Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -1130,40 +1130,47 @@ static u_int8_t precsize_aton(strptr) char **strptr; { - unsigned int mval = 0, cmval = 0; u_int8_t retval = 0; - register char *cp; - register int exponent; - register int mantissa; + char *cp; + int exponent = 0; + int mantissa = 0; cp = *strptr; + while (isdigit(*cp)) { + if (mantissa == 0) + mantissa = *cp - '0'; + else + exponent++; + cp++; + } - while (isdigit(*cp)) - mval = mval * 10 + (*cp++ - '0'); - - if (*cp == '.') { /* centimeters */ + if (*cp == '.') { cp++; if (isdigit(*cp)) { - cmval = (*cp++ - '0') * 10; + if (mantissa == 0) + mantissa = *cp - '0'; + else + exponent++; + cp++; + if (isdigit(*cp)) { - cmval += (*cp++ - '0'); + if (mantissa == 0) + mantissa = *cp - '0'; + else + exponent++; + cp++; } + else + exponent++; } } - cmval = (mval * 100) + cmval; - - for (exponent = 0; exponent < 9; exponent++) - if (cmval < poweroften[exponent+1]) - break; - - mantissa = cmval / poweroften[exponent]; - if (mantissa > 9) - mantissa = 9; + else + exponent += 2; + if (mantissa == 0) + exponent = 0; retval = (mantissa << 4) | exponent; - *strptr = cp; - return (retval); } |