From owner-freebsd-doc@FreeBSD.ORG Mon Feb 11 11:28:07 2013 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3615B648 for ; Mon, 11 Feb 2013 11:28:07 +0000 (UTC) (envelope-from erichsfreebsdlist@alogt.com) Received: from alogt.com (alogt.com [69.36.191.58]) by mx1.freebsd.org (Postfix) with ESMTP id E67E31ECA for ; Mon, 11 Feb 2013 11:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=bPzDdwHy3HFOI/XO+EUQqcDSPWzedRsuW6HVK1oIHeI=; b=suJQrE04HXf+DsQbFPRNja5Kzs3u54U8Q54ucLVLV2HRnfuNVZMo9RimKoHcJkBwVoMp/szlDVpZRCqfnP42DsPfKprVK7RqTGzpX2Q+80osNqFUf2uRI03p48PNU/FH; Received: from [122.129.203.50] (port=15767 helo=X220.ovitrap.com) by sl-508-2.slc.westdc.net with esmtpsa (SSLv3:DHE-RSA-AES128-SHA:128) (Exim 4.80) (envelope-from ) id 1U4rYK-0017fv-Mc; Mon, 11 Feb 2013 04:28:05 -0700 Date: Mon, 11 Feb 2013 18:27:57 +0700 From: Erich Dollansky To: Peter Pentchev Subject: Re: missing information in man 3 system Message-ID: <20130211182757.475efca2@X220.ovitrap.com> In-Reply-To: <20130211094557.GB5801@straylight.m.ringlet.net> References: <20130211120438.730ce5d3@X220.ovitrap.com> <20130211094557.GB5801@straylight.m.ringlet.net> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: Cc: freebsd-doc@freebsd.org X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Feb 2013 11:28:07 -0000 Hi, On Mon, 11 Feb 2013 11:45:57 +0200 Peter Pentchev 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. > 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. Thanks. Erich