Adapt to CVS version as of 2006-09-23.
[privoxy.git] / amiga.h
1 #ifdef AMIGA
2 #ifndef AMIGA_H_INCLUDED
3 #define AMIGA_H_INCLUDED
4 #define AMIGA_H_VERSION "$Id: amiga.h,v 1.9 2002/03/26 22:29:54 swa Exp $"
5 /*********************************************************************
6  *
7  * File        :  $Source: /cvsroot/ijbswa/current/Attic/amiga.h,v $
8  *
9  * Purpose     :  Amiga-specific declarations.
10  *
11  * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
12  *                Privoxy team. http://www.privoxy.org/
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.9  2002/03/26 22:29:54  swa
35  *    we have a new homepage!
36  *
37  *    Revision 1.8  2002/03/24 13:25:43  swa
38  *    name change related issues
39  *
40  *    Revision 1.7  2002/03/03 09:18:03  joergs
41  *    Made jumbjuster work on AmigaOS again.
42  *
43  *    Revision 1.6  2001/10/13 12:46:08  joergs
44  *    Added #undef EINTR to avoid warnings
45  *
46  *    Revision 1.5  2001/07/29 18:43:08  jongfoster
47  *    Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
48  *    ANSI C rules.
49  *
50  *    Revision 1.4  2001/05/29 20:05:06  joergs
51  *    Fixed exit() macro not exiting if called before InitAmiga()
52  *    (junkbuster --help and --version).
53  *
54  *    Revision 1.3  2001/05/25 21:53:27  jongfoster
55  *    Fixing indentation
56  *
57  *    Revision 1.2  2001/05/23 00:13:58  joergs
58  *    AmigaOS support fixed.
59  *
60  *    Revision 1.1.1.1  2001/05/15 13:58:46  oes
61  *    Initial import of version 2.9.3 source tree
62  *
63  *
64  *********************************************************************/
65 \f
66
67 #define _KERNEL
68 #include <sys/socket.h>
69 #undef _KERNEL
70
71 #define __NOLIBBASE__
72 #include <proto/socket.h>
73 #undef __NOLIBBASE__
74
75 #define __CONSTLIBBASEDECL__ const
76 #define DEVICES_TIMER_H
77 #include <proto/exec.h>
78 #include <exec/tasks.h>
79 #include <proto/dos.h>
80 #include <dos/dostags.h>
81
82 struct UserData
83 {
84    struct Library *sb;
85    int eno;
86 };
87
88 #define SocketBase ((struct Library *)(((struct UserData *)(FindTask(NULL)->tc_UserData))->sb))
89 #define errno (((struct UserData *)(FindTask(NULL)->tc_UserData))->eno)
90 #define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,NULL)
91 #define inet_ntoa(x) Inet_NtoA(x.s_addr)
92
93 extern int childs;
94 extern struct Task *main_task;
95
96 void InitAmiga(void);
97 void amiga_exit(void);
98 void __memCleanUp(void);
99 __saveds ULONG server_thread(void);
100
101 #define exit(x)                                             \
102 {                                                           \
103    if(main_task)                                            \
104    {                                                        \
105       if(main_task == FindTask(NULL))                       \
106       {                                                     \
107          while(childs) Delay(10*TICKS_PER_SECOND); exit(x); \
108       }                                                     \
109       else                                                  \
110       {                                                     \
111          CloseLibrary(SocketBase);                          \
112          childs--;                                          \
113          RemTask(NULL);                                     \
114       }                                                     \
115    }                                                        \
116    else                                                     \
117    {                                                        \
118       exit(x);                                              \
119    }                                                        \
120 }
121
122 #undef EINTR
123 #define EINTR 0
124
125 #endif /* ndef AMIGA_H_INCLUDED */
126 #endif /* def AMIGA */