From 42e28dd7ad15f456814ed7218c20bc2d1bf37e62 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 29 Jan 2015 19:26:20 +0000 Subject: [PATCH] use strtoi instead of strtonum, since this is a tool. --- usr.bin/m4/Makefile | 3 +-- usr.bin/m4/eval.c | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile index d203789da06f..26944ebc683f 100644 --- a/usr.bin/m4/Makefile +++ b/usr.bin/m4/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.18 2015/01/29 13:20:51 christos Exp $ +# $NetBSD: Makefile,v 1.19 2015/01/29 19:26:20 christos Exp $ # # @(#)Makefile 8.1 (Berkeley) 6/6/93 @@ -8,7 +8,6 @@ PROG= m4 CPPFLAGS+= -DEXTENDED -I${.CURDIR}/lib -CPPFLAGS+= -D_OPENBSD_SOURCE SRCS= parser.y tokenizer.l eval.c expr.c look.c main.c misc.c gnum4.c trace.c .PATH: ${.CURDIR}/lib SRCS+= ohash_create_entry.c ohash_delete.c ohash_do.c ohash_entries.c \ diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c index 4b5340e3f83b..8b36406461e2 100644 --- a/usr.bin/m4/eval.c +++ b/usr.bin/m4/eval.c @@ -1,5 +1,5 @@ /* $OpenBSD: eval.c,v 1.66 2008/08/21 21:01:47 espie Exp $ */ -/* $NetBSD: eval.c,v 1.22 2011/08/21 23:38:43 dholland Exp $ */ +/* $NetBSD: eval.c,v 1.23 2015/01/29 19:26:20 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -42,7 +42,7 @@ #include "nbtool_config.h" #endif #include -__RCSID("$NetBSD: eval.c,v 1.22 2011/08/21 23:38:43 dholland Exp $"); +__RCSID("$NetBSD: eval.c,v 1.23 2015/01/29 19:26:20 christos Exp $"); #include #include @@ -54,6 +54,7 @@ __RCSID("$NetBSD: eval.c,v 1.22 2011/08/21 23:38:43 dholland Exp $"); #include #include #include +#include #include #include "mdef.h" #include "stdd.h" @@ -180,17 +181,17 @@ expand_builtin(const char *argv[], int argc, int td) { int base = 10; int maxdigits = 0; - const char *errstr; + int e; if (argc > 3) { - base = strtonum(argv[3], 2, 36, &errstr); - if (errstr) { + base = strtoi(argv[3], NULL, 0, 2, 36, &e); + if (e) { m4errx(1, "expr: base %s invalid.", argv[3]); } } if (argc > 4) { - maxdigits = strtonum(argv[4], 0, INT_MAX, &errstr); - if (errstr) { + maxdigits = strtoi(argv[4], NULL, 0, 0, INT_MAX, &e); + if (e) { m4errx(1, "expr: maxdigits %s invalid.", argv[4]); } } @@ -840,9 +841,9 @@ doundiv(const char *argv[], int argc) if (argc > 2) { for (ind = 2; ind < argc; ind++) { - const char *errstr; - n = strtonum(argv[ind], 1, INT_MAX, &errstr); - if (errstr) { + int e; + n = strtoi(argv[ind], NULL, 0, 1, INT_MAX, &e); + if (e) { if (errno == EINVAL && mimic_gnu) getdivfile(argv[ind]); } else {