I have written a program who's behavior depends on the name by which it has been invoked. This is not uncommon, for instance sendmail invoked as mailq behaves in a completely different way.
Anyway, it all works as intended as long as I *copy* the executable to a different name. However, if I use a symlink, the ParamStr(0) function doesn't work as I would expect. It always returns the name of the executable not the name of the link to it.
Example:
Program test;
Begin
WriteLn('This program was executed as: ',ParamStr(0));
end.----
$ ./test
This program was executed as: /home/bob/pascal/test/testcp test test1
./test1
This program was executed as: /home/bob/pascal/test/test1 $
$ ln -s test test1
$ ./test1
This program was executed as: /home/bob/pascal/test/test
$-----
Is there a way to make this work properly? Another method? Is this a bug?
Bob
