Module Name:    src
Committed By:   christos
Date:           Thu Jan 29 19:26:20 UTC 2015

Modified Files:
        src/usr.bin/m4: Makefile eval.c

Log Message:
use strtoi instead of strtonum, since this is a tool.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/m4/Makefile
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/m4/eval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/m4/Makefile
diff -u src/usr.bin/m4/Makefile:1.18 src/usr.bin/m4/Makefile:1.19
--- src/usr.bin/m4/Makefile:1.18	Thu Jan 29 08:20:51 2015
+++ src/usr.bin/m4/Makefile	Thu Jan 29 14:26:20 2015
@@ -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 \

Index: src/usr.bin/m4/eval.c
diff -u src/usr.bin/m4/eval.c:1.22 src/usr.bin/m4/eval.c:1.23
--- src/usr.bin/m4/eval.c:1.22	Sun Aug 21 19:38:43 2011
+++ src/usr.bin/m4/eval.c	Thu Jan 29 14:26:20 2015
@@ -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 <sys/cdefs.h>
-__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 <sys/types.h>
 #include <err.h>
@@ -54,6 +54,7 @@ __RCSID("$NetBSD: eval.c,v 1.22 2011/08/
 #include <stddef.h>
 #include <stdint.h>
 #include <string.h>
+#include <inttypes.h>
 #include <fcntl.h>
 #include "mdef.h"
 #include "stdd.h"
@@ -180,17 +181,17 @@ expand_builtin(const char *argv[], int a
 	{
 		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 {

Reply via email to