Re: [Freedos-user] piping .BATs (input and output)

2024-01-18 Thread Aitor Santamaría via Freedos-user
Hello!

I am not quite sure how you intend to manage the stdin input inside the
batch file, but I was wondering if you are looking for something like xargs
(from Unix) and if a port of xargs to DOS would help (extra complexity for
keeping global variables though).

Aitor


El lun, 20 nov 2023, 9:06, Rugxulo via Freedos-user <
freedos-user@lists.sourceforge.net> escribió:

> "%COMSPEC% /c work.bat >file.txt" will succeed. Everyone knows that.
>
> What I'm wondering is if the following (piping into a .BAT) is
> considered acceptable or "standard" for DOS.
>
> "prog1.exe | %COMSPEC% /c work.bat | %COMSPEC% /c fixups.bat >some.txt"
>
> Does that work like I'd expect? (Seems to ... barely.) Is it rare? Is
> it buggy? Is there a better way?
>
> I've explored several other ways in DOS, including other shells (4DOS,
> DJGPP's Bash) or just a simple wrapper .C (system) or .PAS (exec)
> program.
>
> Does anyone have experience or advice with this? (Timo Salmi's BAT FAQ
> didn't quite cover it, from a quick glance.)
>
>
> ___
> Freedos-user mailing list
> Freedos-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-user
>
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] piping .BATs (input and output)

2023-11-20 Thread Bret Johnson via Freedos-user
> What I'm wondering is if the following (piping into a .BAT) is
> considered acceptable or "standard" for DOS.
>
> "prog1.exe | %COMSPEC% /c work.bat | %COMSPEC% /c fixups.bat
> some.txt"
>
> Does that work like I'd expect? (Seems to ... barely.) Is it rare?
> Is it buggy? Is there a better way?

Though I don't know for sure, I have a couple of thoughts.  First of all, what 
you're doing isn't really piping into a batch file.  You're piping into 
%COMSPEC% which is then, at least in a sense, running the batch file sort of 
like a subroutine.  I would be very surprised if all the varied %COMSPEC%'s 
would be consistent in how they handle that.

I do know that in a "regular" program there are three different places from 
where you can normally gather input parameters: the command-line (which is 
stored in the PSP or, in certain cases, the CMDLINE environment variable), 
various environment variables, and the input pipe (through an INT 21h call).  
Those come from three very different places, and the program needs to decide in 
which order they will be processed.  Most programs I've seen don't even bother 
looking at the possibility of an input pipe and usually assume everything comes 
from the command-line via the PSP.


___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


[Freedos-user] piping .BATs (input and output)

2023-11-20 Thread Rugxulo via Freedos-user
"%COMSPEC% /c work.bat >file.txt" will succeed. Everyone knows that.

What I'm wondering is if the following (piping into a .BAT) is
considered acceptable or "standard" for DOS.

"prog1.exe | %COMSPEC% /c work.bat | %COMSPEC% /c fixups.bat >some.txt"

Does that work like I'd expect? (Seems to ... barely.) Is it rare? Is
it buggy? Is there a better way?

I've explored several other ways in DOS, including other shells (4DOS,
DJGPP's Bash) or just a simple wrapper .C (system) or .PAS (exec)
program.

Does anyone have experience or advice with this? (Timo Salmi's BAT FAQ
didn't quite cover it, from a quick glance.)


___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user