Addition to unix: raw ByteString APIs

Evan Laforge qdunkan at gmail.com
Mon Nov 14 19:35:56 CET 2011


On Mon, Nov 14, 2011 at 9:45 AM, Brandon Allbery <allbery.b at gmail.com> wrote:
> On Mon, Nov 14, 2011 at 12:05, Balazs Komuves <bkomuves at gmail.com> wrote:
>>
>> Unfortunately, there is no standardized way on different unix systems
>> to access the path of the executable running (it's not even fully
>> clear what it means in the presence of symlinks, etc). Actually it seems
>> to be impossible to do this (without argv[0]) on certain BSD systems.
>
> Also note:
> - argv[0] won't be a full pathname if the program was found via $PATH search

Well yes, granted it's not reliable under all possible circumstances
and all possible unixes.  But it works fine for a personal tool run
under controlled circumstances.  I wound up just always calling it as
'$program $(dirname $program)' which is a bit noisy but works fine.



More information about the Libraries mailing list