Esempio n. 1
0
int commonsendrexx(int komnr,int hasarg) {
  char rexxCmd[1081];
  struct RexxMsg *nikrexxmess, *mess;

  sendrexxrc = -5;
  if(!hasarg) {
    sprintf(rexxCmd, "NiKom:rexx/ExtKom%d %d %d", komnr, nodnr, inloggad);
  } else {
    sprintf(rexxCmd, "NiKom:rexx/ExtKom%d %d %d %s", komnr, nodnr, inloggad, argument);
  }

  if(!(nikrexxmess = (struct RexxMsg *) CreateRexxMsg(
      rexxport, "nik", rexxport->mp_Node.ln_Name))) {
    LogEvent(SYSTEM_LOG, ERROR, "Couldn't allocate a RexxMsg.");
    return -5;
  }
  if(!(nikrexxmess->rm_Args[0] =
       (STRPTR)CreateArgstring(rexxCmd,strlen(rexxCmd)))) {
    DeleteRexxMsg(nikrexxmess);
    LogEvent(SYSTEM_LOG, ERROR, "Couldn't allocate a rexx ArgString.");
    return -5;
  }

  nikrexxmess->rm_Action = RXCOMM | RXFB_TOKEN;
  if(!SafePutToPort((struct Message *)nikrexxmess, "REXX")) {
    LogEvent(SYSTEM_LOG, ERROR, "Can't launch ARexx script, REXX port not found.");
    return -5;
  }

  for(;;) {
    mess = (struct RexxMsg *)WaitPort(rexxport);
    while(mess = (struct RexxMsg *)GetMsg(rexxport)) {
      if(mess->rm_Node.mn_Node.ln_Type == NT_REPLYMSG) {
        DeleteArgstring(nikrexxmess->rm_Args[0]);
        if(nikrexxmess->rm_Result1) {
          LogEvent(SYSTEM_LOG, WARN, "Error return code %d from ARexx script: '%s'",
                   nikrexxmess->rm_Result1, rexxCmd);
          SendString("\r\n\nError executing ARexx script.\r\n\n");
        }
        DeleteRexxMsg(nikrexxmess);
        if(!rxlinecount) {
          rxlinecount=TRUE;
          radcnt = 0;
        }
        return sendrexxrc;
      }
      handleRexxCommand(mess->rm_Args[0], mess);
      ReplyMsg((struct Message *)mess);
    }
  }
  if(carrierdropped()) return(-8);
  return(sendrexxrc);
}
Esempio n. 2
0
/*
 * This function will send a string to ARexx...
 *
 * The default host port will be that of your task...
 *
 * If you set StringFile to TRUE, it will set that bit for the message...
 *
 * Returns TRUE if it send the message, FALSE if it did not...
 */
short SendARexxMsg(AREXXCONTEXT RexxContext,char *RString,
			short StringFile)
{
    register	struct	MsgPort	*RexxPort;
    register	struct	RexxMsg	*rmsg;
    register		short	flag=FALSE;

    if (RexxContext) if (RString)
    {
	if (rmsg=CreateRexxMsg(RexxContext->ARexxPort,
			       RexxContext->Extension,
			       RexxContext->PortName))
	{
	    rmsg->rm_Action=RXCOMM | (StringFile ?
				      (1L << RXFB_STRING):0);
	    if (rmsg->rm_Args[0]=CreateArgstring(RString,
						 (LONG)strlen(RString)))
	    {
				/*
				 * We need to find the RexxPort and this needs
				 * to be done in a Forbid()
				 */
		Forbid();
		if (RexxPort=FindPort(RXSDIR))
		{
					/*
					 * We found the port, so put the
					 * message to ARexx...
					 */
		    PutMsg(RexxPort,(struct Message *)rmsg);
		    RexxContext->Outstanding+=1;
		    flag=TRUE;
		}
		else
		{
					/*
					 * No port, so clean up...
					 */
		    DeleteArgstring(rmsg->rm_Args[0]);
		    DeleteRexxMsg(rmsg);
		}
		Permit();
	    }
	    else DeleteRexxMsg(rmsg);
	}
    }
    return(flag);
}
Esempio n. 3
0
/*
 * This function returns a structure that contains the commands sent from
 * ARexx...  You will need to parse it and return the structure back
 * so that the memory can be freed...
 *
 * This returns NULL if there was no message...
 */
struct RexxMsg *GetARexxMsg(AREXXCONTEXT RexxContext)
{
    register	struct	RexxMsg	*tmp=NULL;
    register		short	flag;

    if (RexxContext)
	if (tmp=(struct RexxMsg *)GetMsg(RexxContext->ARexxPort))
    {
	if (tmp->rm_Node.mn_Node.ln_Type==NT_REPLYMSG)
	{
	    /*
	     * If we had sent a command, it would come this way...
	     *
	     * Since we don't in this simple example, we just throw
	     * away anything that looks "strange"
	     */
	    flag=FALSE;
	    if (tmp->rm_Result1) flag=TRUE;

	    /*
	     * Free the arguments and the message...
	     */
	    DeleteArgstring(tmp->rm_Args[0]);
	    DeleteRexxMsg(tmp);
	    RexxContext->Outstanding-=1;

	    /*
	     * Return the error if there was one...
	     */
	    tmp=flag ? REXX_RETURN_ERROR : NULL;
	}
    }
    return(tmp);
}
Esempio n. 4
0
void SAVEDS handler(void)
{
  struct Process *me = (struct Process *)FindTask(NULL);
  struct startMsg *smsg;
  struct MsgPort *port;
  BOOL res = FALSE;

  ENTER();

  WaitPort(&me->pr_MsgPort);
  smsg = (struct startMsg *)GetMsg(&me->pr_MsgPort);

  #if defined(__amigaos4__)
  port = AllocSysObject(ASOT_PORT, TAG_DONE);
  #else
  port = CreateMsgPort();
  #endif

  if(port != NULL)
    res = localSendRexxMsg(port, smsg->port, smsg->cmd);

  smsg->res = res;
  ReplyMsg((struct Message *)smsg);

  if(res == TRUE)
  {
    struct RexxMsg *rxmsg;

    WaitPort(port);
    rxmsg = (struct RexxMsg *)GetMsg(port);

    DeleteArgstring((APTR)rxmsg->rm_Args[0]);
    DeleteRexxMsg(rxmsg);
  }

  if(port != NULL)
  {
    #if defined(__amigaos4__)
    FreeSysObject(ASOT_PORT, port);
    #else
    DeleteMsgPort(port);
    #endif
  }

  ObtainSemaphore(&OpenURLBase->libSem);
  OpenURLBase->rexx_use--;
  ReleaseSemaphore(&OpenURLBase->libSem);

  #if !defined(__amigaos4__)
  // all systems except OS4 should leave this function in forbidden state
  Forbid();
  #endif

  LEAVE();
}
Esempio n. 5
0
/*************
 * FUNCTION:		FreeRexxCommand
 * VERSION:			0.1 08.03.1995
 * DESCRIPTION:	Frees the contents of a RexxMsg
 * INPUT:			RexxMessage
 * OUTPUT:			none
 * HISTORY:       DATE		NAME		COMMENT
 *						08.03.95	ah			first release
 *************/
VOID FreeRexxCommand(struct RexxMsg *RexxMessage)
{
	/* Valid pointer given? */
	if(RexxMessage && RexxMessage->rm_Node.mn_Node.ln_Type == NT_REPLYMSG)
	{
		/* Remove argument. */
		if(RexxMessage->rm_Args[0])
			DeleteArgstring((char *)RexxMessage->rm_Args[0]);

		/* Free the message. */
		DeleteRexxMsg(RexxMessage);
	}
}
Esempio n. 6
0
// Free an ARexx message
void LIBFUNC L_FreeRexxMsgEx(REG(a0, struct RexxMsg *msg))
{
	short args;

	// Need rexx library
	if (!RexxSysBase) return;

	// Get argument count
	args=msg->rm_Action&RXARGMASK;

	// If this says there are no arguments, but Arg0 is non-null, we'll free it anyway
	if (args==0 && msg->rm_Args[0]) args=1;

	// Free all arguments
	ClearRexxMsg(msg,args);

	// Is this a DOpus message?
	if (msg->rm_Node.mn_Node.ln_Name==RexxMsgIdentifier)
	{
		struct List *list;

		// Get list pointer
		if ((list=(struct List *)msg->rm_avail))
		{
			struct RexxStem *node,*next;

			// Go through list
			for (node=(struct RexxStem *)list->lh_Head;
				node->rs_Node.ln_Succ;
				node=next)
			{
				// Cache next
				next=(struct RexxStem *)node->rs_Node.ln_Succ;

				// Free this node
				FreeVec(node);
			}

			// Free list
			FreeVec(list);
		}
	}

	// Delete the message
	DeleteRexxMsg(msg);
}
Esempio n. 7
0
int arexx_execute_script(char *command)
{
	struct RexxMsg *rxmsg;
	BPTR lock;

	if (!(lock = Lock(command,ACCESS_READ))) return 0;
	if (!(command = NameOfLock(lock)))
	{
		UnLock(lock);
		return 0;
	}

	UnLock(lock);

	if ((rxmsg = CreateRexxMsg(arexx_execute_port, "SMRX", "SIMPLEMAIL.1")))
	{
		rxmsg->rm_Args[0] = command;

		if (FillRexxMsg(rxmsg,1,0))
		{
			struct MsgPort *ap; /* Port of ARexx resident process */

			/* Init Rexx message */
			rxmsg->rm_Action = RXCOMM;/*|RXFF_NOIO;*/

			/* Find port and send message */
			Forbid();
			ap = FindPort("REXX");
			if (ap)
			{
				PutMsg(ap,(struct Message *)rxmsg);
				arexx_execute_out++;
			}
			Permit();

			return 1;
		}
		DeleteRexxMsg(rxmsg);
	}
	return 0;
}
Esempio n. 8
0
void arexx_cleanup(void)
{
	if (arexx_port)
	{
		RemPort(arexx_port);
		DeleteMsgPort(arexx_port);
	}

	while (arexx_execute_out)
	{
		struct RexxMsg *rxmsg;

		WaitPort(arexx_execute_port);
		while ((rxmsg = (struct RexxMsg *)GetMsg(arexx_execute_port)))
		{
			arexx_execute_out--;
			ClearRexxMsg(rxmsg,1);
			DeleteRexxMsg(rxmsg);
		}
	}
	if (arexx_execute_port) DeleteMsgPort(arexx_execute_port);
}
Esempio n. 9
0
/*************
 * FUNCTION:		SendRexxCommand
 * VERSION:			0.1 08.03.1995
 * DESCRIPTION:	Sends a command to the rexx server, requires pointers
 *						to the MsgPort of the calling Host and the command string.
 *						File extension and host name are optional and may be
 *						NULL
 * INPUT:			HostPort
 *						CommandString
 *						FileExtension
 *						HostName
 * OUTPUT:			TRUE: sucessfull, else false
 * HISTORY:       DATE		NAME		COMMENT
 *						08.03.95	ah			first release
 *************/
LONG SendRexxCommand(struct MsgPort *HostPort,STRPTR CommandString,STRPTR FileExtension,STRPTR HostName)
{
	struct MsgPort	*RexxPort = (struct MsgPort *)FindPort(RXSDIR);
	struct RexxMsg	*HostMessage;

	/* Valid pointers given? */
	if(CommandString && HostPort && RexxPort)
	{
		/* No special host name given? Take the MsgPort name. */
		if(!HostName)
			HostName = (STRPTR)HostPort->mp_Node.ln_Name;

		/* No file name extension? Take the default. */
		if(!FileExtension)
			FileExtension = (STRPTR)"rexx";

		/* Create the message. */
		HostMessage = CreateRexxMsg((struct MsgPort *)HostPort,(char *)FileExtension,(char *)HostName);
		if(HostMessage)
		{
			/* Add the command. */
			HostMessage->rm_Args[0] = CreateArgstring((char *)CommandString,strlen((char *)CommandString));
			if(HostMessage->rm_Args[0])
			{
				/* This is a command, not a function. */
				HostMessage->rm_Action = RXCOMM;

				/* Release it... */
				PutMsg(RexxPort,(struct Message*)HostMessage);

				/* Successful action. */
				return(TRUE);
			}
			DeleteRexxMsg(HostMessage);
		}
	}
	return(FALSE);
}
Esempio n. 10
0
static BOOL localSendRexxMsg(struct MsgPort *reply, STRPTR rxport, STRPTR rxcmd)
{
  BOOL success = FALSE;
  struct RexxMsg *rxmsg;

  ENTER();

  if((rxmsg = CreateRexxMsg(reply, NULL, NULL)) != NULL)
  {
    rxmsg->rm_Action = RXCOMM|RXFF_STRING|RXFF_NOIO;

     if((rxmsg->rm_Args[0] = (IPTR)CreateArgstring(rxcmd,strlen(rxcmd))) != 0)
     {
       struct MsgPort *port;

       Forbid();

       if((port = FindPort(rxport)) != NULL)
       {
         PutMsg(port, (struct Message *)rxmsg);

         success = TRUE;
       }

       Permit();

       if(success == FALSE)
         DeleteArgstring((APTR)rxmsg->rm_Args[0]);
     }

     if(success == FALSE)
       DeleteRexxMsg(rxmsg);
  }

  RETURN(success);
  return success;
}
Esempio n. 11
0
/* send a message to an AREXX port.
 */
static int ADDRESS (const char *hostname, const char *cmd)
{
    struct MsgPort *RexxPort,
		   *ReplyPort;
    struct RexxMsg *HostMsg,
		   *answer;
    int result = RC_WARN;

    if (!stricmp (hostname, "COMMAND"))
	return SystemTagList(cmd,NULL);

    if ((RexxPort = (void *)FindPort (hostname))) {
	if ((ReplyPort = (void *)CreateMsgPort ())) {
	    if ((HostMsg = CreateRexxMsg (ReplyPort, NULL, hostname))) {
		unsigned int len = strlen (cmd); /* holger: trick for powerup */
		if ((HostMsg->rm_Args[0] = CreateArgstring ((char *)cmd, len))) {
		    HostMsg->rm_Action = RXCOMM | RXFF_RESULT;
		    PutMsg (RexxPort, (void*)HostMsg);
		    WaitPort (ReplyPort);
		    while (!(answer = (void *)GetMsg (ReplyPort)));
		    result = answer->rm_Result1;
		    if (result == RC_OK) {
			if (answer->rm_Result2) {
			    strncpy (RESULT,(char *)answer->rm_Result2, RESULT_LEN);
			    DeleteArgstring ((char *)answer->rm_Result2);
			} else RESULT[0] = '\0';
		    }
		    DeleteArgstring (HostMsg->rm_Args[0]);
		} else strcpy (RESULT, "Can't create argstring!");
		DeleteRexxMsg (HostMsg);
	    } else strcpy (RESULT, "Can't create rexx message!");
	    DeleteMsgPort (ReplyPort);
	} else strcpy (RESULT, "Can't alloc reply port!");
    } else sprintf (RESULT, "Port \"%s\" not found!", hostname);
    return result;
}
Esempio n. 12
0
int commonsendrexx(int komnr,int hasarg) {
        char macronamn[1081],*rexxargs1;
        int going = TRUE;
        struct RexxMsg *nikrexxmess,*tempmess;
        struct MsgPort *rexxmastport;

        sendrexxrc=-5;
        if(!hasarg)
                sprintf(macronamn,"NiKom:rexx/ExtKom%d %d %d",komnr,nodnr,inloggad);
        else
                sprintf(macronamn,"NiKom:rexx/ExtKom%d %d %d %s",komnr,nodnr,inloggad,argument);

        if(!(nikrexxmess=(struct RexxMsg *)CreateRexxMsg(rexxport,"nik",rexxport->mp_Node.ln_Name))) {
                puttekn("\r\n\nKunde inte allokera ett RexxMsg!\r\n\n",-1);
                return(-5);
        }
        if(!(nikrexxmess->rm_Args[0]=(STRPTR)CreateArgstring(macronamn,strlen(macronamn)))) {
                DeleteRexxMsg(nikrexxmess);
                puttekn("\r\n\nKunde inte allokera en ArgString1\r\n\n",-1);
                return(-5);
        }
        nikrexxmess->rm_Action=RXCOMM | RXFB_TOKEN;
        Forbid();
        if(!(rexxmastport=(struct MsgPort *)FindPort("REXX"))) {
                Permit();
                puttekn("\r\n\nRexxMast är inte igång!\r\n\n",-1);
                return(-5);
        }
        PutMsg(rexxmastport,(struct Message *)nikrexxmess);
        Permit();
        while(going) {
                tempmess = (struct RexxMsg *)WaitPort(rexxport);
                if(!tempmess) printf("*** Something's fishy around here... ***\n");
                while(tempmess=(struct RexxMsg *)GetMsg(rexxport)) {
                        if(tempmess->rm_Node.mn_Node.ln_Type==NT_REPLYMSG) {
                                DeleteArgstring(nikrexxmess->rm_Args[0]);
                                if(nikrexxmess->rm_Result1) {
                                        sprintf(outbuffer,"\r\n\nRexx: Return-code %d\r\n\n",nikrexxmess->rm_Result1);
                                        puttekn(outbuffer,-1);
                                }
                                DeleteRexxMsg(nikrexxmess);
                                if(!rxlinecount)
                                {
	                                rxlinecount=TRUE;
	                                radcnt = 0;
								}
                                return(sendrexxrc);
                        }
                        if(!strnicmp(tempmess->rm_Args[0],"sendstring",10)) rexxsendstring(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"sendserstring",13)) rexxsendserstring(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"getstring",9)) rexxgetstring(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"sendtextfile",12)) sendfile(rexxargs1=hittaefter(tempmess->rm_Args[0]));
                        else if(!strnicmp(tempmess->rm_Args[0],"showtext",8)) rxvisatext(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"showletter",10)) rexxvisabrev(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"lasttext",8)) senastread(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"nikcommand",10)) kommando(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"niknrcommand",12)) niknrcommand(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"edit",4)) rxedit(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"sendbinfile",11)) rexxsendbinfile(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"recbinfile",10)) rexxrecbinfile(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"getchar",7)) rexxgettekn(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"chkbuffer",9)) rexxchkbuffer(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"yesno",5)) rexxyesno(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"whicharea",9)) whicharea(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"whichmeet",9)) whichmeet(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"logout",6)) rxlogout(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"runfifo",7)) rxrunfifo(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"runrawfifo",10)) rxrunrawfifo(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"entermeet",9)) rxentermeet(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"setlinecount",12)) rxsetlinecount(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"extratime",9)) rxextratime(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"gettime",7)) rxgettime(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"sendchar",8)) rxsendchar(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"sendserchar",11)) rxsendserchar(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"setnodeaction",13)) rxsetnodeaction(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"sendrawfile",11)) rxsendrawfile(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"changelatestinfo",16)) rxchglatestinfo(tempmess);
                        else if(!strnicmp(tempmess->rm_Args[0],"getnumber",9)) rxgetnumber(tempmess);
                        else {
                                sprintf(outbuffer,"\r\n\nKan inte hantera: %s\r\n",tempmess->rm_Args[0]);
                                puttekn(outbuffer,-1);
                                tempmess->rm_Result1=5;
                                tempmess->rm_Result2=NULL;
                        }
                        ReplyMsg((struct Message *)tempmess);
                }
        }
        if(carrierdropped()) return(-8);
        return(sendrexxrc);
}
Esempio n. 13
0
LONG SendRexxCommand(CONST_STRPTR port, CONST_STRPTR Cmd, STRPTR Result, LONG ResultSize)
{
	struct MsgPort *RexxPort;
	struct MsgPort *ReplyPort = &((struct Process *)FindTask(NULL))->pr_MsgPort;
	struct Library *RexxSysBase;
#ifdef __AMIGAOS4__
	struct RexxSysIFace *IRexxSys;
#else
	void *IRexxSys;
#endif
	int rc;

	*Result = '\0';

	if ((RexxSysBase = OpenLibraryInterface("rexxsyslib.library", 36L, &IRexxSys)))
	{
		Forbid();

		if ((RexxPort = FindPort(port)))
		{
			struct RexxMsg *rexxMsg, *Answer;

			if ((rexxMsg = CreateRexxMsg(ReplyPort, NULL, NULL)))
			{
				if ((rexxMsg->rm_Args[0] = (STRPTR)CreateArgstring(Cmd, strlen(Cmd))))
				{
					rexxMsg->rm_Action = RXCOMM | RXFF_RESULT;

					PutMsg(RexxPort, &rexxMsg->rm_Node);
					Permit();

					do
					{
						WaitPort(ReplyPort);
						Answer = (struct RexxMsg *)GetMsg(ReplyPort);
					} while (Answer == NULL);

					if ((rc = (Answer->rm_Result1 == RETURN_OK)))
					{
						if (Answer->rm_Result2)
						{
							strncpy(Result, (STRPTR)Answer->rm_Result2, ResultSize);
							DeleteArgstring((STRPTR)Answer->rm_Result2);
						}
					}

					DeleteArgstring((STRPTR)ARG0(Answer));
					DeleteRexxMsg(Answer);

					CloseLibraryInterface(RexxSysBase,IRexxSys);
					return rc;
				} else
				{
					DeleteRexxMsg(rexxMsg);
				}
			}
		}

		Permit();

		CloseLibraryInterface(RexxSysBase,IRexxSys);
	}

	return 0;
}
Esempio n. 14
0
/*************
 * FUNCTION:		SendRexxMsg
 * VERSION:			0.1 08.03.1995
 * DESCRIPTION:	Sends a single (or a list of) command(s) to Rexx host
 *						and returns the secondary result
 * INPUT:			HostName			name of host
 *						MsgList			messagelist (SingleMsg must be NULL)
 *						SingleMsg		single message (MsgList must be NULL)
 *						GetResult		TRUE: get results
 * OUTPUT:			secondary result
 * HISTORY:       DATE		NAME		COMMENT
 *						08.03.95	ah			first release
 *************/
ULONG SendRexxMsg(STRPTR HostName,STRPTR *MsgList,STRPTR SingleMsg,LONG GetResult)
{
	struct RexxMsg *RexxMessage;
	struct MsgPort *HostPort,*ReplyPort;
	ULONG Result = 0;
	SHORT i;

	/* Valid pointers given? */
	if(HostName && (MsgList || SingleMsg))
	{
		/* Can we find the host? */
		HostPort = (struct MsgPort *)FindPort((char *)HostName);
		if(HostPort)
		{
			/* Allocate a reply port. */
			ReplyPort = (struct MsgPort *)AllocMem(sizeof(struct MsgPort),MEMF_PUBLIC | MEMF_CLEAR);
			if(ReplyPort)
			{
				ReplyPort->mp_SigBit = AllocSignal(-1);
				if(ReplyPort->mp_SigBit != -1)
				{
					ReplyPort->mp_Node.ln_Type	= NT_MSGPORT;
					ReplyPort->mp_Flags			= PA_SIGNAL;
					ReplyPort->mp_SigTask		= FindTask(NULL);

					ReplyPort->mp_MsgList.lh_Head = (struct Node *)&ReplyPort->mp_MsgList.lh_Tail;
					ReplyPort->mp_MsgList.lh_Tail = 0;
					ReplyPort->mp_MsgList.lh_TailPred = (struct Node *)&ReplyPort->mp_MsgList.lh_Head;

					/* Create a Rexx message. */
					RexxMessage = (struct RexxMsg *)CreateRexxMsg(ReplyPort,"",(char *)HostName);
					if(RexxMessage)
					{
						/* A list of arguments or only a single arg? */
						if(MsgList)
						{
							for(i=0 ; i<16 ; i++)
								RexxMessage->rm_Args[i] = MsgList[i];
						}
						else
							RexxMessage->rm_Args[0] = SingleMsg;

						/* Do we want result codes? */
						if(GetResult)
							RexxMessage->rm_Action = RXFF_RESULT;

						/* Send packet and wait for the reply. */
						PutMsg(HostPort,(struct Message *)RexxMessage);
						WaitPort(ReplyPort);

						/* Remember result. */
						if(GetResult && !RexxMessage->rm_Result1)
							Result = RexxMessage->rm_Result2;

						/* Remove Rexx message. */
						DeleteRexxMsg(RexxMessage);
					}
					/* Free reply port signal bit. */
					FreeSignal(ReplyPort->mp_SigBit);
				}
				/* Free the replyport itself. */
				FreeMem(ReplyPort,sizeof(struct MsgPort));
			}
		}
	}
	/* Return the result. */
	return(Result);
}