ToolChain/bin/targets/m68k-amigaos/ndk/Tutorials/ARexx/Host/Host.c
LONG
ReturnRexxMsg(struct RexxMsg * Message,const STRPTR Result)
{
	STRPTR ResultString;
	LONG ErrorCode;

		/* No error has occured yet. */

	ErrorCode = 0;

		/* Set up the RexxMsg to return no error. */

	Message->rm_Result1 = RC_OK;
	Message->rm_Result2 = 0;

		/* Check if the command should return a result. */

	if((Message->rm_Action & RXFF_RESULT) && Result != NULL)
	{
			/* To return the result string we need to make
			 * a copy for ARexx to use.
			 */

		if(ResultString = CreateArgstring(Result,strlen(Result)))
		{
				/* Put the string into the secondary
				 * result field.
				 */

			Message->rm_Result2 = (LONG)ResultString;
		}
		else
		{
				/* No memory available. */

			ErrorCode = ERR10_003;
		}
	}

		/* Reply the message, regardless of the error code. */

	ReplyMsg((struct Message *)Message);

	return(ErrorCode);
}
/****** Host/ReturnRexxMsg ***************************************************
*
*   NAME
*       ReturnRexxMsg -- Return a Rexx command message to the sender,
*           including a result code.
*
*   SYNOPSIS
*       ErrorCode = ReturnRexxMsg(Message,Result)
*
*       LONG ReturnRexxMsg(struct RexxMsg *Message,const STRPTR Result);
*
*   FUNCTION
*       Clients addressing the host send special messages carrying the
*       commands and command arguments to the host message port. After
*       processing the commands the host needs to return these messages.
*
*       This routine cannot be used to return error or failure messages
*       to the client. For this purpose use ReturnErrorMsg() instead.
*
*   INPUTS
*       Message - Pointer to RexxMsg received from client.
*
*       Result - Pointer to string that should be transmitted to
*           the client as the command result. This may be NULL in
*           which case no result string will be transmitted.
*
*   RESULT
*       Error - 0 for success, any other value indicates failure.
*
*   SEE ALSO
*       exec.library/ReplyMsg
*       rexxsyslib.library/CreateArgstring
*       ReturnErrorMsg
*
******************************************************************************
*
*/
Host/ReturnRexxMsg
NAME
ReturnRexxMsg -- Return a Rexx command message to the sender,
including a result code.





FUNCTION
Clients addressing the host send special messages carrying the
commands and command arguments to the host message port. After
processing the commands the host needs to return these messages.

This routine cannot be used to return error or failure messages
to the client. For this purpose use ReturnErrorMsg() instead.

INPUTS
Message - Pointer to RexxMsg received from client.

Pointer to string that should be transmitted to
the client as the command result. This may be NULL in
which case no result string will be transmitted.

RESULT
Error - 0 for success, any other value indicates failure.


Host / ReturnRexxMsg NAME ReturnRexxMsg -- Return a Rexx command message to the sender including a result code . FUNCTION Clients addressing the host send special messages carrying the commands and command arguments to the host message port . After processing the commands the host needs to return these messages . This routine cannot be used to return error or failure messages to the client . For this purpose use ReturnErrorMsg () instead . INPUTS Message - Pointer to RexxMsg received from client . Pointer to string that should be transmitted to the client as the command result . This may be NULL in which case no result string will be transmitted . RESULT Error - 0 for success any other value indicates failure .
LONG
ReturnRexxMsg(struct RexxMsg * Message,const STRPTR Result)
{
	STRPTR ResultString;
	LONG ErrorCode;
	ErrorCode = 0;
	Message->rm_Result1 = RC_OK;
	Message->rm_Result2 = 0;
	if((Message->rm_Action & RXFF_RESULT) && Result != NULL)
	{
		if(ResultString = CreateArgstring(Result,strlen(Result)))
		{
			Message->rm_Result2 = (LONG)ResultString;
		}
		else
		{
			ErrorCode = ERR10_003;
		}
	}
	ReplyMsg((struct Message *)Message);
	return(ErrorCode);
}
LONG ReturnRexxMsg ( struct RexxMsg * Message , const STRPTR Result ) { STRPTR ResultString ; LONG ErrorCode ; ErrorCode = 0 ; Message -> rm_Result1 = RC_OK ; Message -> rm_Result2 = 0 ; if ( ( Message -> rm_Action & RXFF_RESULT ) && Result != NULL ) { if ( ResultString = CreateArgstring ( Result , strlen ( Result ) ) ) { Message -> rm_Result2 = ( LONG ) ResultString ; } else { ErrorCode = ERR10_003 ; } } ReplyMsg ( ( struct Message * ) Message ) ; return ( ErrorCode ) ; }
Host/ReturnRexxMsg
NAME
ReturnRexxMsg -- Return a Rexx command message to the sender,
including a result code.
Host / ReturnRexxMsg NAME ReturnRexxMsg -- Return a Rexx command message to the sender including a result code .
/* No error has occured yet. */ /* Set up the RexxMsg to return no error. */ /* Check if the command should return a result. */ /* To return the result string we need to make
			 * a copy for ARexx to use.
			 */ /* Put the string into the secondary
				 * result field.
				 */ /* No memory available. */ /* Reply the message, regardless of the error code. */