From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-02.scc.kit.edu (scc-mailout-kit-02.scc.kit.edu [129.13.231.82]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id 9936a8f0 for ; Fri, 6 Nov 2015 11:44:00 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-02.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1Zuk7J-0007sc-LK; Fri, 06 Nov 2015 17:43:59 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1Zuk7J-00044g-Is; Fri, 06 Nov 2015 17:43:57 +0100 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84) (envelope-from ) id 1Zuk7J-0004S0-ED; Fri, 06 Nov 2015 17:43:57 +0100 Received: from localhost (1031@localhost [local]); by localhost (OpenSMTPD) with ESMTPA id 973e95f9; Fri, 6 Nov 2015 17:43:57 +0100 (CET) Date: Fri, 6 Nov 2015 17:43:57 +0100 From: Ingo Schwarze To: discuss@mdocml.bsd.lv Cc: Joerg Sonnenberger Subject: Re: mdocml: Finally use __progname, err(3) and warn(3). Message-ID: <20151106164357.GH14370@athene.usta.de> References: <8807850261702479663.enqueue@fantadrom.bsd.lv> <20151106122857.GC27632@britannica.bec.de> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151106122857.GC27632@britannica.bec.de> User-Agent: Mutt/1.5.23 (2014-03-12) Hi Joerg, Joerg Sonnenberger wrote on Fri, Nov 06, 2015 at 01:28:57PM +0100: > On Sun, Oct 11, 2015 at 04:13:25PM -0500, schwarze@mdocml.bsd.lv wrote: >> Finally use __progname, err(3) and warn(3). >> That's more readable and less error-prone than fumbling around >> with argv[0], fprintf(3), strerror(3), perror(3), and exit(3). >> >> It's a bad idea to boycott good interfaces merely because standards >> committees ignore them. Instead, let's provide compatibility modules >> for archaic systems (like commercial Solaris) that still don't have >> them. The compat module has an UCB Copyright (c) 1993... > No, the reason to avoid it is because __progname is in the > implementation namespace and should be avoided as such. My rant in the commit message was intended to address err(3), not __progname. But i didn't make that clear. > That's why in NetBSD we introduced setprogname() and getprogname(). > On systems without __progname, they provided a clean abstraction > without messing with the implementation namespace. > On platforms with __progname, but without getprogname, the latter > is trivially implemented as returning __progname > and setprogname is a nop. I just committed a patch to switch from __progname to getprogname(3), thanks for the suggestion. I didn't bother with platforms having __progname but not getprogname(3); those can use argv[0] just like platforms having neither. Yours, Ingo -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv