Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!zaphod.mps.ohio-state.edu!usc!hacgate!tcville!sed170!lee From: lee@sed170.HAC.COM (John Lee) Newsgroups: comp.sys.amiga.tech Subject: Determining disk devices Summary: Can it be done better? Message-ID: <331@sed170.HAC.COM> Date: 4 Jan 90 22:55:15 GMT Reply-To: lee@sed170.UUCP (John Lee) Organization: Hughes Aircraft Co., El Segundo, CA Lines: 32 Currently, the "Official" way of determining the list of disk devices is to walk down the AmigaDOS device list, looking for entries for devices that have a non-NULL name and are resident (Task field non-zero), like this: /* Pseudo-code */ for (devent = Device List; devent != NULL; devent = devent->next) { if ((devent's Type is device) && (devent's Task is non-zero) && (devent's Name is non-zero)) { (devent is entry for a disk device) } } While this does indeed locate all disk (i.e. directory-oriented) devices, it can also mistakenly return other devices, such as PIPE:. To illustrate this, startup DPaint 1.3 and bring up the Load file-requester. Note that PIPE: does not show up in the device buttons. Now exit DPaint, copy something to 1.3's PIPE: (perhaps "run dir >PIPE:a"), let that hang and then startup DPaint 1.3 again. Notice that PIPE: now shows up in the Load file-requester. My question is simple. How do you make sure you locate only disk devices, and not merely all devices that are resident and have a name? --John ------------------------------------------------------------------------------- Raining CATS and DOGS? Join the RATS: Remote Amiga Teleconferencing System +--------+ John Lee | HUGHES | +--------+ ARPAnet: jhlee@hac2arpa.hac.com Hughes Aircraft Company The above opinions are those of the user and not of those of this machine.