From 62e509e9c90d728c9f65145947276f79112ab48c Mon Sep 17 00:00:00 2001 From: "Christian A. Weber" Date: Tue, 2 Nov 1993 18:53:33 +0000 Subject: Initial revision --- FileRequest.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 FileRequest.c (limited to 'FileRequest.c') diff --git a/FileRequest.c b/FileRequest.c new file mode 100644 index 0000000..b6c82fc --- /dev/null +++ b/FileRequest.c @@ -0,0 +1,77 @@ +/****** FileRequest ********************************************************* +* +* NAME +* FileRequest -- Bring up an ASL file requester +* +* SYNOPSIS +* name = FileRequest(title, postext, path, name) +* +* STRPTR FileRequest(STRPTR, STRPTR, STRPTR, STRPTR); +* +* FUNCTION +* Shows a file requester. +* +* INPUTS +* title - The window title +* postext - Text of the left gadget +* path - Buffer for the path. This will be modifierd. +* name - Buffer for the name. This will be modifierd. +* +* RESULTS +* pathname - Pathname of the selected file, or NULL if cancel. +* +* SEE ALSO +* asl.library +* +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include + + +extern struct TextAttr MyScreenTextAttr; +extern struct Screen *mainscreen; + + +STRPTR FileRequest(STRPTR wtitle, STRPTR postext, STRPTR drawer, STRPTR file) +{ + if (AslBase) + { + struct FileRequester *f; + char *filename=NULL; + static char buf[256]; + + if (f = AllocAslRequestTags( ASL_FileRequest, + ASLFR_Screen, mainscreen, + ASLFR_TextAttr, &MyScreenTextAttr, + ASLFR_TitleText, wtitle, + ASLFR_InitialFile, file, + + (drawer != NULL) ? ASLFR_InitialDrawer : ASLFR_DrawersOnly, + (drawer != NULL) ? drawer : (STRPTR)TRUE, + TAG_DONE + )) + { + if (AslRequest(f, NULL)) + { + strcpy(drawer, f->fr_Drawer); + strcpy(file, f->fr_File); + strcpy(buf, drawer ); + AddPart(buf, file, sizeof(buf)); + filename = buf; + } + + FreeAslRequest(f); + } + + return filename; + } + else return ""; +} + + -- cgit v1.2.3