* Re: mdocml: Finally use __progname, err(3) and warn(3). [not found] <8807850261702479663.enqueue@fantadrom.bsd.lv> @ 2015-11-06 12:28 ` Joerg Sonnenberger 2015-11-06 16:43 ` Ingo Schwarze 0 siblings, 1 reply; 4+ messages in thread From: Joerg Sonnenberger @ 2015-11-06 12:28 UTC (permalink / raw) To: discuss 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. 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. Joerg -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mdocml: Finally use __progname, err(3) and warn(3). 2015-11-06 12:28 ` mdocml: Finally use __progname, err(3) and warn(3) Joerg Sonnenberger @ 2015-11-06 16:43 ` Ingo Schwarze 2015-11-06 16:47 ` Joerg Sonnenberger 0 siblings, 1 reply; 4+ messages in thread From: Ingo Schwarze @ 2015-11-06 16:43 UTC (permalink / raw) To: discuss; +Cc: Joerg Sonnenberger 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mdocml: Finally use __progname, err(3) and warn(3). 2015-11-06 16:43 ` Ingo Schwarze @ 2015-11-06 16:47 ` Joerg Sonnenberger 2015-11-06 17:52 ` Ingo Schwarze 0 siblings, 1 reply; 4+ messages in thread From: Joerg Sonnenberger @ 2015-11-06 16:47 UTC (permalink / raw) To: discuss On Fri, Nov 06, 2015 at 05:43:57PM +0100, Ingo Schwarze wrote: > I didn't bother with platforms having __progname but not getprogname(3); > those can use argv[0] just like platforms having neither. That's fine. The note was primarily about addressing old rants from Theo about getprogname() :) Joerg -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mdocml: Finally use __progname, err(3) and warn(3). 2015-11-06 16:47 ` Joerg Sonnenberger @ 2015-11-06 17:52 ` Ingo Schwarze 0 siblings, 0 replies; 4+ messages in thread From: Ingo Schwarze @ 2015-11-06 17:52 UTC (permalink / raw) To: Joerg Sonnenberger; +Cc: discuss Hi Joerg, Joerg Sonnenberger wrote on Fri, Nov 06, 2015 at 05:47:30PM +0100: > On Fri, Nov 06, 2015 at 05:43:57PM +0100, Ingo Schwarze wrote: >> I didn't bother with platforms having __progname but not getprogname(3); >> those can use argv[0] just like platforms having neither. > That's fine. The note was primarily about addressing old rants from > Theo about getprogname() :) I seem unable to find those, but i understand that he encouraged import of getprogname(3) into OpenBSD libc and that he later said it "has the potential to be more portable": http://marc.info/?l=openbsd-cvs&m=137003410606499&w=2 http://marc.info/?l=openbsd-tech&m=139882367211410&w=2 Yours, Ingo -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-06 17:52 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <8807850261702479663.enqueue@fantadrom.bsd.lv> 2015-11-06 12:28 ` mdocml: Finally use __progname, err(3) and warn(3) Joerg Sonnenberger 2015-11-06 16:43 ` Ingo Schwarze 2015-11-06 16:47 ` Joerg Sonnenberger 2015-11-06 17:52 ` Ingo Schwarze
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).