Redirect support on MSX-DOS.

Post Reply
renatus_xxxx
New member
Posts: 9
Joined: Sun Oct 13, 2024 3:41 am

Redirect support on MSX-DOS.

Post by renatus_xxxx »

When compiling for MSX-DOS (using the -subtype=msxdos option), is it correct to assume that so-called redirects (like 'dir > out.txt') are not supported?
User avatar
dom
Well known member
Posts: 2316
Joined: Sun Jul 15, 2007 10:01 pm

Re: Redirect support on MSX-DOS.

Post by dom »

They should be enabled by default, you can disable them with the pragma CRT_COMMANDLINE_REDIRECTION=0

Does this question mean that they're not working for you?
renatus_xxxx
New member
Posts: 9
Joined: Sun Oct 13, 2024 3:41 am

Re: Redirect support on MSX-DOS.

Post by renatus_xxxx »

>Does this question mean that they're not working for you?

Yes, here is the code.
https://github.com/renatus-xxxx/diffly

This is how I built it:
zcc +msx -create-app -O3 -subtype=msxdos diffly.c -bn DIFFLY.COM

Thank you for your response. I really appreciate your help!
User avatar
dom
Well known member
Posts: 2316
Joined: Sun Jul 15, 2007 10:01 pm

Re: Redirect support on MSX-DOS.

Post by dom »

I think the parser is a little "picky", it looks like you have to have at least one non-redirection argument and there can't be a space between the pipe and the filename.
renatus_xxxx
New member
Posts: 9
Joined: Sun Oct 13, 2024 3:41 am

Re: Redirect support on MSX-DOS.

Post by renatus_xxxx »

Thanks for your reply, I appreciate it.

It doesn't seem to work with a combination of arguments and redirects, like this for example

diffly original.txt modified.txt > out.txt
diffly > out.txt

Is there anything that you can think of? All source code and executables can be found here
https://github.com/renatus-xxxx/diffly
stefano
Well known member
Posts: 2328
Joined: Mon Jul 16, 2007 7:39 pm

Re: Redirect support on MSX-DOS.

Post by stefano »

I think it's the same parser used by CP/M. It got partially jammed after the general crt0 rework if I'm not wrong
User avatar
dom
Well known member
Posts: 2316
Joined: Sun Jul 15, 2007 10:01 pm

Re: Redirect support on MSX-DOS.

Post by dom »

For my tests this seems to be working:

Code: Select all

#include <stdio.h>


int main(int argc, char **argv)
{
        int i;
        printf("Args count %d\n",argc);

        for ( i = 0; i < argc; i++ ) {
                printf("%d: %s\n",i, argv[i]);
        }

}
Well, subject to my caveats listed above:
Screenshot 2024-10-14 at 22.17.33.png
Ah, yes, I can definitely see a problem now.
You do not have the required permissions to view the files attached to this post.
renatus_xxxx
New member
Posts: 9
Joined: Sun Oct 13, 2024 3:41 am

Re: Redirect support on MSX-DOS.

Post by renatus_xxxx »

As you know, there seems to be no problem with the command line arguments, only with the redirection.
If you change the platform to cpm as shown below, the redirection seems to work.

-zcc +msx -create-app -O3 -subtype=msxdos diffly.c -bn DIFFLY.COM
+zcc +cpm -create-app -O3 diffly.c -bn DIFFLY.COM

In other words, there seems to be a problem only with +msx -subtype=msxdos
User avatar
dom
Well known member
Posts: 2316
Joined: Sun Jul 15, 2007 10:01 pm

Re: Redirect support on MSX-DOS.

Post by dom »

That was a good hint. The handling was different for some reason.

I have a fix including for the blank argument case I found, but I want to do a bit more testing and remove some more limitations.
stefano
Well known member
Posts: 2328
Joined: Mon Jul 16, 2007 7:39 pm

Re: Redirect support on MSX-DOS.

Post by stefano »

long ago I tuned the cp/m part a little iirc, but I'm not sure I got it perfectly reacting to all the possible combinations of >, <, >> .
User avatar
dom
Well known member
Posts: 2316
Joined: Sun Jul 15, 2007 10:01 pm

Re: Redirect support on MSX-DOS.

Post by dom »

With luck it should behave a bit better now.
renatus_xxxx
New member
Posts: 9
Joined: Sun Oct 13, 2024 3:41 am

Re: Redirect support on MSX-DOS.

Post by renatus_xxxx »

I have tried the Nightly Build version and have confirmed that the redirection issue has not been specifically resolved. cpm version is still fine, but msxdos seems to continue to have the same problem.
User avatar
dom
Well known member
Posts: 2316
Joined: Sun Jul 15, 2007 10:01 pm

Re: Redirect support on MSX-DOS.

Post by dom »

I only pushed this morning - so after the nightly build!
renatus_xxxx
New member
Posts: 9
Joined: Sun Oct 13, 2024 3:41 am

Re: Redirect support on MSX-DOS.

Post by renatus_xxxx »

Oops, sorry, I didn't get the fixes in the nightly build yet.
renatus_xxxx
New member
Posts: 9
Joined: Sun Oct 13, 2024 3:41 am

Re: Redirect support on MSX-DOS.

Post by renatus_xxxx »

I re-built with the latest NightlyBuild version.
I have confirmed that I can redirect from my application on msxdos!
Thanks!!!
Post Reply