What is the canonical way to determine *my* application's truepath in Posix? Bash's $0 seems to do it, but after reading the sourcecode for coreutils all I can see is:
(1) If argv[0] starts with a "/", use that. (2) If not, search the path for argv[0]. If found, use that. (3) Otherwise, use "current-dir/argv[0]". In Windows you can use GetModuleFileName to get the process or shared library filename: is there a Posix service like that? Also: To resolve symlinks into the "real" path, the manpage for realpath says "BUGS: don't use this function." So far I'm shelling to 'readlink -f', as 'man 2 readlink' doesn't provide the '-f' option, and I'd have to duplicate all the code of 'readlink.c' (i.e., the recursive calls to readlink() and lib/canonicalize.c). What's the 'right' way to do that in C? Provide all my own code? Or is there a POSIX service? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]