Replacing strsav() with string_append()
[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.5 2001/07/29 18:43:08 jongfoster 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.5  2001/07/29 18:43:08  jongfoster
35  *    Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
36  *    ANSI C rules.
37  *
38  *    Revision 1.4  2001/05/29 20:05:06  joergs
39  *    Fixed exit() macro not exiting if called before InitAmiga()
40  *    (junkbuster --help and --version).
41  *
42  *    Revision 1.3  2001/05/25 21:53:27  jongfoster
43  *    Fixing indentation
44  *
45  *    Revision 1.2  2001/05/23 00:13:58  joergs
46  *    AmigaOS support fixed.
47  *
48  *    Revision 1.1.1.1  2001/05/15 13:58:46  oes
49  *    Initial import of version 2.9.3 source tree
50  *
51  *
52  *********************************************************************/
53 \f
54
55 #define _KERNEL
56 #include <sys/socket.h>
57 #undef _KERNEL
58
59 #define __NOLIBBASE__
60 #include <proto/socket.h>
61 #undef __NOLIBBASE__
62
63 #define __CONSTLIBBASEDECL__ const
64 #include <proto/exec.h>
65 #include <exec/tasks.h>
66 #include <proto/dos.h>
67 #include <dos/dostags.h>
68
69 struct UserData
70 {
71    struct Library *sb;
72    int eno;
73 };
74
75 #define SocketBase ((struct Library *)(((struct UserData *)(FindTask(NULL)->tc_UserData))->sb))
76 #define errno (((struct UserData *)(FindTask(NULL)->tc_UserData))->eno)
77 #define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,NULL)
78 #define inet_ntoa(x) Inet_NtoA(x.s_addr)
79
80 extern int childs;
81 extern struct Task *main_task;
82
83 void InitAmiga(void);
84 void amiga_exit(void);
85 void __memCleanUp(void);
86 __saveds ULONG server_thread(void);
87
88 #define exit(x)                                             \
89 {                                                           \
90    if(main_task)                                            \
91    {                                                        \
92       if(main_task == FindTask(NULL))                       \
93       {                                                     \
94          while(childs) Delay(10*TICKS_PER_SECOND); exit(x); \
95       }                                                     \
96       else                                                  \
97       {                                                     \
98          CloseLibrary(SocketBase);                          \
99          childs--;                                          \
100          RemTask(NULL);                                     \
101       }                                                     \
102    }                                                        \
103    else                                                     \
104    {                                                        \
105       exit(x);                                              \
106    }                                                        \
107 }
108
109 #undef EINTR
110 #define EINTR 0
111
112 #endif /* ndef AMIGA_H_INCLUDED */
113 #endif /* def AMIGA */