[comp.sys.amiga] cli <-> console.device query

G35@DHDURZ1.BITNET (11/23/87)

Last week I tried to write my own shell. Everything works fine as long as I
use Execute() to start programs. As Execute() has some drawbacks, I tried
to 'RUN' my shell-program and to 'transmit' the command line to the
CLI process. Browsing through memory I found a buffer where  the
console.device (that's what I suppose) stores keyboard entries. This buffer
can be found with
buffer=(((struct FileHandle*)BADDR(CliProcess->pr_CIS))->fh_Type)+136;
(I don't have the source actually here, might be completely wrong).
The buffer holds 256 characters and is followed by an LONG pointer,
pointing at the last byte entered.
Writing my command-line into the buffer and changing this pointer, does
in fact transmit the string to my CLI-Process, but does not start the
program, as if I had typed "command <cntl>j" into a CLI window; I have
to activate the CLI-window and press return, to make things work.
Now here are my questions:
Does anyone have an INCLUDE - File for that buffer ?
What is CLI waiting for to start ?
I'm shure that this is a totally wrong approach to the problem. I would
exepect that I have to send some message or an packet somewhere.
But what message ? where ? why ?
Anyone ?

Werner Guenther (G35@DHDURZ1.BITNET)

page@ulowell.cs.ulowell.edu (Bob Page) (11/25/87)

G35@DHDURZ1.BITNET wrote:
>I tried to 'RUN' my shell-program and to 'transmit' the command line to the
>CLI process.

RUNning a program is the same as having it in the foreground, except
that you don't have a console window and you don't have a CLI struct.
Granted, they can be pretty major differences...

> Browsing through memory I found a buffer where the console.device
>(that's what I suppose) stores keyboard entries. This buffer can be
>found with
>buffer=(((struct FileHandle*)BADDR(CliProcess->pr_CIS))->fh_Type)+136;

Holy private data space, Batman!

[I suspect it is CON: and not console.device you are looking at]

>The buffer holds 256 characters and is followed by an LONG pointer,
>pointing at the last byte entered.

Around October '85 Eric Lavitsky made the same conclusion.  I don't
know if he worked it out as well as you did, however.

>Does anyone have an INCLUDE - File for that buffer ?

Don't ever expect to see one, as you are looking into somebody's
private buffer.

>I'm shure that this is a totally wrong approach to the problem.

That's a real good bet. :-)  Expect this to break in the next KS/WB rev.
I admire your hack, though.  Maybe you should talk to Jim Goodnow :-)

..Bob
-- 
Bob Page, U of Lowell CS Dept.  page@ulowell.edu  ulowell!page
"I've never liked reality all that much, but I haven't found a
better solution."		--Dave Haynie, Commodore-Amiga

dillon@CORY.BERKELEY.EDU (Matt Dillon) (11/25/87)

>>I tried to 'RUN' my shell-program and to 'transmit' the command line to the
>>CLI process.
>
>RUNning a program is the same as having it in the foreground, except
>that you don't have a console window and you don't have a CLI struct.
>Granted, they can be pretty major differences...

	Er, no.  A RUNd program has both a console window and a CLI struct.
The problem occurs when more than one program attempts to READ from the console
window at the same time.  You usually do not RUN a shell, for instance.

>>Does anyone have an INCLUDE - File for that buffer ?
>
>Don't ever expect to see one, as you are looking into somebody's
>private buffer.

	Not only that, but you should forget you ever saw it!

				-Matt