#include <fcntl.h>
#include <stdio.h>
#include <proto/dos.h>
#include <proto/dlg.h>
#include <dialog/misc.h>

extern struct Library  *DLGBase;
extern char           **SA;
extern struct USER_DATA StUser;

BOOL ListSets(int level)

{int            fp;
 struct CharSet Set;

 if ((fp = open("DLGConfig:CharSets/CharSets.bbs",O_RDONLY))==EOF)  return(FALSE);

 AFPrintf(&StUser, Output(), SA[3503]);

 AFPrintf(&StUser, Output(), SA[3504]);

 while(read(fp,&Set,sizeof(Set))==sizeof(Set))
      {if (level < Set.level)  continue;
       AFPrintf(&StUser, Output(), SA[3505], Set.number, Set.name, Set.level);
      }

 AFPrintf(&StUser, Output(), SA[3506]);
 close(fp);
 return(TRUE);
}


BOOL CheckSet(int number, int level)

{struct CharSet Set;

 if (!number)  return(FALSE);

 Set.number = number;

 if (GetStruct("DLGConfig:CharSets/CharSets.bbs",(char *)&Set,sizeof(Set),1)==-1)
     return(FALSE);

 if (level<Set.level)
     return(FALSE);

 return(TRUE);
}
