[fpc-pascal] ParamStr(0) bug??

Bob Richards bob at tamara-b.org
Mon Apr 24 19:35:40 CEST 2006

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.


Program test;

  WriteLn('This program was executed as: ',ParamStr(0));



$ ./test
This program was executed as: /home/bob/pascal/test/test

cp test 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?


PGP Encrypted E-Mail Prefered
Public Key at: http://www.tamara-b.org/~bob/pubkey.asc

More information about the fpc-pascal mailing list