Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/m4 use strtoi instead of strtonum, since this is a t...
details: https://anonhg.NetBSD.org/src/rev/5ee63d6118e1
branches: trunk
changeset: 335902:5ee63d6118e1
user: christos <christos%NetBSD.org@localhost>
date: Thu Jan 29 19:26:20 2015 +0000
description:
use strtoi instead of strtonum, since this is a tool.
diffstat:
usr.bin/m4/Makefile | 3 +--
usr.bin/m4/eval.c | 21 +++++++++++----------
2 files changed, 12 insertions(+), 12 deletions(-)
diffs (80 lines):
diff -r 4b2587b54046 -r 5ee63d6118e1 usr.bin/m4/Makefile
--- a/usr.bin/m4/Makefile Thu Jan 29 15:55:21 2015 +0000
+++ b/usr.bin/m4/Makefile Thu Jan 29 19:26:20 2015 +0000
@@ -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 -r 4b2587b54046 -r 5ee63d6118e1 usr.bin/m4/eval.c
--- a/usr.bin/m4/eval.c Thu Jan 29 15:55:21 2015 +0000
+++ b/usr.bin/m4/eval.c Thu Jan 29 19:26:20 2015 +0000
@@ -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 @@
#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 @@
{
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 @@
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 {
Home |
Main Index |
Thread Index |
Old Index