/*****************************************************************/
/**                                                             **/
/**             (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_unbind[] = "@(#)STDunbind.c	1.33 10/19/92 13:48:24  LLNL ";

/*
	Embedded Language for Remote Operations Services
	ELROS

	AUTHOR:		James A. Guse
			Robyne M. Sumpter
			Network Systems Division

	DATE WRITTEN:	7/25/90

	ROUTINE:	unbind
	Version:	__ROr_STDunbind

PURPOSE:
	This routine unbinds the instance

IN:
	instance - pointer to instance record.

OUT:
	instance - All fields are inaccessible -- pointer is freed.


CALLED ROUTINES:
	

	
MODIFICATION HISTORY:


*/


#include <elros/instance.h>
#include <elros/binds.h>
#include <elros/specifics.h>

int __ROr_STDunbind(instance)
    __RO_Instance_Record *instance;

    {
	switch(instance->subsystem->platform)
	{

	    case __ROm_platform_ISODE:

#ifdef __RO_PLATFORM_ISODE
		if( __ROr_unbind_ISODE( instance ) )
		    return( EXCEPTION );
 	    break;
#else

	    __RO_RETURN_RUNTIME(instance,__ROx_INTERNAL_ISODENOTLINKED);
#endif


	    case __ROm_platform_PURESOCKETS:

#ifdef __RO_PLATFORM_PURESOCKETS
		if( __ROr_unbind_SOCK( instance ) )
		    return( EXCEPTION );
 	    break;
#else

	    __RO_RETURN_RUNTIME(instance,__ROx_INTERNAL_PURESOCKETSNOTLINKED);
#endif


	    case __ROm_platform_MEM:
	    break;

	    case __ROm_platform_FILE:
		fclose(instance->subsystem->specific.file.infile);
		fclose(instance->subsystem->specific.file.outfile);
	    break;

	default:
	    __RO_RETURN_RUNTIME(instance,__ROx_INTERNAL_MUTUAL);
	
 	}


    return(__ROr_STDfree_instance(instance));
    }


