home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d510
/
atcopy.lha
/
ATCopy
/
FileRequester
/
manx.ext.test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-29
|
3KB
|
96 lines
/*
* kd_freq.library Extended Select Test
*
* Tested on Manx 3.60a.
*/
#include "KDBase.h"
UBYTE directory[128];
UBYTE filename[32];
UBYTE pattern[32];
/* for Manx.. we don't need any parsing */
void _wb_parse() {}
void _cli_parse() {}
struct Library *KD_FReqBase, *OpenLibrary();
struct ExtraData extras;
main()
{
register struct FileList *ext;
KD_FReqBase = OpenLibrary(KLIBNAME,KLIBVERSION);
if (KD_FReqBase)
{
/* Make sure that all default strings are zero'd out. */
directory[0] = filename[0] = pattern[0] = 0;
/* Set default wildcard pattern */
/* strcpy(pattern,"#?.?"); */
/* Call file requester */
extras.oktext = (UBYTE *) "Load";
extras.canceltext = (UBYTE *) "No Way!";
if (FReq(NULL,
"Extended Select Test",
filename,directory,pattern, FR_CANCELTEXT | FR_EXTENDEDSELECT |
FR_OKTEXT | FR_AUTOPOSITION | FR_AUTOSIZE | FR_NOINFO | FR_SCREENFONT
,&extras))
{
/* You can immediately strcat(directory,filename); since
directory will contain the valid file seperator (either
/ or : at the end of the directory name
*/
printf("Directory: %s\nFile : %s\n",directory,filename);
if (extras.ExtendedList) /* Check if the user selected a */
{ /* list of files. */
ext = extras.ExtendedList;
printf("\nExtended Select List: (%ld bytes)\n\n",ext->private);
printf(" Size File Name\n");
printf(" ------- -----------------------------------------\n");
/* This just prints out the selected files and their size. */
for (; ext; ext = ext->next)
{
printf("%8ld %s%s\n",ext->FileSize,directory,ext->FileName);
}
/* VERY IMPORTANT!! YOU MUST HAVE THIS IN! */
/* If the call returned a pointer to an ExtendedList */
/* then you must free it before you exit with the following */
/* FreeMem() call. */
/* You can also just leave the extras.ExtendedList pointer */
/* in the extras struct when you call FReq() again. Freq() */
/* In this case will FreeMem() the list for you and give you */
/* a new one if need be. */
FreeMem(extras.ExtendedList,extras.ExtendedList->private);
/* Clear out list pointer so that a subsequent call to FReq() */
/* doesn't try to FreeMem() it. */
extras.ExtendedList = NULL;
}
}
else
{
printf("Requester Cancelled!\n");
}
CloseLibrary(KD_FReqBase);
}
else
{
printf("Can't Open 'kd_freq.library'. Make sure it is in LIBS:\n");
}
}