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

Re: Doc fix for :s/l/r/ modifier



Thorsten Meinecke wrote:
> Since aeons, the error message for `!:s//r/' (and no previous match) is:
> 
>     zsh: no previous substitution with &
> 
> This is at least confusing for the casual user.

If this substitution gives an error, then the parameter modifier sould also
give error. Here is a patch for that. It depends on my previous patch for
:s//r/ (art. 176).

Zoltan

*** 1.13	1995/07/07 15:59:57
--- Src/subst.c	1995/07/10 17:51:04
***************
*** 1476,1485 ****
  		    zsfree(hsubl);
  		    hsubl = ztrdup(ptr1);
  		}
! 		if (hsubl)
! 		    for (tt = hsubl; *tt; tt++)
! 			if (INULL(*tt))
! 			    chuck(tt);
  		for (tt = hsubr = ztrdup(ptr2); *tt; tt++)
  		    if (INULL(*tt))
  			chuck(tt);
--- 1476,1488 ----
  		    zsfree(hsubl);
  		    hsubl = ztrdup(ptr1);
  		}
! 		if (!hsubl) {
! 		    zerr("no previous substitution", NULL, 0);
! 		    return;
! 		}
! 		for (tt = hsubl; *tt; tt++)
! 		    if (INULL(*tt))
! 			chuck(tt);
  		for (tt = hsubr = ztrdup(ptr2); *tt; tt++)
  		    if (INULL(*tt))
  			chuck(tt);



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