boinc_fcgi.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // This file is part of BOINC.
  2. // http://boinc.berkeley.edu
  3. // Copyright (C) 2008 University of California
  4. //
  5. // BOINC is free software; you can redistribute it and/or modify it
  6. // under the terms of the GNU Lesser General Public License
  7. // as published by the Free Software Foundation,
  8. // either version 3 of the License, or (at your option) any later version.
  9. //
  10. // BOINC is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. // See the GNU Lesser General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Lesser General Public License
  16. // along with BOINC. If not, see <http://www.gnu.org/licenses/>.
  17. #ifdef _USING_FCGI_
  18. #include <fcgi_stdio.h>
  19. // Undefine the macros that can be replaced with appropriate overloads
  20. #undef fread
  21. #undef fwrite
  22. #undef fscanf
  23. #undef setbuf
  24. #undef fputs
  25. #undef fgets
  26. #undef fgetc
  27. #undef vfprintf
  28. #undef fprintf
  29. #undef fopen
  30. #undef fflush
  31. #undef fclose
  32. #undef freopen
  33. #undef ferror
  34. #undef feof
  35. #undef perror
  36. #endif
  37. #ifndef BOINC_FCGI_H
  38. #define BOINC_FCGI_H
  39. // This file is an attempt to fix some of the epidemic build problems
  40. // caused by libraries redefining the C stdio.h functions that has struck.
  41. // It's far better to use overloads in a C++ namespace to fix these issues
  42. // for a variety of reasons.
  43. #ifdef _USING_FCGI_
  44. #if defined(__cplusplus) || defined(c_plusplus)
  45. namespace FCGI {
  46. FCGI_FILE *fopen(const char *path, const char *mode);
  47. FCGI_FILE *freopen(const char *path, const char *mode, FCGI_FILE *file);
  48. int fflush(FCGI_FILE *file);
  49. int fprintf(FCGI_FILE *fp, const char *format, ...);
  50. int vfprintf(FCGI_FILE *fp, const char *format, va_list ap);
  51. char *fgets(char *str, int size, FCGI_FILE *fp);
  52. int fputs(const char *str, FCGI_FILE *fp);
  53. int fclose(FCGI_FILE *f);
  54. size_t fread(void *buf, size_t i, size_t j, FCGI_FILE *fp);
  55. size_t fwrite(void *buf, size_t i, size_t j, FCGI_FILE *fp);
  56. int fscanf(FCGI_FILE *fp, const char *format, ...);
  57. void setbuf(FCGI_FILE *f, char *buf);
  58. int fgetc(FCGI_FILE *f);
  59. int feof(FCGI_FILE *f);
  60. int ferror(FCGI_FILE *f);
  61. void perror(const char *s);
  62. // More left to do here. Just the minimum for BOINC done.
  63. } // end of namespace FCGI
  64. using namespace FCGI;
  65. #endif // __cplusplus
  66. #endif // _USING_FCGI_
  67. #endif // BOINC_FCGI_H