zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: "Zsh hackers list" <zsh-workers@sunsite.dk>
Subject: Re: arithmetic base accepted on output but not input
Date: Tue, 10 Jun 2008 09:42:48 +0100	[thread overview]
Message-ID: <200806100842.m5A8gmjf023818@news01.csr.com> (raw)
In-Reply-To: <2d460de70806071143s5ca2eb76m25554ad081b35b21@mail.gmail.com>

"Richard Hartmann" wrote:
> On Wed, May 14, 2008 at 12:43 PM, Peter Stephenson <pws@csr.com> 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@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


      reply	other threads:[~2008-06-10  8:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14 10:22 Stephane Chazelas
2008-05-14 10:43 ` Peter Stephenson
2008-06-07 18:43   ` Richard Hartmann
2008-06-10  8:42     ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200806100842.m5A8gmjf023818@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).