quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

tool_setup.h (3192B)


      1 #ifndef HEADER_CURL_TOOL_SETUP_H
      2 #define HEADER_CURL_TOOL_SETUP_H
      3 /***************************************************************************
      4  *                                  _   _ ____  _
      5  *  Project                     ___| | | |  _ \| |
      6  *                             / __| | | | |_) | |
      7  *                            | (__| |_| |  _ <| |___
      8  *                             \___|\___/|_| \_\_____|
      9  *
     10  * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
     11  *
     12  * This software is licensed as described in the file COPYING, which
     13  * you should have received as part of this distribution. The terms
     14  * are also available at https://curl.se/docs/copyright.html.
     15  *
     16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
     17  * copies of the Software, and permit persons to whom the Software is
     18  * furnished to do so, under the terms of the COPYING file.
     19  *
     20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
     21  * KIND, either express or implied.
     22  *
     23  * SPDX-License-Identifier: curl
     24  *
     25  ***************************************************************************/
     26 
     27 #ifndef CURL_NO_OLDIES
     28 #define CURL_NO_OLDIES
     29 #endif
     30 
     31 /*
     32  * curl_setup.h may define preprocessor macros such as _FILE_OFFSET_BITS and
     33  * _LARGE_FILES in order to support files larger than 2 GB. On platforms
     34  * where this happens it is mandatory that these macros are defined before
     35  * any system header file is included, otherwise file handling function
     36  * prototypes will be misdeclared and curl tool may not build properly;
     37  * therefore we must include curl_setup.h before curl.h when building curl.
     38  */
     39 
     40 #include "curl_setup.h" /* from the lib directory */
     41 
     42 extern FILE *tool_stderr;
     43 
     44 /*
     45  * curl tool certainly uses libcurl's external interface.
     46  */
     47 
     48 #include <curl/curl.h> /* external interface */
     49 
     50 #include <curlx/curlx.h>
     51 
     52 /*
     53  * Platform specific stuff.
     54  */
     55 
     56 #ifdef macintosh
     57 #  define main(x,y) curl_main(x,y)
     58 #endif
     59 
     60 #ifndef CURL_OS
     61 #define CURL_OS "unknown"
     62 #endif
     63 
     64 #ifndef UNPRINTABLE_CHAR
     65 /* define what to use for unprintable characters */
     66 #define UNPRINTABLE_CHAR '.'
     67 #endif
     68 
     69 #ifndef HAVE_STRDUP
     70 #include "tool_strdup.h"
     71 #endif
     72 
     73 #ifndef tool_nop_stmt
     74 #define tool_nop_stmt do { } while(0)
     75 #endif
     76 
     77 #ifdef _WIN32
     78 #  define CURL_STRICMP(p1, p2)  _stricmp(p1, p2)
     79 #elif defined(HAVE_STRCASECMP)
     80 #  ifdef HAVE_STRINGS_H
     81 #  include <strings.h>
     82 #  endif
     83 #  define CURL_STRICMP(p1, p2)  strcasecmp(p1, p2)
     84 #elif defined(HAVE_STRCMPI)
     85 #  define CURL_STRICMP(p1, p2)  strcmpi(p1, p2)
     86 #elif defined(HAVE_STRICMP)
     87 #  define CURL_STRICMP(p1, p2)  stricmp(p1, p2)
     88 #else
     89 #  define CURL_STRICMP(p1, p2)  strcmp(p1, p2)
     90 #endif
     91 
     92 #ifdef _WIN32
     93 /* set in init_terminal() */
     94 extern bool tool_term_has_bold;
     95 
     96 #ifdef UNDER_CE
     97 #  undef isatty
     98 #  define isatty(fd) 0  /* fd is void*, expects int */
     99 #  undef _get_osfhandle
    100 #  define _get_osfhandle(fd) (fd)
    101 #  undef _getch
    102 #  define _getch() 0
    103 #endif
    104 
    105 #ifndef HAVE_FTRUNCATE
    106 
    107 int tool_ftruncate64(int fd, curl_off_t where);
    108 
    109 #undef  ftruncate
    110 #define ftruncate(fd,where) tool_ftruncate64(fd,where)
    111 
    112 #define HAVE_FTRUNCATE 1
    113 #define USE_TOOL_FTRUNCATE 1
    114 
    115 #endif /* ! HAVE_FTRUNCATE */
    116 #endif /* _WIN32 */
    117 
    118 #endif /* HEADER_CURL_TOOL_SETUP_H */