[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Help please!!



Well, FOA thanx for everyone who replied my mail.

Ysy, I saw in libc the following line of code

exit(main(.....));

So, when main returns to libc, libc exit()'s with this return value. If main
itself calls exit(x), then it never returns to libc and the exit code is x.

I believe this exit code is captured by shell with wait() call. And, this is how
we are able to get the exit code in $?.

Any inputs on this?

--Satheesh
Arun Sharma wrote:

> On Mon, Mar 13, 2000 at 07:52:11PM +0530, Binand Raj S. wrote:
> > Consider the following:
> >
> > int main (void) {
> >    exit (3);
> >    return 100;
> > }
> >
> > Do you mean to say that this program will fetch me a return value of 100? I
> > doubt it.
>
> It will return 3, because return 100 never gets executed. The process
> terminates after exit(3).
>
> BTW, the exit(3) I mentioned in my earlier mail is exit in man page section
> 3.
>
>         -Arun
>
> -----------------------------------------------------------------------
> For information on this and other Linux India mailing lists check out
> http://lists.linux-india.org/