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

Re: More Configure problems



> But small problem with command substitution anyway. The following:
> 
> % : `
> bquote> cat > foo << eof
> bquote> a
> bquote> eof
> bquote> `
> >        <-- !!!
> 
> runs perfectly on my /bin/sh (and should according to POSIX :)) but not
> under zsh. (Including last three patches to heredoc an $(< ...) fix). It
> wants something after the last backtick. The same problem with $() form.
> If the heredoc delimiter is quoted, it is O.K. 
> 
> % : `
> bquote> cat > foo << \eof
> bquote> a
> bquote> eof
> bquote> `
> %
> 
> Again in `` or $() form.

Yes, it is a problem, and I think it may cause problems in other
circumstances as well.  The patch below fixes that.  This bug is really
fixed by the hist.c patch below but it also contains a lex.c fix because I
first thought that the problem is there.

Zoltan


*** Src/hist.c	1996/07/21 00:05:50	2.22
--- Src/hist.c	1996/08/02 13:07:29
***************
*** 567,573 ****
  void
  strinbeg(void)
  {
!     strin = 1;
      hbegin();
      lexinit();
  }
--- 567,573 ----
  void
  strinbeg(void)
  {
!     strin++;
      hbegin();
      lexinit();
  }
***************
*** 579,585 ****
  strinend(void)
  {
      hend();
!     strin = 0;
      isfirstch = 1;
      histdone = 0;
  }
--- 579,586 ----
  strinend(void)
  {
      hend();
!     DPUTS(!strin, "BUG: strinend() called without strinbeg()");
!     strin--;
      isfirstch = 1;
      histdone = 0;
  }
*** Src/lex.c	1996/08/01 17:56:17	2.41
--- Src/lex.c	1996/08/02 13:16:25
***************
*** 65,70 ****
--- 65,71 ----
      int chwordlen;
      int chwordpos;
      int hwgetword;
+     int lexstop;
      struct heredocs *hdocs;
  
      unsigned char *cstack;
***************
*** 117,122 ****
--- 118,124 ----
      ls->chwordlen = chwordlen;
      ls->chwordpos = chwordpos;
      ls->hwgetword = hwgetword;
+     ls->lexstop = lexstop;
      ls->hdocs = hdocs;
      cmdsp = 0;
      inredir = 0;
***************
*** 162,171 ****
      chwordlen = lstack->chwordlen;
      chwordpos = lstack->chwordpos;
      hwgetword = lstack->hwgetword;
      hdocs = lstack->hdocs;
      clearalstack();
      hlinesz = lstack->hlinesz;
!     lexstop = errflag = 0;
  
      ln = lstack->next;
      free(lstack);
--- 164,174 ----
      chwordlen = lstack->chwordlen;
      chwordpos = lstack->chwordpos;
      hwgetword = lstack->hwgetword;
+     lexstop = lstack->lexstop;
      hdocs = lstack->hdocs;
      clearalstack();
      hlinesz = lstack->hlinesz;
!     errflag = 0;
  
      ln = lstack->next;
      free(lstack);
***************
*** 370,375 ****
--- 373,380 ----
    beginning:
      tokstr = NULL;
      while (iblank(c = hgetc()) && !lexstop);
+     if (lexstop)
+ 	return (errflag) ? LEXERR : ENDINPUT;
      isfirstln = 0;
      wordbeg = inbufct - (qbang && c == bangchar);
      hwbegin(-1);		/* word includes the last character read */
***************
*** 390,400 ****
  	return DOUTPAR;
      } else if (idigit(c)) {	/* handle 1< foo */
  	d = hgetc();
- 	hungetc(d);
- 	lexstop = 0;
  	if (d == '>' || d == '<') {
  	    peekfd = c - '0';
! 	    c = hgetc();
  	}
      }
  
--- 395,406 ----
  	return DOUTPAR;
      } else if (idigit(c)) {	/* handle 1< foo */
  	d = hgetc();
  	if (d == '>' || d == '<') {
  	    peekfd = c - '0';
! 	    c = d;
! 	} else {
! 	    hungetc(d);
! 	    lexstop = 0;
  	}
      }
  
***************
*** 423,430 ****
  	}
  	return peek;
      }
-     if (lexstop)
- 	return (errflag) ? LEXERR : ENDINPUT;
      switch (lexact1[STOUC(c)]) {
      case LX1_BKSLASH:
  	d = hgetc();
--- 429,434 ----



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