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

Mike Frysinger vapier at gentoo.org
Sat Apr 18 21:01:36 UTC 2009


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
-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/462d9549/attachment.pgp>


More information about the busybox mailing list