source: UsbWattMeter/trunk/curl-7.47.1/lib/amigaos.c@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 2.0 KB
Line 
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) 1998 - 2015, 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
23#include "curl_setup.h"
24
25#if defined(__AMIGA__) && !defined(__ixemul__)
26
27#include <amitcp/socketbasetags.h>
28
29#include "amigaos.h"
30
31struct Library *SocketBase = NULL;
32extern int errno, h_errno;
33
34#ifdef __libnix__
35#include <stabs.h>
36void __request(const char *msg);
37#else
38# define __request( msg ) Printf( msg "\n\a")
39#endif
40
41void Curl_amiga_cleanup()
42{
43 if(SocketBase) {
44 CloseLibrary(SocketBase);
45 SocketBase = NULL;
46 }
47}
48
49bool Curl_amiga_init()
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,
60 SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "cURL",
61 TAG_DONE)) {
62 __request("SocketBaseTags ERROR");
63 return FALSE;
64 }
65
66#ifndef __libnix__
67 atexit(Curl_amiga_cleanup);
68#endif
69
70 return TRUE;
71}
72
73#ifdef __libnix__
74ADD2EXIT(Curl_amiga_cleanup, -50);
75#endif
76
77#endif /* __AMIGA__ && ! __ixemul__ */
Note: See TracBrowser for help on using the repository browser.