On Sun, Jan 9, 2022 at 1:19 PM tom ehlert <t...@drivesnapshot.de> wrote:
>
>
> > As everyone knows and the docs clearly state, everything after a REM is 
> > ignored.
>
> > However, I recently noticed an issue with a batch file that had something 
> > like:
>
> > REM this thing [[x|4]] or later
>
> > in one of its remarks. Every time the batch was executed, it
> > displayed a “4]]” command not found error.
>
> > Out of curiosity, I checked under MS-DOS 6.22. It exhibited the
> > same behavior. I have a vague recollection of noticing this decades ago as 
> > well.
>
> > It is a bug. But, it’s a bug that MS-DOS has as well.
>
> > What’s you opinion? Should FreeCOM replicate this “feature” or  fix the bug?
>
>
> IMO that's a parsing problem.
>
> is it
> (1)    REM WHATEVER
> or
> (2)    command   |   command
>
> and even if *you* think this is a bug, by definition what MSDOS 6.22
> does is the definition of how to implement stuff (unless it's a really
> obvious bug which I don't see here).
>
> so it's more of a feature, then a bug.
>


I have a paper copy of a few original MS-DOS manuals. My MS-DOS 4
manual says the only separators allowed in a comment are whitespace
but didn't mention redirection. But the MS-DOS 5 manual specifically
says *not* to use redirection in REM.

So this was a known issue in MS-DOS. It was later fixed in the Windows
CMD prompt, but the feature exists in MS-DOS COMMAND. And I think it's
important to meet the features of MS-DOS.

And it's a weird one, because one would think that REM would ignore
the *rest* of the line, like any comment. And that was probably the
intent, but that's not how it was implemented. Instead, you get MS-DOS
behavior like this:

REM > file.txt

..and then you get a zero-length FILE.TXT.


So I think the feature should stay as-is in FreeDOS. We implemented
this just like MS-DOS did. And that's good.


Jim


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to