Problem with calls in TCC batch file

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Oct 29, 2008
2
0
#1
Hi All

I've encountred a problem running jruby on my WinXP computer when attempting to start jruby in the TCC/Lite shell. I am using TCC LE 9.02.152.

I have created a test batch file which I run in TCC and in CMD shells.

CMD SHELL

C:\Test>test_class_path.bat
TEST_CP=start;C:\Test\somefile1.jar;C:\Test\somefile2.jar

TCC SHELL

[C:\Test]test_class_path.bat
TEST_CP=start;:setcp C:\Test\somefile1.jar;:setcp C:\Test\somefile2.jar


Notice the ":setcp" text

Here are the two batch files that are used to generate the above results. There are also two files named somefile1.jar and somefile2.jar in the test directory.

@echo off
rem test_class_path.bat
rem Run this batch file to see how TCC processes add data to environment var
SET TEST_CP=start
@call "_make_class_path.bat"
echo TEST_CP=%TEST_CP%
SET TEST_CP


@echo off
rem _make_class_path.bat
rem Test batch file to demo problem with batch file differences in TCC vs standard CMD.exe
SET TEST_CP=%TEST_CP%
rem ----- Set Up The Test Classpath ----------------------------------------
for %%i in ("C:\Test\*.jar") do @call :setcp %%i
goto :EOF

rem setcp subroutine
:setcp
if not "%TEST_CP%" == "" goto add
set TEST_CP=%*
goto :EOF

:add
set TEST_CP=%TEST_CP%;%*
goto :EOF


Is this a bug in TCC?

Thanks
Rudi
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,384
39
Albuquerque, NM
prospero.unm.edu
#2
Quite possibly. It looks like the name of the subroutine is getting into %*, which doesn't seem correct to me.

As a workaround, I think you can do the same thing more simply via something like:

set test_cp=
for %f in ( c:\test\*.jar ) set test_cp=%test_cp;%f
set test_cp=%@right[-1,%test_cp]

(Suggestion to Rex for future versions: an option to @EXPAND for user-specified separator characters?)