NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/38327: uu{en,de}code - any reason to use non-portable [sg]etprogname?

The following reply was made to PR bin/38327; it has been noted by GNATS.

From: Alan Barrett <>
Subject: Re: bin/38327: uu{en,de}code - any reason to use non-portable
Date: Sat, 29 Mar 2008 15:22:30 +0200

 On Sat, 29 Mar 2008, Aleksey Cheusov wrote:
 > There is no reason to use __progname or argv[0] or anything similar in
 > uu{en,de}code. Constant strings "uuencode" and "uudecode" are enough
 > because they are used only for printing a usage message.
 Try this:
        $ cp -p /usr/bin/uuencode /tmp/foobar
        $ /tmp/foobar
        usage: foobar [-m] [infile] remotefile
 If we followed your sugestion, the usage message would have referred to
 "uuencode" instead of "foobar".
 > BTW: setprogname(3) also seems useless in both programs.
 > setprogname(3):
 >      ...
 >      A program's name can only be set once, and in NetBSD that is actually
 >      done by program start-up code that is run before main() is called.
 Yes, in NetBSD, setprogname is a no-op.  However, we use it for
 portability.  If we didn't call setprogname(), then it would be much
 more difficult to provide a compatibility layer to allow getprogname()
 to work on non-NetBSD systems.  (See src/tools/compat/setprogname.c, as
 I mentioned before.)
 --apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index