[comp.sys.m6809] Shell in a Window

jimomura@lsuc.uucp (Jim Omura) (06/10/88)

     What I've got is this:

1.  I've openned up a device window with DWSet() giving an int 'path'.

2.  In this device window, I've openned up an overlay window with
    OWSet().  Now, I want to run a Shell in that overlay window.
    Nothing I've tried has worked.  Testing indicates that the
    'path' number is always 3.  SS.DevNm returns a device 'W'.

     Brady seems to be doing this in Wiz, so it must be possible.
What's the secret?

Cheers! -- Jim O.
-- 
Jim Omura, 2A King George's Drive, Toronto, (416) 652-3880
ihnp4!utzoo!lsuc!jimomura
Byte Information eXchange: jimomura

jejones@mcrware.UUCP (James Jones) (06/11/88)

In article <1988Jun10.101254.14923@lsuc.uucp>, jimomura@lsuc.uucp (Jim Omura) writes:
> 2.  In this device window, I've openned up an overlay window with
>     OWSet().  Now, I want to run a Shell in that overlay window.
>     Nothing I've tried has worked.  Testing indicates that the
>     'path' number is always 3.  SS.DevNm returns a device 'W'.

I think that what you'll want to do is something like this:

in the program that opens the overlay window,

savein = dup(0);
saveout = dup(1);
saveerr = dup(2);
close(0);
close(1);
close(2);

/*
 * Of course, "3" in the following should be replaced by a variable that
 * holds the path number from opening the overlay window!
 */
dup(3);		/* will get stdin in the overlay window*/
dup(3);		/* will get stdout */
dup(3);		/* will get stderr */

/* *now* fork the shell */

close(0);
close(1);
close(2);

dup(savein);	/* put back stdin --order is important here! */
dup(saveout);	/* put back stdout */
dup(saveerr);	/* put back stderr */

close(savein);
close(saveout);
close(saverr);

On the other hand, there's always

	system("shell <>>>/3");

since the CoCo 3 shell will take /<number> to mean the path with that number.

		James Jones