From owner-freebsd-questions@FreeBSD.ORG Tue Mar 31 19:13:47 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 5D9231065677 for ; Tue, 31 Mar 2009 19:13:47 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 1A1A68FC17 for ; Tue, 31 Mar 2009 19:13:46 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r55.edvax.de (port-92-196-37-253.dynamic.qsc.de [92.196.37.253]) by mx02.qsc.de (Postfix) with ESMTP id 1257316C0159; Tue, 31 Mar 2009 21:13:46 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id n2VJDed0001546; Tue, 31 Mar 2009 21:13:40 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Tue, 31 Mar 2009 21:13:39 +0200 From: Polytropon To: Bruce Cran Message-Id: <20090331211339.e28ebd02.freebsd@edvax.de> In-Reply-To: <20090331192017.61958b53@gluon.draftnet> References: <20090331025726.GA10888@thought.org> <20090331112122.ae329221.freebsd@edvax.de> <20090331192017.61958b53@gluon.draftnet> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) 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 Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Mar 2009 19:13:47 -0000 On Tue, 31 Mar 2009 19:20:17 +0100, Bruce Cran wrote: > Linux seems to have adopted sysexits.h too, which provides error codes > such as EX_USAGE and EX_CANTCREAT. Good to know this, thanks. I'm not a big Linux user and a much smaller Linux programmer (read: I don't program for Linux), so I wasn't aware that they use it, too. > 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"); This matches the definition of the two EXIT_* variables in the standard library header file: % grep EXIT /usr/include/stdlib.h #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 It's no problem to use 0 and 1, but personally, I think the "verbose reason" is better to read. :-) And thanks for the pointer to "man 9 style", I see that I've practiced a quite good style over the years without even knowing it. :-) -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...