argp-namefrob.h 5.4 KB

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