Date: Mon, 11 Feb 2013 13:59:17 +0200 From: Peter Pentchev <roam@ringlet.net> To: Erich Dollansky <erichsfreebsdlist@alogt.com> Cc: freebsd-doc@freebsd.org Subject: Re: missing information in man 3 system Message-ID: <20130211115917.GA5786@straylight.m.ringlet.net> In-Reply-To: <20130211182757.475efca2@X220.ovitrap.com> References: <20130211120438.730ce5d3@X220.ovitrap.com> <20130211094557.GB5801@straylight.m.ringlet.net> <20130211182757.475efca2@X220.ovitrap.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 11, 2013 at 06:27:57PM +0700, Erich Dollansky wrote: > Hi, >=20 > On Mon, 11 Feb 2013 11:45:57 +0200 > Peter Pentchev <roam@ringlet.net> wrote: >=20 > > On Mon, Feb 11, 2013 at 12:04:38PM +0700, Erich Dollansky wrote: > > >=20 > > > Or did I simply miss something? > >=20 > > Yes, this is indeed the intended behavior of system(3) - it does say >=20 > ok. This is good. >=20 > Ah, this is from the description section. Which I did not read. >=20 > >=20 > > if (WIFEXITED(code)) { > > printf("The program exited with code %d\n", > > WEXITSTATUS(code)); >=20 > So, this is what I need. Actually you need the whole set of tests, not just the WIFEXITED case, since the program you've ran through system() may have been killed by a signal or something. > > Yes, it may seem a bit convoluted at first glance, but it is indeed > > necessary for the purpose of providing all the information in a single > > return value. Don't worry, this is something that everyone stumbles > > into when making their first steps in system programming :) (pun > > unintended ;) >=20 > This comes then from the good-old-16-bit-days of Unix. I was more > confused by the fact that my memory was right but I could not find the > description under RETURN VALUES. That=20 > >=20 > > Hope that helps! >=20 > Yes, of course. Glad to have been of assistance! G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@FreeBSD.org p.penchev@storpool.com PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13 If there were no counterfactuals, this sentence would not have been paradox= ical. --opJtzjQTFsWo+cga Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCAAGBQJRGN0QAAoJEGUe77AlJ98TNcoP/1P9N1k/J+Ux9AQGr7aj2QXj 7dl+kzSciEoAdBCLe1k/LFv+3pRzHc/fytz2xB7h9CTVRGA76UCjXJ6PTiShFMJd tOYoOfsbAfGT8/XBzD2D2C+Xop12gb62N6iwKwefkIa/Y7LpcJrGLl2r2hf6Zfoa GMsw445ZvstDDl3iu+5F8mMsXiRMGiOawcEbtw8LJFijF2Rf/vUAV+h8NLJlVb1W DnVDZkT4J7GUSULJLSlDZgUFcV2Cxki7GgKOt+BHCbguo4Yck7p2kzIU3UqwTmcs qrdAD1jdcqF9+PDqvA6Ad3EC7gFTUv2n25QVHHFwZVYDTAAevhq0JkamcKPb3t8e sMxayQmjBnMIIC73+lWn+anUazOy2xjIignI+pXf5g0ma2X9Jxrbo+2JB17Gb5Jv B1X9JTPIx19OrXzdscTVSBm13VP0JTDiax4EVFlefkvLXDRnRpt1nZfwHQt8KIPg yEIk1E4KgOR3IsEv5MVYrgIXTqkF0LM0bpF/2jeGS8zXbhmXmG/B8o843p+/wzSl Q8X9rnb7lS96vYp7PwVpxNbo5viWmoQ3NKNYhLcJLKcYzZC8EAXHZVylHxx/zMkK DfM/d1oWO0LImcAu66nmHIEKhrNcwY3atVwKoS/QT5+2CTydApQOVrZZw1R7Eixt Dy4Vv5wJxgUEPInLCV5v =iBM4 -----END PGP SIGNATURE----- --opJtzjQTFsWo+cga--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130211115917.GA5786>