fopen.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef HEADER_CURLX_FOPEN_H
  2. #define HEADER_CURLX_FOPEN_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) Daniel Stenberg, <[email protected]>, 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. #include "../curl_setup.h"
  27. #include "multibyte.h"
  28. #ifdef HAVE_FCNTL_H
  29. #include <fcntl.h> /* for open() and attributes */
  30. #endif
  31. int curlx_fseek(void *stream, curl_off_t offset, int whence);
  32. #if defined(_WIN32) && !defined(UNDER_CE)
  33. FILE *curlx_win32_fopen(const char *filename, const char *mode);
  34. int curlx_win32_stat(const char *path, struct_stat *buffer);
  35. int curlx_win32_open(const char *filename, int oflag, ...);
  36. #define CURLX_FOPEN_LOW(fname, mode) curlx_win32_fopen(fname, mode)
  37. #define curlx_stat(fname, stp) curlx_win32_stat(fname, stp)
  38. #define curlx_open curlx_win32_open
  39. #else
  40. #define CURLX_FOPEN_LOW fopen
  41. #define curlx_stat(fname, stp) stat(fname, stp)
  42. #define curlx_open open
  43. #endif
  44. #ifdef CURLDEBUG
  45. #define curlx_fopen(file,mode) curl_dbg_fopen(file,mode,__LINE__,__FILE__)
  46. #define curlx_fdopen(file,mode) curl_dbg_fdopen(file,mode,__LINE__,__FILE__)
  47. #define curlx_fclose(file) curl_dbg_fclose(file,__LINE__,__FILE__)
  48. #else
  49. #define curlx_fopen CURLX_FOPEN_LOW
  50. #define curlx_fdopen fdopen
  51. #define curlx_fclose fclose
  52. #endif
  53. #endif /* HEADER_CURLX_FOPEN_H */