missing information in man 3 system

Peter Pentchev roam at ringlet.net
Mon Feb 11 11:59:20 UTC 2013


On Mon, Feb 11, 2013 at 06:27:57PM +0700, Erich Dollansky wrote:
> Hi,
> 
> On Mon, 11 Feb 2013 11:45:57 +0200
> Peter Pentchev <roam at ringlet.net> wrote:
> 
> > On Mon, Feb 11, 2013 at 12:04:38PM +0700, Erich Dollansky wrote:
> > > 
> > > Or did I simply miss something?
> > 
> > Yes, this is indeed the intended behavior of system(3) - it does say
> 
> ok. This is good.
> 
> Ah, this is from the description section. Which I did not read.
> 
> > 
> > 	if (WIFEXITED(code)) {
> > 		printf("The program exited with code %d\n",
> > 		    WEXITSTATUS(code));
> 
> 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 ;)
> 
> 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 
> > 
> > Hope that helps!
> 
> Yes, of course.

Glad to have been of assistance!

G'luck,
Peter

-- 
Peter Pentchev	roam at ringlet.net roam at FreeBSD.org p.penchev at 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 paradoxical.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-doc/attachments/20130211/02d0adba/attachment.sig>


More information about the freebsd-doc mailing list