[haiku-development] Re: [PATCH] Buildutils on Solaris (was: Buildutils on powerpc)

  • From: Andreas Färber <andreas.faerber@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 9 Aug 2008 19:03:41 +0200


Am 09.08.2008 um 18:35 schrieb François Revol:

Google doesn't give an obvious replacement.

Some places use:
#ifndef HAVE___PROGNAME
 extern char *__progname;
 __progname = argv[0];
#endif

See
http://74.125.39.104/search?q=cache:sfGqwp8Aj7wJ:saf.bio.caltech.edu/pub/software/linux_or_unix_tools/rsh.c+solaris+replace+__progname&hl=en&ct=clnk&cd=7&client=firefox
&ct=clnk&cd=7&client=firefox

The problem with that approach was that in the relevant apps __program is only used to initialize a global static variable in the next line, and only that is used elsewhere. Wouldn't in that case assigning __progname inside main (where argv is defined) break? We could move the initialization into main though, I guess. But then again the problem was a linker problem, so "extern" still sounds wrong.

Andreas


Other related posts: