Subject: Re: NetBSD master CVS tree commits
To: None <christos@NetBSD.ORG>
From: Greg A. Woods <woods@kuma.web.net>
List: current-users
Date: 06/04/1996 10:51:38
[ On Mon, June  3, 1996 at 08:30:03 (-0400), The Source of All Evil wrote: ]
> Subject: NetBSD master CVS tree commits
>
> christos
> Mon Jun  3 08:21:19 EDT 1996
> Update of /a/cvsroot/src/bin/sh
> In directory pain.lcs.mit.edu:/a/tmp/cvs-serv12085
> 
> Modified Files:
> 	eval.c 
> Log Message:
> Fix PR/2504: return with no args returns 0 instead of the return value of
> the previous command in functions
 
I think this PR was in error.

>From P1003.2/D11.2 section 3.9.5, p. 276:

 Exit_Status

 The exit status of a function definition shall be zero if the function
 was declared successfully; otherwise, it shall be greater than zero.  The
 exit status of a function invocation shall be the exit status of the last
 command executed by the function.

(I have a hopy of Draft 12 too, I think, but it has a "gunzip:
POSIX-D12.tar.gz: invalid compressed data--crc error")

This also doesn't seem to be a bug according to current implementations,
such as my SunOS shells:

14:<woods@vex> $ uname -a
SunOS vex.net 5.5 Generic sun4m sparc SUNW,SPARCstation-20
14:<woods@vex> $ sh
$ testit ()
> {
>       false
> > }
> ^?
$ testit ()
> {
>       false
>       return
> }
$ testit
$ echo $?
255
$ 14:<woods@vex> $ ksh
14:<woods@vex> $ testit ()
> {
>         false
>         return
> }
14:<woods@vex> $ testit
14:<woods@vex> $ echo $?
1
14:<woods@vex> $ 


$ uname -a
SunOS very 4.1.1_U1 2 sun3
$ testit ()
> {
>       false
>       return
> }
$ testit
$ echo $?
1
$ 

-- 
							Greg A. Woods

+1 416 443-1734			VE3TCP			robohack!woods
Planix, Inc. <woods@planix.com>; Secrets Of The Weird <woods@weird.com>