Re: [AD] alternate entry point for allegro programs

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, 2004-08-01 at 14:31 +0200, Evert Glebbeek wrote:
> > Considering that using argv[0] can be unreliable at any rate, using this 
> if 
> > proc fs is available may not be a bad idea anyway (this can be done using 
> > a configure check at compile time, I guess...).
> > I think I'll go ahead and prepare a patch for that regardless.
> 
> Attached. Moderately tested on SuSE Linux 9.0 running kernel 2.4.21.
> I haven't eliminated the need for END_OF_MAIN() on Linux yet, although I 
> guess I could now. Note that with this patch theresult is already 
> significantly better behaved than without it. Hacking the following code 
> onto the beginning of tests/test.c (after allegro_init())
> 
> {
>    char temp[1024];
> 
>    get_executable_name(temp, 1024);
>    printf("%s\n", temp);
> }
> 
> produces the output 
> /home/allegro/Allegro/cvs/mainline/alleg_work/tests/test
> with the patch and
> tests/test
> without.
> 

Hm, this is actually against the docs, which say "full path to the
executable". So definitely looks like a good idea.

> My main concern is with the readlink function, which is neither ISO nor 
> POSIX, but BSD 4.4. I don't think this matters much in practice.
> 

Shouldn't be. Just put a config check (well, *just* is easy said here
and much harder to do from my experience with aclocal.m4 :)

-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/