Darren Reed wrote:

> ipfd.c
> Type: T
> Priority: 3
> Comments: Doing a "return (-1)" from main() doesn't make a whole lot of
> sense because $? in sh is an unsigned value of 0-255.  See wait(3c). And
> as an illustrated example:
> $ sh
> $ exit -1
> -1: bad number
> $ echo $?
> 1
> $ sh
> $ exit 255
> $ echo $?
> 255
> 

yep. To be pedantic, the arg of syscall exit(status) is defined in POSIX 
1003.1, only the least significant 8 bits will be used for an 'exit status'.

So for a program who want to return a failure, either return `1' in main()
or call exit(EXIT_FAILURE) should be OK.  right?


-- 
Thanks,
Jike Song, SW Engineer
Sun Microsystems China(ERI)
Tel: (86-10)62673147

Reply via email to