Date: Mon, 11 Feb 2013 12:04:38 +0700 From: Erich Dollansky <erichsfreebsdlist@alogt.com> To: freebsd-doc@freebsd.org Subject: missing information in man 3 system Message-ID: <20130211120438.730ce5d3@X220.ovitrap.com>
index | next in thread | raw e-mail
Hi,
man 3 system says:
RETURN VALUES
The system() function returns the exit status of the shell as returned
by waitpid(2), or -1 if an error occurred when invoking fork(2) or
waitpid(2). A return value of 127 means the execution of the shell
failed.
It seems to me that one part is missing here. I made two small test
programs:
Program 1 in error.c
int main (void)
{
return 0x1;
}
Program 2 in show result:
int main (void)
{
printf ("Return code: %i\n", system ("error"));
return 0
}
This results in
Return code: 256
being displayed.
system () returns the result from 'error.c' in the result but shifted
by 8 bits to the left.
I could not find this behaviour in the FreeBSD documentation.
So, is this the intended behaviour of system ()?
Should the documentation be uptdated?
Or did I simply miss something?
Erich
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130211120438.730ce5d3>
