use strtoi instead of strtonum, since this is a tool.
This commit is contained in:
parent
95be0d98d3
commit
42e28dd7ad
|
@ -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 \
|
||||
|
|
|
@ -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/21 23:38:43 dholland Exp $");
|
|||
#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 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 {
|
||||
|
|
Loading…
Reference in New Issue