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
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
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
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