* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.c,v 1.165 2002/03/17 18:50:21 bwelling Exp $ */
+/* $Id: rdata.c,v 1.166 2002/03/17 18:59:43 bwelling Exp $ */
#include <config.h>
#include <ctype.h>
*/
static isc_result_t
maybe_numeric(unsigned int *valuep, isc_textregion_t *source,
- unsigned int base, unsigned int max)
+ unsigned int max, isc_boolean_t hex_allowed)
{
isc_result_t result;
isc_uint32_t n;
strncpy(buffer, source->base, NUMBERSIZE);
INSIST(buffer[source->length] == '\0');
- result = isc_parse_uint32(&n, buffer, base);
+ result = isc_parse_uint32(&n, buffer, 10);
+ if (result == ISC_R_BADNUMBER && hex_allowed)
+ result = isc_parse_uint32(&n, buffer, 16);
if (result != ISC_R_SUCCESS)
return (result);
if (n > max)
isc_result_t result;
int i;
- result = maybe_numeric(valuep, source, 10, max);
+ result = maybe_numeric(valuep, source, max, ISC_FALSE);
if (result != ISC_R_BADNUMBER)
return (result);
char *text, *end;
unsigned int value, mask;
- result = maybe_numeric(&value, source, 0, 0xffff);
+ result = maybe_numeric(&value, source, 0xffff, ISC_TRUE);
if (result == ISC_R_SUCCESS) {
*flagsp = value;
return (ISC_R_SUCCESS);