#include #include #ifdef DEBUG #include "debug.h" #endif /* Fakes an Examine/ExNext interface to the device list. Call OpenVolList * first, then ReadVolList(fib), and finally CloseVolList. This last is * a dummy, but it's handy if you want to be safe and put a forbid/permit * around the whole thing. */ #define toAPTR(b) ((b)<<2) #define toBPTR(a) ((a)>>2) struct DeviceList *list; OpenVolList() { extern struct DosLibrary *DOSBase; struct RootNode *root; struct DosInfo *info; root = (struct RootNode *)DOSBase -> dl_Root; info = (struct DosInfo *)toAPTR(root->rn_Info); list = (struct DeviceList *)toAPTR(info->di_DevInfo); } ReadVolList(fib) struct FileInfoBlock *fib; { struct DeviceList *next; while(list) { next = (struct DeviceList *)toAPTR(list->dl_Next); if(list->dl_Type == DLT_VOLUME || list->dl_Type == DLT_DIRECTORY) { char *ptr; int count; ptr = (char *)toAPTR((BPTR)list->dl_Name); count = *ptr++; if(count > 106) count = 106; strncpy(fib->fib_FileName, ptr, count); fib->fib_FileName[count++] = ':'; fib->fib_FileName[count] = 0; if(strcmp(fib->fib_FileName, "RAM Disk:") == 0) strcpy(fib->fib_FileName, "RAM:"); fib->fib_DiskKey = 0; fib->fib_DirEntryType = list->dl_Type; fib->fib_Protection = 0; fib->fib_EntryType = list->dl_Type; fib->fib_Size = 0; fib->fib_NumBlocks = 0; fib->fib_Date = list->dl_VolumeDate; fib->fib_Comment[0] = 0; list = next; return 1; } list = next; } return 0; } CloseVolList() { }