🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #2708

Code question

#2708
From: Dave Lowrey
Date: Wed, 13 Dec 1989 18:08
50 lines
2097 bytes
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!)
Technical Details
Message-ID: <1dOY02KV74m501@amdahl.uts.amdahl.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!apple!amdahl!dwl10

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!apple!amdahl!dwl10
From: dwl10@uts.amdahl.com (Dave Lowrey)
Newsgroups: comp.sys.amiga.tech
Subject: Code question
Keywords: dme
Message-ID: <1dOY02KV74m501@amdahl.uts.amdahl.com>
Date: 13 Dec 89 18:08:24 GMT
Organization: Amdahl Corporation, Houston TX
Lines: 50