Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2000-11

Simple source for MAKE & 0th param test

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

KO Myung-Hun

Hi...

I also know that 0th parameter is full path to program file. However,

because if a program launched by MAKE, 0th parameter is not full path to

program file, I thought it strange.

This is a simple source for MAKE & 0th parameter test.

---------- maketest.pas
program MakeTest;
uses
    Dos;
begin
    WriteLn( '----- MakeTest report ----- ' );
    WriteLn( 'ParamStr( 0 ) : ', ParamStr( 0 ));
    WriteLn( 'argv[ 0 ] : ', argv[ 0 ]);
end.
--------

-------- makefile
default :
maketest.exe
--------

If you run make and maketest, you could recognize difference of both.

I guess that this is a bug of MAKE because a program compiled by GCC also

cause the same result.

For better FPC !!!

from KO Myung-Hun...

Reply by email

Unknown author
to KO Myung-Hun

Date sent: Fri, 10 Nov 2000 23:36:49 +0900
From: KO Myung-Hun
To: FPC mail
Subject: [fpc-devel]Simple source for MAKE & 0th param test Send reply to:

Hi,

Show quoted text 7 lines
This is a simple source for MAKE & 0th parameter test. ---------- maketest.pas program MakeTest; uses Dos;

I don't think unit Dos is needed here, BTW.

Show quoted text 17 lines
begin WriteLn( '----- MakeTest report ----- ' ); WriteLn( 'ParamStr( 0 ) : ', ParamStr( 0 )); WriteLn( 'argv[ 0 ] : ', argv[ 0 ]); end. -------- -------- makefile default : maketest.exe -------- If you run make and maketest, you could recognize difference of both. I guess that this is a bug of MAKE because a program compiled by GCC also cause the same result.

Well, I've probably found the reason now. First, it isn't a problem with MAKE - a simple program with just one "Exec ('maketest.exe', '')" line shows the same behaviour. In fact, it seems to be a bug in our ParamStr (0) implementation. The problem is, that some command shells (e.g. 4os2 or FC/2 - not a real shell, right, but used that way) expand the called program to full path automatically; that's why we thought it works. Just try running your maketest.exe under plain CMD.EXE, you'll probably see the same result as with make. We'll have to fix it.
Another valuable bug report - keep them coming. ;-)

Tomas

Reply by email