[comp.sys.amiga.tech] Code question

dwl10@uts.amdahl.com (Dave Lowrey) (12/14/89)

I have run into a problem when running DME (v138) under SKsh.

SKsh will hang up after using theDME 'execute' command. I have isolated
it to a line of code that looks like this:

proc->pr_ConsoleTask = (APTR)BTOCP(NilFH, struct FileHandle *)->fh_Port;

The routine it is part of is: (from command.c)

do_execute()
{
    long oldlock = CurrentDir(Ep->dirlock);
    long NilFH = Open("null:", 1006);
    PROC *proc = (PROC *)FindTask(NULL);

    if (NilFH) {
	proc->pr_ConsoleTask = (APTR)BTOCP(NilFH, struct FileHandle *)->fh_Port;
	Execute(av[1], NilFH, NilFH);
	Close(NilFH);
    } else {
	title("NULL: device required for (execute)");
    }
    CurrentDir(oldlock);
}

In Matt's doc, he says that the NULL: device was used, so that he could
guarentee that 'execute' would work even if there wasn't a console window
avaliable.

Now, that weird line of code looks as if he is taking a pointer to the
NULL: FileHandle's msg port and placing that poingter in the process'
pointer to it's console task. In my book "->Task != ->MsgPort".

Can anyone explain this to me? I wrote Matt, but received no response.

To re-produce the problem:

  1 - Start up SKsh
  2 - DME
  3 - Use the execute command to run some dos command
  4 - Exit DME (You WILL (or should ) receive your SKsh prompt)
  5 - Use the SKsh exit command to terminate SKsh
  6 - SKsh, but not the system, will hang.

Thanks in advance!
-- 
"What is another word  |  Dave Lowrey    | [The opinions expressed MAY be
 for 'Thesaurus'?"     |  Amdahl Corp.   | those of the author and are not
                       |  Houston, Texas | necessarily those of his
   Steven Wright       |  amdahl!dwl10   | employer]   (`nuff said!)