Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: arithmetic base accepted on output but not input
- X-seq: zsh-workers 25144
- From: Peter Stephenson <pws@xxxxxxx>
- To: "Zsh hackers list" <zsh-workers@xxxxxxxxxx>
- Subject: Re: arithmetic base accepted on output but not input
- Date: Tue, 10 Jun 2008 09:42:48 +0100
- In-reply-to: <2d460de70806071143s5ca2eb76m25554ad081b35b21@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20080514102253.GA6202@xxxxxxxxxxxxxxx> <20080514114312.66719731@news01> <2d460de70806071143s5ca2eb76m25554ad081b35b21@xxxxxxxxxxxxxx>
"Richard Hartmann" wrote:
> On Wed, May 14, 2008 at 12:43 PM, Peter Stephenson <pws@xxxxxxx> wrote:
>
> > + if (pm->base < 2 || pm->base > 36) {
> > + zwarnnam(name, "invalid base: %d", pm->base);
> > + return 1;
> > + }
>
> Could you make the error messages state what range, i.e. 2 to 36,
> is allowed, please? Verbose error messages are a great thing :)
OK
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.195
diff -u -r1.195 builtin.c
--- Src/builtin.c 15 May 2008 15:51:01 -0000 1.195
+++ Src/builtin.c 10 Jun 2008 08:41:28 -0000
@@ -1745,7 +1745,8 @@
return 1;
}
if (pm->base < 2 || pm->base > 36) {
- zwarnnam(name, "invalid base: %d", pm->base);
+ zwarnnam(name, "invalid base (must be 2 to 36 inclusive): %d",
+ pm->base);
return 1;
}
} else if (always)
Index: Src/math.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/math.c,v
retrieving revision 1.31
diff -u -r1.31 math.c
--- Src/math.c 14 May 2008 10:48:28 -0000 1.31
+++ Src/math.c 10 Jun 2008 08:41:28 -0000
@@ -461,7 +461,8 @@
if(*ptr != ']')
goto bofs;
if (outputradix < 2 || outputradix > 36) {
- zerr("invalid base: %d", outputradix);
+ zerr("invalid base (must be 2 to 36 inclusive): %d",
+ outputradix);
return EOI;
}
ptr++;
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.193
diff -u -r1.193 utils.c
--- Src/utils.c 17 May 2008 22:43:27 -0000 1.193
+++ Src/utils.c 10 Jun 2008 08:41:28 -0000
@@ -1844,7 +1844,7 @@
}
inp = s;
if (base < 2 || base > 36) {
- zerr("invalid base: %d", base);
+ zerr("invalid base (must be 2 to 36 inclusive): %d", base);
return (zlong)0;
} else if (base <= 10)
for (; *s >= '0' && *s < ('0' + base); s++) {
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author