From owner-freebsd-questions@FreeBSD.ORG Tue Mar 31 18:20:24 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E911110656F9 for ; Tue, 31 Mar 2009 18:20:24 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (brucec-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:c09::2]) by mx1.freebsd.org (Postfix) with ESMTP id A5F358FC13 for ; Tue, 31 Mar 2009 18:20:24 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 3414A1924A; Tue, 31 Mar 2009 19:20:28 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on muon X-Spam-Level: X-Spam-Status: No, score=-2.6 required=8.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 Received: from gluon.draftnet (unknown [IPv6:2a01:348:10f:0:240:f4ff:fe57:9871]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA; Tue, 31 Mar 2009 19:20:28 +0000 (GMT) Date: Tue, 31 Mar 2009 19:20:17 +0100 From: Bruce Cran To: Polytropon Message-ID: <20090331192017.61958b53@gluon.draftnet> In-Reply-To: <20090331112122.ae329221.freebsd@edvax.de> References: <20090331025726.GA10888@thought.org> <20090331112122.ae329221.freebsd@edvax.de> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.14.7; i386-portbld-freebsd7.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Gary Kline , FreeBSD Mailing List Subject: Re: Why?? (prog question) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Mar 2009 18:20:25 -0000 On Tue, 31 Mar 2009 11:21:22 +0200 Polytropon wrote: > 4. Use the predefined return codes, don't hardcode them. > FreeBSD has EXiT_SUCCESS and EXIT_FAILURE, they're for > maximum compatibility (such as with Linux). There are > more exit codes for differentiation, but they're specific > to FreeBSD, as far as I know. Linux seems to have adopted sysexits.h too, which provides error codes such as EX_USAGE and EX_CANTCREAT. However, in FreeBSD at least the most common programming style is to use 1 for error and 0 for success - e.g. from style(9): errx(1, "number overflowed"); -- Bruce Cran