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

Re: problem with 8-bit chars?



hzoli@xxxxxxxxxx wrote:
> Carlos Carvalho wrote:
> > 
> > version 2.6-beta10-hzoli10.3 on linux
> > 
> > I tried "lpr curr@xxxxxxx", where the @ stands for the letter i with an
> > accute accent, and got "zsh: command not found: ulo.lj". Completion on
> > the filename works fine. To manage to print I had to put the filename
> > in single quotes :-(
> > 
> > Carlos
> 
> The bug is in Peter's input patches.  It checks wether the character returned
> by ingetc() is negative or not.  If it is negative, it thinks that it is an
> error.  This only happens when history expansion is active, so single quotes
> or the nobanghist option prevents this bug.  It can be fixed by some explicit
> casts from signed  to unsigned characters, but I do not have time do play wit
> h
> that now (it is very trivial to fix, but we shold be carefull not to break
> comparison line c == HISTSPACE etc.)

1) I sent the reply by mistake just to Zoltan again.  I do that every
time I've been away from the keyboard for a while.

2) The following version is probably better anyway.  The previous
version passed a char to hwaddc() which could cause problems with K&R
compilers.  I think hwaddc() is the only place where HISTSPACE is
compared with a non-char, so casting the int to char here should be a
safe fix.  (I trust even K&R will distinguish been (i1 == i2) and
((char)i1 == (char)i2) ?)

*** Src/hist.c.us	Fri Sep 22 04:12:01 1995
--- Src/hist.c	Fri Oct  6 08:48:51 1995
***************
*** 41,47 ****
  void
  hwaddc(int c)
  {
!     if (hlastw && chline && (!(errflag || lexstop) || c == HISTSPACE)) {
  	if (c == bangchar && unset(NOBANGHIST))
  	    hwaddc('\\');
  	*hptr++ = c;
--- 41,47 ----
  void
  hwaddc(int c)
  {
!     if (hlastw && chline && (!(errflag || lexstop) || (char)c == HISTSPACE)) {
  	if (c == bangchar && unset(NOBANGHIST))
  	    hwaddc('\\');
  	*hptr++ = c;
*** Src/input.c.us	Fri Sep 22 04:12:06 1995
--- Src/input.c	Thu Oct  5 08:31:51 1995
***************
*** 109,115 ****
  	if (inbufleft) {
  	    inbufleft--;
  	    inbufct--;
! 	    return lastc = *inbufptr++;
  	}
  	/*
  	 * No characters in input buffer.
--- 109,115 ----
  	if (inbufleft) {
  	    inbufleft--;
  	    inbufct--;
! 	    return lastc = (int)(unsigned char)*inbufptr++;
  	}
  	/*
  	 * No characters in input buffer.


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