#include <string.h>

#include <exec/types.h>

#include <libraries/dos.h>
#include <libraries/dosextens.h>

#include <dlg/misc.h>

#include <link/io.h>

#include <proto/dos.h>
#include <proto/dlg.h>

#include <pragmas/dlg.h>

LONG  __saveds __asm LIBGetStruct(register __a0 char  *, register __a1 char  *, register __d0 ULONG, register __d1 USHORT);
LONG  __saveds __asm LIBStricmp(register __a0 char *,  register __a1 char *);
void  __saveds __asm LIBCapitalize(register __a0 char *);


BPTR __saveds __asm LIBOpenGroup(register __a0 char *groupname)

{BPTR             gfh;
 struct Group_Def Def;
 char             filename[80];

 strcpy(Def.name, groupname);
 LIBCapitalize(Def.name);

 if (LIBGetStruct("DLGConfig:Group/Group.BBS", (char *)&Def, sizeof(Def), sizeof(Def.name)))
     return(NULL);

 ASPrintf(NULL, filename, "DLGCONFIG:Group/%.29s.Group", groupname);
 gfh = Open(filename, MODE_OLDFILE);

 return(gfh);
}


BOOL __saveds __asm LIBNextInGroup(register __a0 BPTR  fh,
                                   register __a1 char *name)

{if (Read(fh, name, 36) != 36)  return(FALSE);
 return(TRUE);
}


void __saveds __asm LIBCloseGroup(register __a0 BPTR fh)

{Close(fh);
}
