Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl-7.19.0 / lib / amigaos.c
blob315c08cd7fa1c8822a364d00347c950a8faf9afd
1 /***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at http://curl.haxx.se/docs/copyright.html.
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 * $Id: amigaos.c,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
22 ***************************************************************************/
24 #ifdef __AMIGA__ /* Any AmigaOS flavour */
26 #include "amigaos.h"
27 #include <amitcp/socketbasetags.h>
29 struct Library *SocketBase = NULL;
30 extern int errno, h_errno;
32 #ifdef __libnix__
33 #include <stabs.h>
34 void __request(const char *msg);
35 #else
36 # define __request( msg ) Printf( msg "\n\a")
37 #endif
39 void amiga_cleanup()
41 if(SocketBase) {
42 CloseLibrary(SocketBase);
43 SocketBase = NULL;
47 BOOL amiga_init()
49 if(!SocketBase)
50 SocketBase = OpenLibrary("bsdsocket.library", 4);
52 if(!SocketBase) {
53 __request("No TCP/IP Stack running!");
54 return FALSE;
57 if(SocketBaseTags(
58 SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,
59 // SBTM_SETVAL(SBTC_HERRNOLONGPTR), (ULONG) &h_errno,
60 SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL",
61 TAG_DONE)) {
63 __request("SocketBaseTags ERROR");
64 return FALSE;
67 #ifndef __libnix__
68 atexit(amiga_cleanup);
69 #endif
71 return TRUE;
74 #ifdef __libnix__
75 ADD2EXIT(amiga_cleanup,-50);
76 #endif
78 #endif /* __AMIGA__ */