/*
**	$VER: rlservlib.c 1.0 (14.01.94)
**
**	rlogin.service library standard functions
**
**	© Copyright 1994 by Norbert Püschel
**	All Rights Reserved
*/

#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/utility.h>

#include <rexx/storage.h>

struct DosLibrary *DOSBase;
struct Library *UtilityBase;

volatile ULONG NumProcs = 0;

BOOL __saveds __asm LIBGlobalAlloc(register __d0 struct Library *Base)

{
  DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",37);
  if(DOSBase) {
    UtilityBase = OpenLibrary("utility.library",37);
    if(UtilityBase) {
      return(TRUE);
    }
    CloseLibrary((struct Library *)DOSBase);
  }
  return(FALSE);
}

BOOL __saveds __asm LIBGlobalFree(register __d0 struct Library *Base) 

{
  if(NumProcs > 0) {
    return(FALSE);
  }
  else {
    CloseLibrary(UtilityBase);
    CloseLibrary((struct Library *)DOSBase);
    return(TRUE);
  }
}

LONG __saveds __asm LIBRexxQuery(register __a0 struct RexxMsg *msg,
                                 register __a1 UBYTE **arg)

{
  return(1);
}
