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

Re: return from function terminates loop



Works like a charm, thanks

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

-- 

Daniel Dignam,                             
mailto:daniel@xxxxxxxxx                    
Assemblies Development                       Phone: +44 1223-371591
EDS Unigraphics                                FAX: +44 1223-316931

          http://www-sdl.ug.eds.com/ug_assemblies.html



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