Re: [AD] [4.3] get_executable_name

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


On Wednesday 30 August 2006 2:00 am, Evert Glebbeek wrote:
> > For an absolute path in argv[0], I'll default to that, then look up
>
> procfs and
>
> > then if needed, ps. I don't like calling ps like that though.
>
> The order is more-or-less from best to worst:
> if you have getexecname(), use that
> if you don't have that but you do have a procfs that provides a symlink,
> use that (here there's a distinction between a Linux-style and SystemV
> style)
> Use ps if there is no other way.
>
> argv[0] is used if and onlyif no other method works and only if there is a
> magic main (which there normally isn't). It could arguably go before the
> pipe to ps, but it shouldn't go before either getexecname() or the procfs
> attempts (or those'd be pointless).

Yeah, after I had gone to bed, I remembered we don't want magic main anymore, 
so really, argv[0] is out.

> By the way, the function should probably store the result of the first call
> and just return that on subsequent calls instead of going through the
> hassle of searching again.

Good idea.

> Evert
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




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