home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
disk
/
Misc
/
dbEject
/
eject.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-16
|
1KB
|
59 lines
/*
eject for trackdisk-like devices.
*/
#include <exec/exec.h>
#include <dos/dos.h>
#include <devices/scsidisk.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <devices/trackdisk.h>
#include <string.h>
UBYTE version[] = "$VER: eject 1.0 (Mittwoch 16-Aug-95 20:57:26) by Daniel Balster";
struct IOStdReq *ior;
struct {
STRPTR device;
ULONG unit;
ULONG load;
ULONG unload;
} args = {0};
#define TMPL "DEVICE/A,UNIT/A/N,LOAD/S"
int main (void)
{
struct RDArgs *rda;
if (rda = ReadArgs(TMPL,(LONG*)&(args),NULL))
{
struct MsgPort *mp;
if(mp=CreateMsgPort())
{
if(ior=(struct IOStdReq*)CreateIORequest(mp,sizeof(struct IOStdReq)))
{
if(!OpenDevice(args.device,*(ULONG*)(args.unit),(struct IORequest*)ior,0))
{
ior->io_Command = TD_EJECT;
ior->io_Flags = IOF_QUICK;
ior->io_Length = args.load ? 0 : 1;
DoIO((struct IORequest*)ior);
CloseDevice((struct IORequest*)ior);
}
DeleteIORequest((struct IORequest*)ior);
}
DeleteMsgPort(mp);
}
}
else PrintFault(IoErr(),0);
return RETURN_OK;
}