/*****************************************************************/
/**                                                             **/
/**             (C) Copyright 1992 the Regents of the           **/
/**        University of California.  All Rights Reserved.      **/
/**                                                             **/
/**        This work was produced under the sponsorship of      **/
/**         the U.S. Department of Energy.  The Government      **/
/**                retains certain rights therein.              **/
/**                                                             **/
/**                         Written by                          **/
/**         Distributed Programming Environments Project        **/
/**           Computer Software and Networking Division,        **/
/**                   Livermore Computer Center,                **/
/**            Lawrence Livermore National Laboratory           **/
/**                                                             **/
/*****************************************************************/

static char sccsid_FILEsend_data[] = "@(#)FILEsend.c	1.9 10/19/92 13:25:05  LLNL ";

/*
	Embedded Language for Remote Operations Services
	ELROS

	AUTHOR:		James A. Guse
			Network Systems Division

	DATE WRITTEN:	6/27/90

	ROUTINE:	send_data
	Version:	__ROr_FILEsend_data

PURPOSE:
	This routine sends data "to" memory.


IN:
	instance - send state

OUT:
	instance - Send state and Exception state are updated.


CALLED ROUTINES:
	SDataRequest

	
MODIFICATION HISTORY:


*/

#include <elros/instance.h>

#include <stdio.h>

#define FILEPART	(instance->subsystem->specific.file)

int __ROr_FILEsend_data(instance)

   __RO_Instance_Record *	instance;



{
   unsigned char *dataptr;
   int i;

#ifndef __RO_PRODUCTION
   if (instance->subsystem->platform != __ROm_platform_FILE)
      __RO_RETURN_RUNTIME(instance,__ROx_INTERNAL_PLATFORMNOTFILE);
#endif

   if (__ROr_log6send(instance))
      return(EXCEPTION);

   for (i=0,dataptr=instance->send_state.buffer;
        i<instance->send_state.index;
        i++,dataptr++)
      fprintf((FILE *)(FILEPART.outfile),"%2.2x\n",(int)(*dataptr));
   fprintf((FILE *)(FILEPART.outfile),"\n");

   instance->send_state.index = 0;
   instance->send_state.boundary_flag = 0;
   return(SUCCESS);
}


