[PATCH]: Implement getprogname and setprogname

J. Johnston jjohnstn@redhat.com
Wed Nov 19 17:02:00 GMT 2003


Nicholas Wourms wrote:
> Hi all,
> 
> Corrina's latest check-in for stdlib.h prodded me into finishing the 
> documentation for my implementation of these two functions for newlib 
> (as opposed to just Cygwin).  So, I'm submitting a patch with source, 
> inline texinfo documentation, and the bsd manpage.  I am also working on 
> quite a few other bsd/SuSv3/c99 functions which seem to be located in 
> most libc's "gen" dir.  So I hope you don't mind that I created that 
> dir.  More contributions to follow.
> 
> Also, if you approve it, please commit the bzipped patch, not the 
> inlined text one, since my MUA is munging tabs and some whitespaces.
> 
> Code is based off of {Free,Net}BSD sources.
> 
> Cheers,
> Nicholas

Nicholas,

  I'm not convinced these functions are going to be overly useful outside of 
BSD.  The code is dependent on __progname being defined externally which is not 
going to occur for most, if not all, of the existing configurations.  To add 
this generically requires that a default __progname be set up somewhere and 
controlled either by a configuration option or flag.  Otherwise, you will break 
  the x86-linux build as the shared library will fail to find __progname.  I 
also question how useful this function will be without the externally set 
__progname but you might be basing a number of future functions on top of this??

  An alternative to consider is to add a libc/sys/bsd directory and add bsd 
configuration support to the top-level configure.host.  The default __progname 
instance would not be required in this case and no other configurations would be 
affected.

  If you are going to add a gen directory and have plans to add multiple 
functions in the future, then I would like to see the gen directory as optional 
(see UNIX_DIR and POSIX_DIR for example).

-- Jeff J.



More information about the Newlib mailing list