amigaos.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                  _   _ ____  _
00003  *  Project                     ___| | | |  _ \| |
00004  *                             / __| | | | |_) | |
00005  *                            | (__| |_| |  _ <| |___
00006  *                             \___|\___/|_| \_\_____|
00007  *
00008  * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
00009  *
00010  * This software is licensed as described in the file COPYING, which
00011  * you should have received as part of this distribution. The terms
00012  * are also available at https://curl.haxx.se/docs/copyright.html.
00013  *
00014  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
00015  * copies of the Software, and permit persons to whom the Software is
00016  * furnished to do so, under the terms of the COPYING file.
00017  *
00018  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
00019  * KIND, either express or implied.
00020  *
00021  ***************************************************************************/
00022 
00023 #include "curl_setup.h"
00024 
00025 #if defined(__AMIGA__) && !defined(__ixemul__)
00026 
00027 #include <amitcp/socketbasetags.h>
00028 
00029 #include "amigaos.h"
00030 
00031 struct Library *SocketBase = NULL;
00032 extern int errno, h_errno;
00033 
00034 #ifdef __libnix__
00035 #include <stabs.h>
00036 void __request(const char *msg);
00037 #else
00038 # define __request(msg)       Printf(msg "\n\a")
00039 #endif
00040 
00041 void Curl_amiga_cleanup()
00042 {
00043   if(SocketBase) {
00044     CloseLibrary(SocketBase);
00045     SocketBase = NULL;
00046   }
00047 }
00048 
00049 bool Curl_amiga_init()
00050 {
00051   if(!SocketBase)
00052     SocketBase = OpenLibrary("bsdsocket.library", 4);
00053 
00054   if(!SocketBase) {
00055     __request("No TCP/IP Stack running!");
00056     return FALSE;
00057   }
00058 
00059   if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,
00060                     SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "curl",
00061                     TAG_DONE)) {
00062     __request("SocketBaseTags ERROR");
00063     return FALSE;
00064   }
00065 
00066 #ifndef __libnix__
00067   atexit(Curl_amiga_cleanup);
00068 #endif
00069 
00070   return TRUE;
00071 }
00072 
00073 #ifdef __libnix__
00074 ADD2EXIT(Curl_amiga_cleanup, -50);
00075 #endif
00076 
00077 #endif /* __AMIGA__ && ! __ixemul__ */


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:01