[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Return code from system()



"Oliver Elphick" <olly@lfix.co.uk> writes:

>According to the man page for system(), it should return the return
>code of the command run, or else -1 or 127.
>
>For me it is returning RC * 256: that is, if the return code is 1,
>system() returns 256; if 2, 512 and so on.
>
>Code fragment:
>
>	char *s = "...";
> 	int j = system((const char *) s);
>
>dpkg -s libc5:
>
>        Version: 5.4.20-1
>
>Is this a fault in documentation, or in the libc package? Is it unique to me?

It's returning the value it gets from wait(2), the man page for which
documents some macros for decomposing it.  It's a bug in the
documentation.

-- 
Richard Kettlewell               http://www.elmail.co.uk/~richard/

Are you sure you want to quit reading news? (y or n)


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: