Earlier in this thread we had the question whether * could be substituted with CONSOLE:. The answer is "maybe not, it depends". Actually, if you use * or CONSOLE:, the dos.library does quite the same: It checks for the console process registered for the running process, and forwards the request to there.
What happens in the console is then up to the implementation of the console, and this "depends". For ViNCEd (see above for installation hints), the usage of CONSOLE: is related to job-control. ViNCEd can run multiple shells in the same window, and can switch between them. There is only one in the foreground, and this shell can print to the console window. All others keep in the background, and once they try to print data to the window, they get suspended. The way how ViNCEd can tell the shells apart is by the "console name" (or rather, how ViNCEd calls it, by the "owner").
So let's try this: Open a ViNCEd shell. For my system, the new shell opens as shell process #7, so it prints for me the following as prompt:
7.SCSI:>
This is "shell #7", and the directory is SCSI:, which is the name of my hard disk. Let's start a new shell under a new console owner:
7.SCSI:> newshell console:myname &
Now, the "&" at the end tells the shell to detach the next command, i.e. this is similar to "run". Equivalently, we could have used
7.SCSI:> run newshell console:myname
The result of this command is a message such as following:
[CLI 8] : newshell suspended. [ViNCEd output]
This means: A new shell had been created, shell #8, and the shell had been suspended because it tried to output something, though currently the active owner is shell #7, the one you are typing in.
You can list the active shells with the status command:
7.SCSI:> status
This will print the list of all currently active shells, and the commands they are running. Shell #7 runs the status command (clearly), shell #8 is currently idle (suspended) and runs no command.
Let's switch to shell #8 now:
7.SCSI:> fg 8
"fg" is a tiny script in s:. If it is not there, you can also type
7.SCSI:> setvnc foreground 8
which is just want the script does. It moves shell #8 in foreground, and shell #7 to background.
The prompt now tells you that you are in shell #8:
8.SCSI:>
You can place this shell back into background by "fg 7", or simply "bg", which means, "please put the current shell into background".
8.SCSI:> bg
We are now back in shell #7. For creating a new shell, ViNCEd has a short-cut. This is the keyboard combination Control+Z. It only works if the current shell is busy, i.e. you are not able to submit a command. What this keyboard combination does internally is to first pick a unique name, and then call "newshell console:xxxx" with "xxxx" replaced by that name, just to give you the chance to enter a command again.
Now, back to the consoles and the console names. Above, we created a new shell with "newshell console:myname". Clearly, any program that wants to print into "console:newname" or uses this as a path name identifies now itself as part of this new shell. "newname" identifies the "console owner", and the name of this owner is "newname". If you write into "console:newname", and this console owner is currently not in foreground, the command is suspended.
Let's try this: First switch back to shell #7, then print something to the owner of console 8, which is not in foreground:
8.SCSI:> fg 7
7.SCSI:> echo "hi" >console:myname
as a result, the echo command is suspended. Because it is suspended, the shell does not return, and you are left without a shell in the window.
What can we do? Well, fetch a free one. This is what Control+Z does, so press the control key, hold it, and press Z, then release both keys. You return to a free shell, which is shell 8.
8.SCSI:>
If you place this now into background, finally, the echo command is allowed to print.
Now, if "console:" addresses a named console, what does "console:" stand for? It is the "startup console", i.e. the console that was started along with the window. And what is "*" for? It is the "current console", namely the console that is currently active and in foreground.
Thus, "CONSOLE:" and "*" are not necessarily identical, or rather, they are only identical if the current console is the console that was created along with the window - or the only console.
Thus, it is typically safe to output to "*", as this is in foreground always, and it is not always safe to output to "CONSOLE:" as this console might be in background, and you might get suspended.
Thus, "CONSOLE:" != "*", and the file name behind "CONSOLE:" has a specific meaning, it identifies one out of several consoles that share the same window as output. All the job control and output control is done by ViNCEd, and you can switch between the consoles with the SetVNC program or tiny scripts in S:.
There are, of course, corresponding "DOS Packets" that do the switching, i.e. there is no "magic interface", but rather "job control commands" send to the console the same way output is written to the console.