Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: glob.c with comments



P.Stephenson@xxxxxxxxxxxxx wrote:
> One thing I noticed is that the code that handled {a-z} doesn't check
> for commas before or after the dash, so
> 
> % print -c foo{,-A}
> foo,  foo.  foo0  foo2  foo4  foo6  foo8  foo:  foo<  foo>  foo@  
> foo-  foo/  foo1  foo3  foo5  foo7  foo9  foo;  foo=  foo?  fooA  

I had a request to fix this.  Here's a diff against the new glob.c I
posted.

(I just replied to myself instead of the list.  I'm not getting used
to this very quickly.)

*** Src/glob.c~	Wed Jun 14 16:18:42 1995
--- Src/glob.c	Thu Jun 15 09:50:15 1995
***************
*** 1011,1020 ****
  	*np = nextnode(last);
  	return;
      }
!     if (str[2] == '-' && str[3] && str[4] == Outbrace) { /* {a-z} */
  	/* Now any other ranges present: note this only happens
! 	 * for a pattern like {<char>-<char>}, but it happens for ANY
! 	 * character <char>, so {,-z} does this (possibly a bug).
  	 */
  	char c1, c2;
  
--- 1011,1021 ----
  	*np = nextnode(last);
  	return;
      }
!     if (str[2] == '-' && str[3] && str[4] == Outbrace
! 	&& str[1] != Comma && str[3] != Comma) { /* {a-z} */
  	/* Now any other ranges present: note this only happens
! 	 * for a pattern like {<char1>-<char2>}.  <charN> should not
! 	 * be a tokenised comma.
  	 */
  	char c1, c2;
  

-- 
Peter Stephenson <P.Stephenson@xxxxxxxxxxxxx>  Tel: +44 1792 205678 extn. 4461
WWW:  http://python.swan.ac.uk/~pypeters/      Fax: +44 1792 295324
Department of Physics, University of Wales, Swansea,
Singleton Park, Swansea, SA2 8PP, U.K.



Messages sorted by: Reverse Date, Date, Thread, Author