Aros/Developer/Docs/Devices/Console
Introduction
editReferences
editThere should be Shell support for the '_pchar' and '_mchar' variables. If it can be added _pchar and _mchar support, then C:Pipe command can be added to support it. BTW: Open("PIPE:*",...) now opens an automatically named piped.
Use NameFromFH() to get the name of its opposite. ie to implement something similar to the Unix pipe() call:
BOOL Pipe(BPTR pipe[2]) { char buff[64]; pipe[1]=Open("PIPE:*", MODE_NEWFILE); if (pipe[1]) { char buff[64]; if (NameFromFH(fh_write, buff, sizeof(buff)) != 0) { pipe[0] = Open(buff, MODE_OLDFILE); if (pipe[0]) return DOSTRUE; } Close(pipe[1]); } return DOSFALSE; }
I did some attempts but there is something strange going on with AOS _mchar.. (OS3.9+BB2)
_mchar set and command line including _mchar character: PIPE is inserted as command (just like _pchar). Even single shell line containing _mchar runs PIPE.
I didn't even have C:PIPE so I only got PIPE not found error.. how is this supposed to work?
Does this mean it is actually C:PIPE that handles both _pchar and _mchar and not shell? Shell's only task is to check if _mchar or _pchar is found in command line and inserting PIPE at the beginning of command if found?
I can implement shell change but first I need to know how to handle _mchar. It relies upon the new 'PIPE:*' autonamed pipe feature, so keep that in mind if anyone is interested in porting this back to ABI_V0.
PIPE seems to be a shell expansion that was never fully finished by commodore in 2.0, and was forgotten in later versions.
I noticed that C:Type and C:Sort can't take stdin as input.
<snip> 1> Pipe List: SYS: NOHEAD | Sort IN: OUT: | More
Notice how Sort needs `IN:' and `OUT:'. These devices don't actually exist, but the Pipe command simulates them with the PIPE:. This is necessary because C:Sort can not use the `standard IO', but insists on files. </snip>
I guess this needs to be implemented too.