argp-namefrob.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* Name frobnication for compiling argp outside of glibc
  2. Copyright (C) 1997-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Written by Miles Bader <miles@gnu.ai.mit.edu>.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <https://www.gnu.org/licenses/>. */
  16. #if !_LIBC
  17. /* This code is written for inclusion in gnu-libc, and uses names in the
  18. namespace reserved for libc. If we're not compiling in libc, define those
  19. names to be the normal ones instead. */
  20. /* argp-parse functions */
  21. #undef __argp_parse
  22. #define __argp_parse argp_parse
  23. #undef __option_is_end
  24. #define __option_is_end _option_is_end
  25. #undef __option_is_short
  26. #define __option_is_short _option_is_short
  27. #undef __argp_input
  28. #define __argp_input _argp_input
  29. /* argp-help functions */
  30. #undef __argp_help
  31. #define __argp_help argp_help
  32. #undef __argp_error
  33. #define __argp_error argp_error
  34. #undef __argp_failure
  35. #define __argp_failure argp_failure
  36. #undef __argp_state_help
  37. #define __argp_state_help argp_state_help
  38. #undef __argp_usage
  39. #define __argp_usage argp_usage
  40. /* argp-fmtstream functions */
  41. #undef __argp_make_fmtstream
  42. #define __argp_make_fmtstream argp_make_fmtstream
  43. #undef __argp_fmtstream_free
  44. #define __argp_fmtstream_free argp_fmtstream_free
  45. #undef __argp_fmtstream_putc
  46. #define __argp_fmtstream_putc argp_fmtstream_putc
  47. #undef __argp_fmtstream_puts
  48. #define __argp_fmtstream_puts argp_fmtstream_puts
  49. #undef __argp_fmtstream_write
  50. #define __argp_fmtstream_write argp_fmtstream_write
  51. #undef __argp_fmtstream_printf
  52. #define __argp_fmtstream_printf argp_fmtstream_printf
  53. #undef __argp_fmtstream_set_lmargin
  54. #define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
  55. #undef __argp_fmtstream_set_rmargin
  56. #define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
  57. #undef __argp_fmtstream_set_wmargin
  58. #define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
  59. #undef __argp_fmtstream_point
  60. #define __argp_fmtstream_point argp_fmtstream_point
  61. #undef __argp_fmtstream_update
  62. #define __argp_fmtstream_update _argp_fmtstream_update
  63. #undef __argp_fmtstream_ensure
  64. #define __argp_fmtstream_ensure _argp_fmtstream_ensure
  65. #undef __argp_fmtstream_lmargin
  66. #define __argp_fmtstream_lmargin argp_fmtstream_lmargin
  67. #undef __argp_fmtstream_rmargin
  68. #define __argp_fmtstream_rmargin argp_fmtstream_rmargin
  69. #undef __argp_fmtstream_wmargin
  70. #define __argp_fmtstream_wmargin argp_fmtstream_wmargin
  71. /* normal libc functions we call */
  72. #undef __flockfile
  73. #define __flockfile flockfile
  74. #undef __funlockfile
  75. #define __funlockfile funlockfile
  76. #undef __mempcpy
  77. #define __mempcpy mempcpy
  78. #undef __sleep
  79. #define __sleep sleep
  80. #undef __strcasecmp
  81. #define __strcasecmp strcasecmp
  82. #undef __strchrnul
  83. #define __strchrnul strchrnul
  84. #undef __strerror_r
  85. #define __strerror_r strerror_r
  86. #undef __strndup
  87. #define __strndup strndup
  88. #if defined(HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
  89. # define clearerr_unlocked(x) clearerr (x)
  90. #endif
  91. #if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
  92. # define feof_unlocked(x) feof (x)
  93. # endif
  94. #if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
  95. # define ferror_unlocked(x) ferror (x)
  96. # endif
  97. #if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
  98. # define fflush_unlocked(x) fflush (x)
  99. # endif
  100. #if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
  101. # define fgets_unlocked(x,y,z) fgets (x,y,z)
  102. # endif
  103. #if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED
  104. # define fputc_unlocked(x,y) fputc (x,y)
  105. # endif
  106. #if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
  107. # define fputs_unlocked(x,y) fputs (x,y)
  108. # endif
  109. #if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
  110. # define fread_unlocked(w,x,y,z) fread (w,x,y,z)
  111. # endif
  112. #if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
  113. # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
  114. # endif
  115. #if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED
  116. # define getc_unlocked(x) getc (x)
  117. # endif
  118. #if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED
  119. # define getchar_unlocked() getchar ()
  120. # endif
  121. #if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED
  122. # define putc_unlocked(x,y) putc (x,y)
  123. # endif
  124. #if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED
  125. # define putchar_unlocked(x) putchar (x)
  126. # endif
  127. extern char *__argp_basename (char *name);
  128. #endif /* !_LIBC */
  129. #ifndef __set_errno
  130. #define __set_errno(e) (errno = (e))
  131. #endif
  132. #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
  133. # define __argp_short_program_name() (program_invocation_short_name)
  134. #else
  135. extern char *__argp_short_program_name (void);
  136. #endif