Abolute path of argv[0]
From: Alvin (replay_at_to_the_newsgroup.thanks)
Date: 11/11/05
- Next message: Jeffrey Schwab: "Re: signalling upstream"
- Previous message: Kasper Dupont: "Re: signalling upstream"
- Next in thread: HASM: "Re: Abolute path of argv[0]"
- Reply: HASM: "Re: Abolute path of argv[0]"
- Reply: John Reiser: "Re: Abolute path of argv[0]"
- Reply: Paul Pluzhnikov: "Re: Abolute path of argv[0]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 11 Nov 2005 14:02:19 GMT
Hello all,
I have a program that launches from the symlink:
/usr/local/bin/app -> /opt/MyProgram/app
What I would like to do, is have the program, app, determine that its been
launched from a symlink then to change the CWD to /opt/MyProgram.
I'm using stat(2) and the S_IFLNK flag, which works if I run the program
as /usr/local/bin/app
My problem is that /usr/local/bin is in my $PATH. Therefore, if I run the
program "app" from any directory, say $HOME, argv[0] only contains "app"
not /usr/local/bin/app.
Is there a system call that can expand argv[0] to its absolute path?
Thanks,
Alvin
- Next message: Jeffrey Schwab: "Re: signalling upstream"
- Previous message: Kasper Dupont: "Re: signalling upstream"
- Next in thread: HASM: "Re: Abolute path of argv[0]"
- Reply: HASM: "Re: Abolute path of argv[0]"
- Reply: John Reiser: "Re: Abolute path of argv[0]"
- Reply: Paul Pluzhnikov: "Re: Abolute path of argv[0]"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|