/*static char *SCCSID = "@(#)rctomid.c	6.2 90/12/10";                                 */
/****************************************************************************/
/*                                                                          */
/*                       IBM/Microsoft Confidential                         */
/*                                                                          */
/*                 Copyright (c) IBM Corporation  1987, 1990                */
/*                 Copyright (c) Microsoft Corp.  1987, 1990                */
/*                           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> */ /* csc */            /* DOS function external        */
#include "tmpdos16.h"         /* csc */
#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 short ivcount = 0;       /* csc */  /* number of variables         */
char msg_buf[INIT_MSG_BUF_SIZE];
unsigned short msglength;         /* csc */  /* message length returned from */
unsigned short rc;                /* csc */

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

     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      */

}
