/*static char *SCCSID = "@(#)rctomid.c	6.1 90/11/16";*/
/* static char *SCCSID = "@(#)rctomid.c	6.2 90/01/24"; */

/*********************************************************************/
/*	 IBM/Microsoft Confidential				     */
/*								     */
/*	 Copyright (c) IBM Corporation 1987, 1989		     */
/*	 Copyright (c) Microsoft Corporation 1987, 1989		     */
/*								     */
/*	 All Rights Reserved					     */
/*********************************************************************/

/******************** START OF SPECIFICATIONS ************************/
/*								     */
/* SOURCE FILE NAME: RCTOMID					     */
/*								     */
/* DESCRIPTIVE NAME: CONVERSION FROM RETURN CODE TO MESSSAGE ID	     */
/*								     */
/* FUNCTION:							     */
/*								     */
/*     This routine is to create a proper message id from	     */
/*     a specified return code.					     */
/*								     */
/* NOTES:							     */
/*								     */
/*     In the intial version, no process is required.		     */
/*								     */
/* ENTRY POINTS:  rctomid					     */
/*								     */
/* EXTERNAL REFERENCE:	 none					     */
/*								     */
/* RELEASE:							     */
/*								     */
/*   VERSION	  DATE		 REASON				     */
/*								     */
/*     1.00	5/13/1986      initial version (no process)	     */
/*     2.00	5/11/1988 CWY  return a message number for none	     */
/*			       mapped error			     */
/*								     */
/*********************************************************************/
#include <doscalls.h>				 /* DOS function external	 */
#include <error2.h>				 /*				 */
#include <utilmids.h>
unsigned rctomid(return_code)
unsigned return_code;		    /* return code of DOS func.	   */
{
#define INIT_MSG_BUF_SIZE  200	    /* initial msg buffer size	   */
#define MSGFILENAME "OSO001.MSG"    /* system message filename	   */
char *ivtable[1];		    /* array pointer to table	   */
unsigned ivcount = 0;		    /* number of variables	   */
char msg_buf[INIT_MSG_BUF_SIZE];
unsigned msglength;		    /* message length returned from */
unsigned rc;

     rc = DOSGETMESSAGE(			 /* execute DOSGETMESSGE    */
	       (char far * far *)ivtable,    /* and copy return code to rc_s.*/
	       (unsigned)	 ivcount,
	       (char far *)	 msg_buf,
	       (unsigned)	 INIT_MSG_BUF_SIZE,
	       (unsigned)	 return_code,
	       (char far *)	 MSGFILENAME,
	       (unsigned far *)	 &msglength);

     if (rc !=0)   {
	if ( rc == ERROR_MR_MID_NOT_FOUND     )	 {
	    return( MSG_CMM_INTERNAL_ERROR );
	}
     }

     return(return_code);	  /* set return code as a message id	  */

}
