[PATCH] hush.c - simple support to return from functions

Mike Frysinger vapier at gentoo.org
Sat Apr 18 21:05:22 UTC 2009


On Saturday 18 April 2009 17:01:36 Mike Frysinger wrote:
> On Friday 17 April 2009 13:27:12 Bayram Kurumahmut wrote:
> > +#if ENABLE_HUSH_FUNCTIONS
> > +static int builtin_return(char **argv)
> > +{
> > +	G.flag_function_return = true;
> > +	return EXIT_SUCCESS;
> > +}
>
> return value is incorrect.  it should return atoi(argv[1]), and in the case
> of argv[1] == NULL, it should retain the previous $? value.
>
> $ f() { $1; return; }
> $ f false; echo $?
> 1
> $ f true; echo $?
> 0

err, nm ... just read Denys' followup where he fixed this among so many other 
things.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090418/880e169f/attachment.pgp>


More information about the busybox mailing list