#include "obj.h"
#include <proto/exec.h>
#include <proto/asl.h>
#include <proto/dos.h>
#include <libraries/asl.h>
#include <string.h>

struct Library *AslBase; /* Library for file requester */

int f_req(char *buf)
 {
   struct FileRequester *req;
   int    rc;

   /* Open ASL library */
   if (!(AslBase = OpenLibrary("asl.library", 37L))) 
       return -1;

   /* Alloc file requester structure */
   if (!(req = AllocAslRequestTags(ASL_FileRequest, 
                                   TAG_DONE)))
     {
       CloseLibrary(AslBase);
		 return -1;
	  }

   /* Open file requester */
   if (rc = AslRequest(req, NULL))
     {
       /* Build complete name */
       if (req->rf_Dir)
           strcpy(buf, req->rf_Dir);
       else
           buf[0] = '\0';
		 AddPart(buf, req->rf_File, PATHSIZE);
     }
	else 
       buf[0] = '\0';
		
   /* Free resources */
   FreeAslRequest(req);
   CloseLibrary(AslBase);

   return rc ? 1 : 0;    /* returnval: -1: error, 1: ok, 0: esc pressed */
 }
