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

Re: return from function terminates loop



> Returning from a function which s called from a loop appears to
> terminate the loop. Consider the following:

Now I know the reason for that breaks = 0 assignment in doshfunc!
Try this patch.

Zoltan


*** Src/exec.c	1997/01/27 22:03:20	3.1.1.11
--- Src/exec.c	1997/01/28 22:54:56
***************
*** 2520,2525 ****
--- 2520,2526 ----
      char *s, *ou;
      void *xexitfn;
      char saveopts[OPT_SIZE];
+     int obreaks = breaks;
  
      HEAPALLOC {
  	pushheap();
***************
*** 2585,2591 ****
  	zfree(locallist, sizeof(struct linklist));
  
  	locallist = olist;	/* restore the old list of local variables */
! 	retflag = 0;
  	freearray(pparams);
  	if (oargv0) {
  	    zsfree(argzero);
--- 2586,2595 ----
  	zfree(locallist, sizeof(struct linklist));
  
  	locallist = olist;	/* restore the old list of local variables */
! 	if (retflag) {
! 	    retflag = 0;
! 	    breaks = obreaks;
! 	}
  	freearray(pparams);
  	if (oargv0) {
  	    zsfree(argzero);



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