Article View: comp.sys.amiga.tech
Article #2714Re: Anybody know how to do this stuff?
From: Eddy Carroll
Date: Sun, 10 Dec 1989 02:07
Date: Sun, 10 Dec 1989 02:07
46 lines
2257 bytes
2257 bytes
In article <13920027@hpfelg.HP.COM>, koren@hpfelg.HP.COM (Steve Koren) writes:
> Another "how do you do it" question:
>
> I want to find out, for any given device name, whether that is a currently
> mounted file system device. Moreover, I want to do this without bringing
> up the requester. In short, I need a routine like this:
>
> int IsMounted(char *Device_Name) {}
>
The following seems to do the trick:
/* Compile with Lattice C V5.04 */
#include <exec/types.h>
#include <proto/exec.h>
#include <proto/dos.h>
/*
* Checks to see if the specified device (DF0:, DF1:, XYZ: etc.) is
* mounted; returns TRUE if it is, FALSE if it isn't.
*/
int IsMounted(devname)
char *devname;
{
BPTR lock;
APTR oldwindow;
struct Process *me = (struct Process *)FindTask(NULL);
oldwindow = me->pr_WindowPtr; /* Save current requester state */
me->pr_WindowPtr = (APTR)-1; /* Disable AmigaDOS requesters */
lock = Lock(devname, ACCESS_READ); /* Try and get lock on device */
if (lock) /* If we succeeded, */
UnLock(lock); /* Free up the lock */
me->pr_WindowPtr = oldwindow; /* Restore original requesters */
return (lock); /* Return TRUE if device online */
}
> - steve
I'm really impressed with SKsh. As many others have said already, a "real"
Unix shell has long been overdue for the Amiga (though Matt's shell has done
me nicely in the meantime).
--
Eddy Carroll ----* Genuine MUD Wizard | "You haven't lived until
INTER: ecarroll@vax1.tcd.ie | you've died in MUD!"
UUCP: {..uunet}!mcvax!ukc!vax1.tcd.ie!ecarroll | -- Richard Bartle
Technical Details
Message-ID:
<4124@vax1.tcd.ie>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!csvax1.cs.tcd.ie!swift.cs.tcd.ie!vax1.tcd.ie!ecarrollReferences:
<13920020@hpfelg.HP.COM> <13920027@hpfelg.HP.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!csvax1.cs.tcd.ie!swift.cs.tcd.ie!vax1.tcd.ie!ecarroll From: ecarroll@vax1.tcd.ie (Eddy Carroll) Newsgroups: comp.sys.amiga.tech Subject: Re: Anybody know how to do this stuff? Message-ID: <4124@vax1.tcd.ie> Date: 10 Dec 89 02:07:11 GMT References: <13920020@hpfelg.HP.COM> <13920027@hpfelg.HP.COM> Organization: Computer Laboratory, Trinity College Dublin Lines: 46