Consider this batch program, stored in "test.btm":
@echo off
if "%1" == "" goto helplabel
if "%1" == "help" (
:helplabel
echo this
echo is
echo helpful
goto end
)
:end
With CMD.EXE, both "test" and "test help" produce the same 3-line output. With TC11 (TCC 11.00.44), "test" produces the 3 lines, but "test help" produces no output.
It looks like TC11 doesn't like the occurrence of a label within a command group. There's no mention of this in the "Command Grouping" documentation. In the GOTO command description, there's a discussion of "to avoid errors in the processing of nested statements", but there's no specific mention of command grouping.
Is this a doc omission?
Notes:
* Removing the "goto end" statement and the :end label produces an error: Unknown command ")"
* I realize that it would be better to implement this using GOSUB. This is code written by someone else and targeted at CMD.EXE, which I'm executing under TC11.
Tx,
John
@echo off
if "%1" == "" goto helplabel
if "%1" == "help" (
:helplabel
echo this
echo is
echo helpful
goto end
)
:end
With CMD.EXE, both "test" and "test help" produce the same 3-line output. With TC11 (TCC 11.00.44), "test" produces the 3 lines, but "test help" produces no output.
It looks like TC11 doesn't like the occurrence of a label within a command group. There's no mention of this in the "Command Grouping" documentation. In the GOTO command description, there's a discussion of "to avoid errors in the processing of nested statements", but there's no specific mention of command grouping.
Is this a doc omission?
Notes:
* Removing the "goto end" statement and the :end label produces an error: Unknown command ")"
* I realize that it would be better to implement this using GOSUB. This is code written by someone else and targeted at CMD.EXE, which I'm executing under TC11.
Tx,
John