Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/m4 eval: Make radix optional even if minimum result ...



details:   https://anonhg.NetBSD.org/src/rev/f713eb95c41d
branches:  trunk
changeset: 973353:f713eb95c41d
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sat Jun 27 19:18:58 2020 +0000

description:
eval: Make radix optional even if minimum result width is specified.
This is what GNU m4 does too.

diffstat:

 usr.bin/m4/eval.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 0e843fda486b -r f713eb95c41d usr.bin/m4/eval.c
--- a/usr.bin/m4/eval.c Sat Jun 27 19:07:15 2020 +0000
+++ b/usr.bin/m4/eval.c Sat Jun 27 19:18:58 2020 +0000
@@ -1,5 +1,5 @@
 /*     $OpenBSD: eval.c,v 1.66 2008/08/21 21:01:47 espie Exp $ */
-/*     $NetBSD: eval.c,v 1.27 2018/07/30 22:58:09 kre Exp $    */
+/*     $NetBSD: eval.c,v 1.28 2020/06/27 19:18:58 uwe Exp $    */
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@
 #include "nbtool_config.h"
 #endif
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: eval.c,v 1.27 2018/07/30 22:58:09 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.28 2020/06/27 19:18:58 uwe Exp $");
 
 #include <sys/types.h>
 #include <ctype.h>
@@ -184,7 +184,7 @@
                int maxdigits = 0;
                int e;
 
-               if (argc > 3) {
+               if (argc > 3 && *argv[3] != '\0') {
                        base = strtoi(argv[3], NULL, 0, 2, 36, &e);
                        if (e) {
                                m4errx(1, "expr: base %s invalid.", argv[3]);



Home | Main Index | Thread Index | Old Index