zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: borsenkow.msk@sni.de
Cc: pws@ifh.de, zsh-workers@math.gatech.edu
Subject: Re: More Configure problems
Date: Fri, 2 Aug 1996 15:29:57 +0200 (MET DST)	[thread overview]
Message-ID: <199608021329.PAA04346@bolyai.cs.elte.hu> (raw)
In-Reply-To: <Pine.SV4.3.95.960802135005.10873A-100000@itsrm1> from Andrej Borsenkow at "Aug 2, 96 02:03:06 pm"

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


  reply	other threads:[~1996-08-02 13:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-31 21:11 Announcement draft Zoltan Hidvegi
1996-07-31 22:15 ` Zefram
1996-08-01  6:36 ` Bas V. de Bakker
1996-08-01  8:31   ` Peter Stephenson
1996-08-01  9:04     ` Running zsh as sh (Was: Announcement draft) Bas V. de Bakker
1996-08-01  9:10     ` Announcement draft Andrej Borsenkow
1996-08-01 13:49       ` Here docs Peter Stephenson
1996-08-01 14:07         ` Zoltan Hidvegi
1996-08-01 16:27           ` More Configure problems Peter Stephenson
1996-08-01 17:40             ` Peter Stephenson
1996-08-01 17:55               ` Zoltan Hidvegi
1996-08-01 21:03                 ` Zoltan Hidvegi
1996-08-01 23:30                   ` Zoltan Hidvegi
1996-08-02  8:32                   ` Peter Stephenson
1996-08-02 10:03                     ` Andrej Borsenkow
1996-08-02 13:29                       ` Zoltan Hidvegi [this message]
1996-08-02  1:03             ` Zefram
1996-08-01 14:42   ` Announcement draft Zoltan Hidvegi
1996-08-08 15:13 ` sh compatibility again :-> Andrej Borsenkow
1996-08-12  2:18   ` Zoltan Hidvegi
1996-08-12  4:36     ` Bart Schaefer
1996-08-12  5:00       ` Zefram
1996-08-12  6:01         ` Bart Schaefer
1996-08-12  6:34           ` Bart Schaefer
1996-08-12  6:20       ` Andrej Borsenkow

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=199608021329.PAA04346@bolyai.cs.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=borsenkow.msk@sni.de \
    --cc=pws@ifh.de \
    --cc=zsh-workers@math.gatech.edu \
    /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).