home *** CD-ROM | disk | FTP | other *** search
- /*
- * KillClick2 - by Daniel Martin
- * December 14th, 1990.
- * USENET: martin@IRO.UMontreal.CA
- *
- * Based on KillClick Written by Brian Gontowski
- *
- * Modifications:
- * - Now turn off all connected drive units
- * - "#includes" controlled by a switch for compilation with MANX Aztec
- * - Use TD_NAME instead of "trackdisk.device" for compatibility
- * - Added prototyping for AINSI C compliance
- * - Shortened error messages, users don't know much of this stuff anyway.
- *
- * Bugs:
- * None.
- *
- * Remarks:
- * I'm not sure if we should put forbid()/permit() when modifying the public
- * structure TDU_PublicUnit in NoClick procedure.
- */
-
-
- #define AZTEC 1
-
-
- #include "exec/types.h"
- #include "exec/ports.h"
- #include "exec/io.h"
- #include "devices/trackdisk.h"
- #include "libraries/dos.h"
- #include "libraries/dosextens.h"
- #include "stdio.h"
-
-
- #ifdef AZTEC
- #include "clib/exec_protos.h"
- #include "clib/dos_protos.h"
- #else
- #include "proto/exec.h"
- #include "proto/dos.h"
- #endif
-
-
- /*-- Globals --*/
- extern struct Library *SysBase;
- struct MsgPort *DiskPort=NULL;
- struct IOExtTD *DiskReq=NULL;
- UBYTE DiskDev=FALSE;
- struct TDU_PublicUnit *DiskUnit;
- char DeviceName[] = TD_NAME;
- ULONG ChangeCount;
-
-
-
-
- void Finish (char *msg, int r)
- {
- if (DiskReq)
- DeleteIORequest ((struct IORequest *)DiskReq);
- if (DiskPort)
- DeleteMsgPort (DiskPort);
- if (msg)
- Write (Output (),(UBYTE *)msg,strlen (msg));
- _exit (r);
- }
-
-
-
-
- void NoClick(ULONG Unit)
- {
- if (!OpenDevice ((STRPTR)DeviceName,Unit,(struct IORequest *)DiskReq,0)) {
- DiskUnit=(struct TDU_PublicUnit *)DiskReq->iotd_Req.io_Unit;
- DiskUnit->tdu_PubFlags|=TDPF_NOCLICK;
- CloseDevice ((struct IORequest *)DiskReq);
- }
- }
-
-
-
-
- void _main ()
- {
- ULONG i = 0;
-
- if (SysBase->lib_Version<36)
- Finish ("ERROR: Need KickStart V36 or higher!\n",RETURN_FAIL);
- if (!(DiskPort=CreateMsgPort ()) ||
- !(DiskReq=(struct IOExtTD *) CreateIORequest (DiskPort,sizeof (struct IOExtTD))))
- Finish ("ERROR: Allocations failed!\n",RETURN_FAIL);
-
- /* For all units */
- do {NoClick(i);} while (++i < NUMUNITS);
-
- Finish(NULL,RETURN_OK);
- }
-