2
0

amigaos.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
  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
  12. * are also available at https://curl.haxx.se/docs/copyright.html.
  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. #include "curl_setup.h"
  23. #ifdef __AMIGA__
  24. # include "amigaos.h"
  25. # if defined(HAVE_PROTO_BSDSOCKET_H) && !defined(USE_AMISSL)
  26. # include <amitcp/socketbasetags.h>
  27. # endif
  28. # ifdef __libnix__
  29. # include <stabs.h>
  30. # endif
  31. #endif
  32. /* The last #include files should be: */
  33. #include "curl_memory.h"
  34. #include "memdebug.h"
  35. #ifdef __AMIGA__
  36. #if defined(HAVE_PROTO_BSDSOCKET_H) && !defined(USE_AMISSL)
  37. struct Library *SocketBase = NULL;
  38. extern int errno, h_errno;
  39. #ifdef __libnix__
  40. void __request(const char *msg);
  41. #else
  42. # define __request(msg) Printf(msg "\n\a")
  43. #endif
  44. void Curl_amiga_cleanup()
  45. {
  46. if(SocketBase) {
  47. CloseLibrary(SocketBase);
  48. SocketBase = NULL;
  49. }
  50. }
  51. bool Curl_amiga_init()
  52. {
  53. if(!SocketBase)
  54. SocketBase = OpenLibrary("bsdsocket.library", 4);
  55. if(!SocketBase) {
  56. __request("No TCP/IP Stack running!");
  57. return FALSE;
  58. }
  59. if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,
  60. SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "curl",
  61. TAG_DONE)) {
  62. __request("SocketBaseTags ERROR");
  63. return FALSE;
  64. }
  65. #ifndef __libnix__
  66. atexit(Curl_amiga_cleanup);
  67. #endif
  68. return TRUE;
  69. }
  70. #ifdef __libnix__
  71. ADD2EXIT(Curl_amiga_cleanup, -50);
  72. #endif
  73. #endif /* HAVE_PROTO_BSDSOCKET_H */
  74. #ifdef USE_AMISSL
  75. void Curl_amiga_X509_free(X509 *a)
  76. {
  77. X509_free(a);
  78. }
  79. #endif /* USE_AMISSL */
  80. #endif /* __AMIGA__ */