Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * _ _ ____ _ |
| 3 | * Project ___| | | | _ \| | |
| 4 | * / __| | | | |_) | | |
| 5 | * | (__| |_| | _ <| |___ |
| 6 | * \___|\___/|_| \_\_____| |
| 7 | * |
Alex Deymo | 8f1a214 | 2016-06-28 14:49:26 -0700 | [diff] [blame] | 8 | * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 9 | * |
| 10 | * This software is licensed as described in the file COPYING, which |
| 11 | * you should have received as part of this distribution. The terms |
Alex Deymo | 8f1a214 | 2016-06-28 14:49:26 -0700 | [diff] [blame] | 12 | * are also available at https://curl.haxx.se/docs/copyright.html. |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 13 | * |
| 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. |
| 17 | * |
| 18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 | * KIND, either express or implied. |
| 20 | * |
| 21 | ***************************************************************************/ |
| 22 | |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 23 | #include "curl_setup.h" |
| 24 | |
| 25 | #if defined(__AMIGA__) && !defined(__ixemul__) |
| 26 | |
| 27 | #include <amitcp/socketbasetags.h> |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 28 | |
| 29 | #include "amigaos.h" |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 30 | |
| 31 | struct Library *SocketBase = NULL; |
| 32 | extern int errno, h_errno; |
| 33 | |
| 34 | #ifdef __libnix__ |
| 35 | #include <stabs.h> |
| 36 | void __request(const char *msg); |
| 37 | #else |
Alex Deymo | 8f1a214 | 2016-06-28 14:49:26 -0700 | [diff] [blame] | 38 | # define __request(msg) Printf(msg "\n\a") |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 39 | #endif |
| 40 | |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 41 | void Curl_amiga_cleanup() |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 42 | { |
| 43 | if(SocketBase) { |
| 44 | CloseLibrary(SocketBase); |
| 45 | SocketBase = NULL; |
| 46 | } |
| 47 | } |
| 48 | |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 49 | bool Curl_amiga_init() |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 50 | { |
| 51 | if(!SocketBase) |
| 52 | SocketBase = OpenLibrary("bsdsocket.library", 4); |
| 53 | |
| 54 | if(!SocketBase) { |
| 55 | __request("No TCP/IP Stack running!"); |
| 56 | return FALSE; |
| 57 | } |
| 58 | |
| 59 | if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno, |
Elliott Hughes | cee0338 | 2017-06-23 12:17:18 -0700 | [diff] [blame^] | 60 | SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "curl", |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 61 | TAG_DONE)) { |
| 62 | __request("SocketBaseTags ERROR"); |
| 63 | return FALSE; |
| 64 | } |
| 65 | |
| 66 | #ifndef __libnix__ |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 67 | atexit(Curl_amiga_cleanup); |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 68 | #endif |
| 69 | |
| 70 | return TRUE; |
| 71 | } |
| 72 | |
| 73 | #ifdef __libnix__ |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 74 | ADD2EXIT(Curl_amiga_cleanup, -50); |
Kristian Monsen | 5ab5018 | 2010-05-14 18:53:44 +0100 | [diff] [blame] | 75 | #endif |
| 76 | |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 77 | #endif /* __AMIGA__ && ! __ixemul__ */ |