zsh-workers
 help / color / mirror / code / Atom feed
* Bugs in 3.1.2
@ 1997-06-04 18:52 Bernd Eggink
  1997-06-04 19:44 ` Zoltan T. Hidvegi
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Eggink @ 1997-06-04 18:52 UTC (permalink / raw)
  To: zsh-workers

(I'm re-sending this because my first mail seems to have got lost).

1. There's still a minor bug in 'getopts' in 3.1.2. If the options
string contains a ':', a user supplied option ':' will be accepted.
Example:

  # tst
  while getopts ab:c opt
  do; print "option is $opt"; done
    
  tst -:        # prints 'option is :'

The easiest way to avoid this is to declare the option character ':' 
illegal. Here is a patch for "builtin.c":


2393a2394
>       lenoptstr--;
2421c2422
<     if (i == lenoptstr) {
---
>     if (i == lenoptstr || *opch == ':') {


2. 'select' still doesn't check its input correctly. As 'atoi' is used,
any string starting with a valid number is accepted. IMHO it would be
better to use 'strtol' instead and check the delimiting character. This
patch for "loop.c" does it:

123c123
<     char *str, *s;
---
>     char *str, *s, *estr;
126c126
<     int i;
---
>     long i;
172,173c172,173
<       i = atoi(str);
<       if (!i)
---
>       i = strtol(str, &estr, 10);
>       if (!i || *estr)



-- 
Bernd Eggink
Regionales Rechenzentrum der Universitaet Hamburg
eggink@rrz.uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-06-05  7:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-04 18:52 Bugs in 3.1.2 Bernd Eggink
1997-06-04 19:44 ` Zoltan T. Hidvegi
1997-06-05  7:22   ` Bernd Eggink

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).