Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!jpotter From: jpotter@ucs.adelaide.edu.au (Jonathan Potter) Newsgroups: comp.sys.amiga.programmer Subject: Re: Re-post of assigns problem. Message-ID: <2671@sirius.ucs.adelaide.edu.au> Date: 25 Mar 91 07:00:49 GMT Article-I.D.: sirius.2671 References: <13727@ccncsu.ColoState.EDU> Organization: Information Technology Division, The University of Adelaide, AUSTRALIA Lines: 56 Here is some code to obtain a list of devices in the system. Dos library must already be open, with a pointer to it in the variable DosBase. Hope it helps! Jon -------------------------------------------------------------------------------- extern struct DosLibrary *DosBase; getdevicelist() { struct DeviceList *devlist; struct RootNode *rootnode; struct DosInfo *dosinfo; char devname[32]; rootnode=(struct RootNode *) DosBase->dl_Root; dosinfo=(struct DosInfo *) BADDR(rootnode->rn_Info); devlist=(struct DeviceList *) BADDR(dosinfo->di_DevInfo); while (devlist) { if (devlist->dl_Type==DLT_DEVICE && devlist->dl_Task) { /* This is an actual, physical device, like DF0: */ conbstr((BPTR)devlist->dl_Name,devname); strcat(devname,":"); heres_a_device(devname); } else if (devlist->dl_Type==DLT_DIRECTORY) { /* This is an assigned device, like C: */ conbstr((BPTR)devlist->dl_Name,devname); strcat(devname,":"); heres_a_device(devname); } devlist=(struct DeviceList *) BADDR(devlist->dl_Next); } } conbstr(in,out) BSTR in; char *out; { UBYTE *ch; int len,i; ch=(UBYTE *) BADDR(in); len=(int) *(ch++); len=(len>31)?31:len; for (i=0;i