6f132d0b55db55c6a634fe5fc2568675b25a654a
[privoxy.git] / amiga.h
1 #ifdef AMIGA
2 #ifndef _AMIGA_H
3 #define _AMIGA_H
4 #define AMIGA_H_VERSION "$Id: amiga.h,v 1.1 2001/05/13 21:57:06 administrator Exp $"
5 /*********************************************************************
6  *
7  * File        :  $Source: /home/administrator/cvs/ijb/amiga.h,v $
8  *
9  * Purpose     :  Amiga-specific declarations.
10  *
11  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
12  *                IJBSWA team.  http://ijbswa.sourceforge.net
13  *
14  *                This program is free software; you can redistribute it 
15  *                and/or modify it under the terms of the GNU General
16  *                Public License as published by the Free Software
17  *                Foundation; either version 2 of the License, or (at
18  *                your option) any later version.
19  *
20  *                This program is distributed in the hope that it will
21  *                be useful, but WITHOUT ANY WARRANTY; without even the
22  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
23  *                PARTICULAR PURPOSE.  See the GNU General Public
24  *                License for more details.
25  *
26  *                The GNU General Public License should be included with
27  *                this file.  If not, you can view it at
28  *                http://www.gnu.org/copyleft/gpl.html
29  *                or write to the Free Software Foundation, Inc., 59
30  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
31  *
32  * Revisions   :
33  *    $Log: jcc.h,v $
34  *
35  *********************************************************************/
36 \f
37
38 #define _KERNEL
39 #include <sys/socket.h>
40 #undef _KERNEL
41
42 #define __NOLIBBASE__
43 #include <proto/socket.h>
44 #undef __NOLIBBASE__
45
46 #include <proto/exec.h>
47 #include <exec/tasks.h>
48 #include <proto/dos.h>
49 #include <dos/dostags.h>
50
51 struct UserData
52 {
53         struct Library *sb;
54         int eno;
55 };
56
57 #define SocketBase ((struct Library *)(((struct UserData *)(FindTask(NULL)->tc_UserData))->sb))
58 #define errno (((struct UserData *)(FindTask(NULL)->tc_UserData))->eno)
59 #define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,NULL)
60 #define inet_ntoa(x) Inet_NtoA(x.s_addr)
61
62 extern int childs;
63 extern struct Task *main_task;
64
65 void InitAmiga(void);
66 void amiga_exit(void);
67 void __memCleanUp(void);
68 __saveds ULONG server_thread(void);
69
70 #define exit(x)\
71 {\
72    if(main_task)\
73    {\
74       if(main_task == FindTask(NULL))\
75       {\
76          while(childs) Delay(10*TICKS_PER_SECOND); exit(x);\
77       } else {\
78          CloseLibrary(SocketBase);\
79          childs--;\
80          RemTask(NULL);\
81       }\
82    }\
83 }
84
85 #define EINTR 0
86
87 #endif /* ndef _AMIGA_H */
88 #endif /* def AMIGA */