zsh-workers
 help / color / mirror / code / Atom feed
* bug in 3.0.0?
@ 1996-08-21 16:39 Matt Liggett
  1996-08-21 19:14 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Liggett @ 1996-08-21 16:39 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

ancho:~ % uname -a
SunOS ancho 5.5.1 Generic sun4m sparc SUNW,SPARCstation-20
ancho:~ % echo $ZSH_VERSION
3.0.0
ancho:~ % setopt
appendhistory
autocd
autolist
autoremoveslash
nobgnice
correct
extendedhistory
histignoredups
histnostore
nohup
interactive
monitor
numericglobsort
pushdtohome
rmstarsilent
shinstdin
zle
ancho:~ % . zt
zt: parse error near `}' [13]

[the file zt is included as an attachment]

[-- Attachment #2: zt --]
[-- Type: text/plain, Size: 401 bytes --]

if [[ -z $MAIL ]] {
    if [[ $OSTYPE = (ultrix4|osf)* ]] {
       export MAIL=/usr/spool/mail/$USER 
    } elif [[ $OSTYPE = hpux9* ]] {
       export MAIL=/usr/mail/$USER 
    } elif [[ $OSTYPE = solaris2* ]] {
       export MAIL=/var/mail/$USER 
    } elif [[ $OSTYPE = sunos4* ]] {
       export MAIL=/usr/spool/mail/$USER 
    } else {
       echo 'WARNING: $MAIL' "not set for $OSTYPE."
    }
}

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

* Re: bug in 3.0.0?
  1996-08-21 16:39 bug in 3.0.0? Matt Liggett
@ 1996-08-21 19:14 ` Bart Schaefer
  1996-08-22 21:10   ` Zoltan Hidvegi
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 1996-08-21 19:14 UTC (permalink / raw)
  To: Matt Liggett, zsh-workers

On Aug 21, 12:39pm, Matt Liggett wrote:
- Subject: bug in 3.0.0?
-
- if [[ -z $MAIL ]] {
-     if [[ $OSTYPE = (ultrix4|osf)* ]] {
-        export MAIL=/usr/spool/mail/$USER 
-     } elif [[ $OSTYPE = hpux9* ]] {
-        export MAIL=/usr/mail/$USER 
-     } elif [[ $OSTYPE = solaris2* ]] {
-        export MAIL=/var/mail/$USER 
-     } elif [[ $OSTYPE = sunos4* ]] {
-        export MAIL=/usr/spool/mail/$USER 
-     } else {
-        echo 'WARNING: $MAIL' "not set for $OSTYPE."
-     }
- }

The problem is with "else { ... }".  3.0 wants a "fi" at the end of the
if/elif/else chain, even when using the { ... } form -- but only when
it ends with "else { ... }".

This seems to fix it.

*** Src/parse.c.0	Wed Aug 14 09:43:09 1996
--- Src/parse.c	Wed Aug 21 12:12:50 1996
***************
*** 676,685 ****
  	cmdpush(CS_ELSE);
  	while (tok == SEPER)
  	    yylex();
! 	l = par_list();
! 	if (tok != FI) {
! 	    cmdpop();
! 	    YYERRORV;
  	}
  	addlinknode(thensl, l);
  	nt++;
--- 676,694 ----
  	cmdpush(CS_ELSE);
  	while (tok == SEPER)
  	    yylex();
! 	if (tok == INBRACE) {
! 	    yylex();
! 	    l = par_list();
! 	    if (tok != OUTBRACE) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
! 	} else {
! 	    l = par_list();
! 	    if (tok != FI) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
  	}
  	addlinknode(thensl, l);
  	nt++;

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"


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

* Re: bug in 3.0.0?
  1996-08-21 19:14 ` Bart Schaefer
@ 1996-08-22 21:10   ` Zoltan Hidvegi
  1996-08-22 23:35     ` Semantics of compctl -X Greg J. Badros
  0 siblings, 1 reply; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-08-22 21:10 UTC (permalink / raw)
  To: schaefer; +Cc: mliggett, zsh-workers

> The problem is with "else { ... }".  3.0 wants a "fi" at the end of the
> if/elif/else chain, even when using the { ... } form -- but only when
> it ends with "else { ... }".
> 
> This seems to fix it.

That breaks

if ... ; then ... ; else { ... } ; ... fi

The patch below is a slighly modified version of Bart's patch.

Zoltan


*** Src/parse.c	1996/08/14 16:48:19	2.25
--- Src/parse.c	1996/08/22 21:07:43
***************
*** 605,611 ****
      unsigned char nc;
      LinkList ifsl, thensl;
      LinkNode no;
!     int ni = 0, nt = 0;
      List l, *ll;
  
      ifsl = newlinklist();
--- 605,611 ----
      unsigned char nc;
      LinkList ifsl, thensl;
      LinkNode no;
!     int ni = 0, nt = 0, usebrace = 0;
      List l, *ll;
  
      ifsl = newlinklist();
***************
*** 634,639 ****
--- 634,640 ----
  	xtok = FI;
  	nc = cmdstack[cmdsp - 1] == CS_IF ? CS_IFTHEN : CS_ELIFTHEN;
  	if (tok == THEN) {
+ 	    usebrace = 0;
  	    cmdpop();
  	    cmdpush(nc);
  	    yylex();
***************
*** 643,648 ****
--- 644,650 ----
  	    cmdpop();
  	} else {
  	    if (tok == INBRACE) {
+ 		usebrace = 1;
  		cmdpop();
  		cmdpush(nc);
  		yylex();
***************
*** 676,685 ****
  	cmdpush(CS_ELSE);
  	while (tok == SEPER)
  	    yylex();
! 	l = par_list();
! 	if (tok != FI) {
! 	    cmdpop();
! 	    YYERRORV;
  	}
  	addlinknode(thensl, l);
  	nt++;
--- 678,696 ----
  	cmdpush(CS_ELSE);
  	while (tok == SEPER)
  	    yylex();
! 	if (tok == INBRACE && usebrace) {
! 	    yylex();
! 	    l = par_list();
! 	    if (tok != OUTBRACE) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
! 	} else {
! 	    l = par_list();
! 	    if (tok != FI) {
! 		cmdpop();
! 		YYERRORV;
! 	    }
  	}
  	addlinknode(thensl, l);
  	nt++;


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

* Semantics of compctl -X
  1996-08-22 21:10   ` Zoltan Hidvegi
@ 1996-08-22 23:35     ` Greg J. Badros
  1996-08-23 17:57       ` Zoltan Hidvegi
  0 siblings, 1 reply; 5+ messages in thread
From: Greg J. Badros @ 1996-08-22 23:35 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers

It seems that the behaviour of -X "Explanation" compctl flag has changed
since 2.5.03.  It used to work like this:

compctl -X "Testing" howdy
howdy <tab>

- would give :  "Testing"

Now, in Zsh3, however, it appears to *not* echo anything unless it's got
something to complete.

My relevant options are autolist, automenu, completealiases.  In
particular, the old behaviour seems to be used by some of the example
completions:

compctl -k '(if of conv ibs obs bs cbs files skip file seek count)' \
	-S '=' -x 's[if=], s[of=]' -f - 'C[0,conv=*,*] n[-1,,], s[conv=]' \
	-k '(ascii ebcdic ibm block unblock lcase ucase swap noerror \
sync)' \
	-q -S ',' - 'n[-1,=]' -X '<number>'  -- dd

Where -X '<number>' won't appear for me.

Am I doing something noticeable wrong?  From the code it looks like the
behaviour has changed, but then this example completion seems wrong.  I'd
like the old behaviour to be an option, as well.

Greg J. Badros
http://www.cs.duke.edu/~gjb



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

* Re: Semantics of compctl -X
  1996-08-22 23:35     ` Semantics of compctl -X Greg J. Badros
@ 1996-08-23 17:57       ` Zoltan Hidvegi
  0 siblings, 0 replies; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-08-23 17:57 UTC (permalink / raw)
  To: Greg J. Badros; +Cc: zsh-workers

> It seems that the behaviour of -X "Explanation" compctl flag has changed
> since 2.5.03.  It used to work like this:
> 
> compctl -X "Testing" howdy
> howdy <tab>
> 
> - would give :  "Testing"
> 
> Now, in Zsh3, however, it appears to *not* echo anything unless it's got
> something to complete.

It broke long ago when Zefram reorganized zle_tricky a bit.  It is
surprising that nobody noticed this since than.  The patch below should fix
it.  I'm not 100% confident that this is the right way to fix it so any
better solutions are welcome.

Zoltan


*** Src/zle_tricky.c	1996/08/11 19:15:35	2.72
--- Src/zle_tricky.c	1996/08/23 17:40:00
***************
*** 2136,2145 ****
  		strcpy((char *)line + wb, (char *)line + we);
  		we = cs = wb;
  	    }
! 	    if (nmatches>1)
  		/* There are more than one match. */
  		do_ambiguous();
! 	    else {
  		/* Only one match. */
  		do_single(amatches[0]);
  		invalidatelist();
--- 2136,2145 ----
  		strcpy((char *)line + wb, (char *)line + we);
  		we = cs = wb;
  	    }
! 	    if (nmatches > 1)
  		/* There are more than one match. */
  		do_ambiguous();
! 	    else if (nmatches == 1) {
  		/* Only one match. */
  		do_single(amatches[0]);
  		invalidatelist();
***************
*** 2147,2155 ****
  	}
  
  	/* Print the explanation string if needed. */
! 	if (!showinglist && expl && nmatches!=1) {
  	    int up;
  
  	    trashzle();
  
  	    clearflag = (isset(USEZLE) && termok &&
--- 2147,2156 ----
  	}
  
  	/* Print the explanation string if needed. */
! 	if (!showinglist && expl && !nmatches) {
  	    int up;
  
+ 	    feep();
  	    trashzle();
  
  	    clearflag = (isset(USEZLE) && termok &&
***************
*** 2953,2959 ****
      ccsuffix = cc->suffix;
  
      validlist = 1;
!     if(nmatches && !errflag)
  	return 0;
  
      if ((isf || cc->xor) && !parampre) {
--- 2954,2960 ----
      ccsuffix = cc->suffix;
  
      validlist = 1;
!     if ((nmatches || expl) && !errflag)
  	return 0;
  
      if ((isf || cc->xor) && !parampre) {


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

end of thread, other threads:[~1996-08-23 18:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-21 16:39 bug in 3.0.0? Matt Liggett
1996-08-21 19:14 ` Bart Schaefer
1996-08-22 21:10   ` Zoltan Hidvegi
1996-08-22 23:35     ` Semantics of compctl -X Greg J. Badros
1996-08-23 17:57       ` Zoltan Hidvegi

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