argp-namefrob.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* Name frobnication for compiling argp outside of glibc
  2. Copyright (C) 1997-2019 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. <http://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. #include "mempcpy.h"
  72. #include "strcase.h"
  73. #include "strchrnul.h"
  74. #include "strndup.h"
  75. /* normal libc functions we call */
  76. #undef __flockfile
  77. #define __flockfile flockfile
  78. #undef __funlockfile
  79. #define __funlockfile funlockfile
  80. #undef __mempcpy
  81. #define __mempcpy mempcpy
  82. #undef __sleep
  83. #define __sleep sleep
  84. #undef __strcasecmp
  85. #define __strcasecmp strcasecmp
  86. #undef __strchrnul
  87. #define __strchrnul strchrnul
  88. #undef __strerror_r
  89. #define __strerror_r strerror_r
  90. #undef __strndup
  91. #define __strndup strndup
  92. #if defined(HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
  93. # define clearerr_unlocked(x) clearerr (x)
  94. #endif
  95. #if defined(HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
  96. # define feof_unlocked(x) feof (x)
  97. # endif
  98. #if defined(HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
  99. # define ferror_unlocked(x) ferror (x)
  100. # endif
  101. #if defined(HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
  102. # define fflush_unlocked(x) fflush (x)
  103. # endif
  104. #if defined(HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
  105. # define fgets_unlocked(x,y,z) fgets (x,y,z)
  106. # endif
  107. #if defined(HAVE_DECL_FPUTC_UNLOCKED) && !HAVE_DECL_FPUTC_UNLOCKED
  108. # define fputc_unlocked(x,y) fputc (x,y)
  109. # endif
  110. #if defined(HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
  111. # define fputs_unlocked(x,y) fputs (x,y)
  112. # endif
  113. #if defined(HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
  114. # define fread_unlocked(w,x,y,z) fread (w,x,y,z)
  115. # endif
  116. #if defined(HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
  117. # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
  118. # endif
  119. #if defined(HAVE_DECL_GETC_UNLOCKED) && !HAVE_DECL_GETC_UNLOCKED
  120. # define getc_unlocked(x) getc (x)
  121. # endif
  122. #if defined(HAVE_DECL_GETCHAR_UNLOCKED) && !HAVE_DECL_GETCHAR_UNLOCKED
  123. # define getchar_unlocked() getchar ()
  124. # endif
  125. #if defined(HAVE_DECL_PUTC_UNLOCKED) && !HAVE_DECL_PUTC_UNLOCKED
  126. # define putc_unlocked(x,y) putc (x,y)
  127. # endif
  128. #if defined(HAVE_DECL_PUTCHAR_UNLOCKED) && !HAVE_DECL_PUTCHAR_UNLOCKED
  129. # define putchar_unlocked(x) putchar (x)
  130. # endif
  131. extern char *__argp_basename (char *name);
  132. #endif /* !_LIBC */
  133. #ifndef __set_errno
  134. #define __set_errno(e) (errno = (e))
  135. #endif
  136. #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
  137. # define __argp_short_program_name() (program_invocation_short_name)
  138. #else
  139. extern char *__argp_short_program_name (void);
  140. #endif