/************************************************************
* MultiUser - MultiUser Task/File Support System				*
* ---------------------------------------------------------	*
* Standard Library Functions											*
* ---------------------------------------------------------	*
* © Copyright 1993-1994 Geert Uytterhoeven						*
* All Rights Reserved.													*
************************************************************/


#include <exec/execbase.h>
#include <exec/semaphores.h>
#include <exec/alerts.h>
#include <exec/initializers.h>
#include <proto/exec.h>

#include "Config.h"
#include "Locale.h"
#include "LibHeader.h"
#include "StdLibFunc.h"
#include "Misc.h"


	/*
	 *		Library initialisation
	 */

struct muBase __asm __saveds *muInit(register __d0 struct muBase *mubase,
												 register __a0 BPTR seglist,
												 register __a6 struct ExecBase *sysbase)
{
	SysBase = sysbase;
	muBase = mubase;
	muBase->LibNode.lib_Node.ln_Type = NT_LIBRARY;
	muBase->LibNode.lib_Node.ln_Name = MultiUserName;
	muBase->LibNode.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED;
	muBase->LibNode.lib_Version = MultiUserVersion;
	muBase->LibNode.lib_Revision = MultiUserRevision;
	muBase->LibNode.lib_IdString = MultiUserIDString;
	muBase->SegList = seglist;

	if (!Init()) {
		CleanUp();
		FreeMem((APTR)((ULONG)muBase-(ULONG)(muBase->LibNode.lib_NegSize)),
				  muBase->LibNode.lib_NegSize+muBase->LibNode.lib_PosSize);
		return(NULL);
	} else
		return(mubase);
}


	/*
	 *		Library Open() (Called by OpenLibrary())
	 *
	 *		Standard Library Function
	 */

struct muBase __asm *muOpen(register __a6 struct muBase *muBase)
{
	muBase->LibNode.lib_OpenCnt++;
	muBase->Flags &= -1-LIBF_DELEXP;
	return(muBase);
}


	/*
	 *		Library Close() (Called by CloseLibrary())
	 *
	 *		Standard Library Function
	 *
	 *		The multiuser.library will NEVER be expunged!!
	 */

BPTR __asm muClose(register __a6 struct muBase *muBase)
{
	muBase->LibNode.lib_OpenCnt--;
	return(NULL);
}


	/*
	 *		Library Expunge() (Called by RemLibrary())
	 *
	 *		Standard Library Function
	 *
	 *		The multiuser.library will NEVER be expunged!!
	 */

BPTR __asm muExpunge(void)
{
	return(NULL);
}


	/*
	 *		Library ExtFunc() (Called by ??)
	 *
	 *		Standard Library Function
	 */

ULONG __asm muExtFunc(void)
{
	return(NULL);
}
