ToolChain/bin/targets/m68k-amigaos/ndk/Tutorials/ARexx/Host/Host.c
VOID
ReturnErrorMsg(
	struct RexxMsg *	Message,
	const STRPTR		PortName,
	LONG			Error)
{
	UBYTE VarName[90];
	UBYTE Value[12];

		/* To signal an error the rc_Result1
		 * entry of the RexxMsg needs to be set to
		 * RC_ERROR. Unfortunately, we cannot convey
		 * the more meaningful error code through
		 * this interface which is why we set a
		 * Rexx variable to the error number. The
		 * Rexx script can then take a look at this
		 * variable and decide which further steps
		 * it should take.
		 */

	Message->rm_Result1 = RC_ERROR;

		/* Turn the error number into a string as
		 * ARexx only deals with strings.
		 */

	sprintf(Value,"%ld",Error);

		/* Build the name of the variable to set to
		 * the error number. We will use the name of
		 * the host name and append ".LASTERROR".
		 */

	sprintf(VarName,"%s.%s",PortName,"LASTERROR");

		/* Now set the variable to the error code.
		 * We use the RVI (Rexx Variables Interface)
		 * routine for this purpose.
		 */

	SetRexxVar(Message,VarName,Value,strlen(Value));

	ReplyMsg((struct Message *)Message);
}
/****** Host/ReturnErrorMsg **************************************************
*
*   NAME
*       ReturnErrorMsg -- Return a Rexx command message to the sender and
*           indicate that the command failed.
*
*   SYNOPSIS
*       ReturnErrorMsg(Message,PortName,Error)
*
*       VOID ReturnErrorMsg(struct RexxMsg *Message,const STRPTR PortName,
*           LONG Error)
*
*   FUNCTION
*       This routine permits to return a command message sent by a client
*       and set an error code the client to send the message can query.
*       The error code is stored in a variable whose name is made up from
*       the name of the host name and the prefix ".LASTERROR". Thus,
*       for the host name "HOST" the variable becomes "HOST.LASTERROR".
*
*   INPUTS
*       Message - Pointer to RexxMsg received from client.
*
*       PortName - Name of the host the message was sent to.
*
*       Error - Error code to return.
*
*   RESULT
*       None
*
*   SEE ALSO
*       exec.library/ReplyMsg
*       amiga.lib/SetRexxVar
*
******************************************************************************
*
*/
Host/ReturnErrorMsg
NAME
ReturnErrorMsg -- Return a Rexx command message to the sender and
indicate that the command failed.





FUNCTION
This routine permits to return a command message sent by a client
and set an error code the client to send the message can query.
The error code is stored in a variable whose name is made up from
the name of the host name and the prefix ".LASTERROR". Thus,
for the host name "HOST" the variable becomes "HOST.LASTERROR".

INPUTS
Message - Pointer to RexxMsg received from client.

Name of the host the message was sent to.

Error code to return.

RESULT
None


Host / ReturnErrorMsg NAME ReturnErrorMsg -- Return a Rexx command message to the sender and indicate that the command failed . FUNCTION This routine permits to return a command message sent by a client and set an error code the client to send the message can query . The error code is stored in a variable whose name is made up from the name of the host name and the prefix " . LASTERROR " . Thus for the host name " HOST " the variable becomes " HOST . LASTERROR " . INPUTS Message - Pointer to RexxMsg received from client . Name of the host the message was sent to . Error code to return . RESULT None
VOID
ReturnErrorMsg(
	struct RexxMsg *	Message,
	const STRPTR		PortName,
	LONG			Error)
{
	UBYTE VarName[90];
	UBYTE Value[12];
	Message->rm_Result1 = RC_ERROR;
	sprintf(Value,"%ld",Error);
	sprintf(VarName,"%s.%s",PortName,"LASTERROR");
	SetRexxVar(Message,VarName,Value,strlen(Value));
	ReplyMsg((struct Message *)Message);
}
VOID ReturnErrorMsg ( struct RexxMsg * Message , const STRPTR PortName , LONG Error ) { UBYTE VarName [ 90 ] ; UBYTE Value [ 12 ] ; Message -> rm_Result1 = RC_ERROR ; sprintf ( Value , " " , Error ) ; sprintf ( VarName , " " , PortName , " " ) ; SetRexxVar ( Message , VarName , Value , strlen ( Value ) ) ; ReplyMsg ( ( struct Message * ) Message ) ; }
Host/ReturnErrorMsg
NAME
ReturnErrorMsg -- Return a Rexx command message to the sender and
indicate that the command failed.
Host / ReturnErrorMsg NAME ReturnErrorMsg -- Return a Rexx command message to the sender and indicate that the command failed .
/* To signal an error the rc_Result1
		 * entry of the RexxMsg needs to be set to
		 * RC_ERROR. Unfortunately, we cannot convey
		 * the more meaningful error code through
		 * this interface which is why we set a
		 * Rexx variable to the error number. The
		 * Rexx script can then take a look at this
		 * variable and decide which further steps
		 * it should take.
		 */ /* Turn the error number into a string as
		 * ARexx only deals with strings.
		 */ /* Build the name of the variable to set to
		 * the error number. We will use the name of
		 * the host name and append ".LASTERROR".
		 */ /* Now set the variable to the error code.
		 * We use the RVI (Rexx Variables Interface)
		 * routine for this purpose.
		 */