2
0

amigaos.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) 1998 - 2009, 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 http://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. #ifdef __AMIGA__ /* Any AmigaOS flavour */
  23. #include "amigaos.h"
  24. #include <amitcp/socketbasetags.h>
  25. struct Library *SocketBase = NULL;
  26. extern int errno, h_errno;
  27. #ifdef __libnix__
  28. #include <stabs.h>
  29. void __request(const char *msg);
  30. #else
  31. # define __request( msg ) Printf( msg "\n\a")
  32. #endif
  33. void amiga_cleanup()
  34. {
  35. if(SocketBase) {
  36. CloseLibrary(SocketBase);
  37. SocketBase = NULL;
  38. }
  39. }
  40. BOOL amiga_init()
  41. {
  42. if(!SocketBase)
  43. SocketBase = OpenLibrary("bsdsocket.library", 4);
  44. if(!SocketBase) {
  45. __request("No TCP/IP Stack running!");
  46. return FALSE;
  47. }
  48. if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,
  49. SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL",
  50. TAG_DONE)) {
  51. __request("SocketBaseTags ERROR");
  52. return FALSE;
  53. }
  54. #ifndef __libnix__
  55. atexit(amiga_cleanup);
  56. #endif
  57. return TRUE;
  58. }
  59. #ifdef __libnix__
  60. ADD2EXIT(amiga_cleanup,-50);
  61. #endif
  62. #else /* __AMIGA__ */
  63. #ifdef __POCC__
  64. # pragma warn(disable:2024) /* Disable warning #2024: Empty input file */
  65. #endif
  66. #endif /* __AMIGA__ */