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: Aleksey Cheusov <cheusov%tut.by@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/38327: uu{en,de}code - any reason to use non-portable 
[sg]etprogname?
Date: Sat, 29 Mar 2008 14:15:28 +0200

 > The following reply was made to PR bin/38327; it has been noted by GNATS.
 
 > From: Alan Barrett <apb%cequrux.com@localhost>
 > To: gnats-bugs%NetBSD.org@localhost
 > Cc: 
 > Subject: Re: bin/38327: uu{en,de}code - any reason to use non-portable
 >      [sg]etprogname?
 > Date: Sat, 29 Mar 2008 13:57:44 +0200
 
 >  On Sat, 29 Mar 2008, cheusov%tut.by@localhost wrote:
  >> There are some problems in compiling NetBSD versions of uuencode and
  >> uudecode utilities under other OSes (I need it under Linux) because
  >> these utilities are not portable enough.  Non-portable setprogname(3)
  >> and getprogname(3) functions are used.  I think there is no reason for
  >> this.
 >  
 >  Use of set/getprogname is recommended by NetBSD's style guide
 >  (src/share/misc/style), in order to increase portability.  They replace
 >  unportable uses of the __progname symbol, which is set by NetBSD's
 >  default program startup code before caling main().
 
 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.
 
    uudecode.c:
    ...
         (void)fprintf(stderr, "usage: %s [-m | -p] [file ...]\n",
                      getprogname());
    uuencode.c:
         (void)fprintf(stderr, "usage: %s [-m] [infile] remotefile\n",
                      getprogname());
 
 
 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.
 
 -- 
 Best regards, Aleksey Cheusov.
 


Home | Main Index | Thread Index | Old Index