AmigaOS support fixed.
[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.1.1 2001/05/15 13:58:46 oes Exp $"
5 /*********************************************************************
6  *
7  * File        :  $Source: /cvsroot/ijbswa/current/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: amiga.h,v $
34  *    Revision 1.1.1.1  2001/05/15 13:58:46  oes
35  *    Initial import of version 2.9.3 source tree
36  *
37  *
38  *********************************************************************/
39 \f
40
41 #define _KERNEL
42 #include <sys/socket.h>
43 #undef _KERNEL
44
45 #define __NOLIBBASE__
46 #include <proto/socket.h>
47 #undef __NOLIBBASE__
48
49 #define __CONSTLIBBASEDECL__ const
50 #include <proto/exec.h>
51 #include <exec/tasks.h>
52 #include <proto/dos.h>
53 #include <dos/dostags.h>
54
55 struct UserData
56 {
57         struct Library *sb;
58         int eno;
59 };
60
61 #define SocketBase ((struct Library *)(((struct UserData *)(FindTask(NULL)->tc_UserData))->sb))
62 #define errno (((struct UserData *)(FindTask(NULL)->tc_UserData))->eno)
63 #define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,NULL)
64 #define inet_ntoa(x) Inet_NtoA(x.s_addr)
65
66 extern int childs;
67 extern struct Task *main_task;
68
69 void InitAmiga(void);
70 void amiga_exit(void);
71 void __memCleanUp(void);
72 __saveds ULONG server_thread(void);
73
74 #define exit(x)\
75 {\
76    if(main_task)\
77    {\
78       if(main_task == FindTask(NULL))\
79       {\
80          while(childs) Delay(10*TICKS_PER_SECOND); exit(x);\
81       } else {\
82          CloseLibrary(SocketBase);\
83          childs--;\
84          RemTask(NULL);\
85       }\
86    }\
87 }
88
89 #define EINTR 0
90
91 #endif /* ndef _AMIGA_H */
92 #endif /* def AMIGA */