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

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

SHORT ListEditors(int level)

{int fp;
 SHORT         count = 0;
 struct Editor editor;

 if ((fp=open("DLGCONFIG:Misc/Editors.bbs",O_RDONLY))==EOF)
    {AFPrintf(&StUser, Output(), SA[3478]);
     return(-1);
    }

 AFPrintf(&StUser, Output(), SA[3479]);
 Draw_Line(64);

 while(read(fp,&editor,sizeof(editor))==sizeof(editor))
      {if (editor.level<=level)
          {AFPrintf(&StUser, Output(), SA[3480], editor.number, editor.name);
           if (editor.number > count)  count = editor.number;
          }
      }

 Draw_Line(64);
 AFPrintf(NULL, Output(), "\n");

 close(fp);
 return(count);
}
