home *** CD-ROM | disk | FTP | other *** search
- /*
- * $Filename: SystemDep.c $
- * $Revision: 1.1 $
- * $Date: 1994/04/03 14:38:12 $
- *
- * Copyright (C) 1993 by Peter Simons <simons@peti.GUN.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: SystemDep.c,v 1.1 1994/04/03 14:38:12 simons Exp simons $
- *
- */
-
-
- /************************************* includes ***********/
- #include <stdio.h>
- #include <exec/exec.h>
- #include <dos/dos.h>
- #include <libraries/netsupport.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/netsupport.h>
-
- #include "protos.h"
-
- /************************************* global variables ***/
- static const char __RCSId[] = "$Id: SystemDep.c,v 1.1 1994/04/03 14:38:12 simons Exp simons $";
-
- #ifdef AMIGA
- struct NetSupportLibrary *NetSupportBase = NULL;
- #endif
-
- /************************************* routines ***********/
-
- /*
- * Initialize and open all required system resources we'll
- * need for our program.
- */
-
- int InitSystem(void)
- {
- #ifdef AMIGA
- if (!(NetSupportBase = (struct NetSupportLibrary *) OpenLibrary(NETSUPPORTNAME, 0L))) {
- fprintf(stderr, "FATAL ERROR: Failed opening %s!\n", NETSUPPORTNAME);
- return 0;
- }
-
- if (!(DOSBase = (struct DosLibrary *) OpenLibrary(DOSNAME, 0L))) {
- fprintf(stderr, "FATAL ERROR: Failed opening %s!\n", DOSNAME);
- return 0;
- }
-
- return 1;
- #endif
- }
-
-
-
- /* Free all previously allocated system resources. */
-
- void FreeSystem(void)
- {
- #ifdef AMIGA
- if (NetSupportBase) {
- UnLockFiles();
- CloseLibrary((struct Library *) NetSupportBase);
- }
-
- if (DOSBase)
- CloseLibrary((struct Library *) DOSBase);
- #endif
- }
-
-
-
- #ifdef AMIGA
-
- /*
- * My Amiga C compiler allows to simply replace the routine that is
- * called whenever a CTRL-C interrupt is detected. You UNIX folks
- * have to install this trap handler using signal() in InitSystem().
- * Sorry. :-))
- */
-
- void __regargs _CXBRK(void)
- {
- break_detected = 1;
- }
-
- #endif
-
-
- #ifdef AMIGA
-
- /*
- * sleep() is available under UNIX, as far as I know, so we just need
- * to define it for the Amiga.
- */
-
- void sleep(int secs)
- {
- Delay(secs*50);
- }
-
- #endif
-