string.in.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. /* A GNU-like <string.h>.
  2. Copyright (C) 1995-1996, 2001-2008 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  14. #ifndef _GL_STRING_H
  15. /* The include_next requires a split double-inclusion guard. */
  16. #@INCLUDE_NEXT@ @NEXT_STRING_H@
  17. #ifndef _GL_STRING_H
  18. #define _GL_STRING_H
  19. #ifndef __attribute__
  20. /* This feature is available in gcc versions 2.5 and later. */
  21. # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
  22. # define __attribute__(Spec) /* empty */
  23. # endif
  24. /* The attribute __pure__ was added in gcc 2.96. */
  25. # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
  26. # define __pure__ /* empty */
  27. # endif
  28. #endif
  29. /* The definition of GL_LINK_WARNING is copied here. */
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /* Return the first occurrence of NEEDLE in HAYSTACK. */
  34. #if @GNULIB_MEMMEM@
  35. # if @REPLACE_MEMMEM@
  36. # define memmem rpl_memmem
  37. # endif
  38. # if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
  39. extern void *memmem (void const *__haystack, size_t __haystack_len,
  40. void const *__needle, size_t __needle_len)
  41. __attribute__ ((__pure__));
  42. # endif
  43. #elif defined GNULIB_POSIXCHECK
  44. # undef memmem
  45. # define memmem(a,al,b,bl) \
  46. (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
  47. "use gnulib module memmem-simple for portability, " \
  48. "and module memmem for speed" ), \
  49. memmem (a, al, b, bl))
  50. #endif
  51. /* Copy N bytes of SRC to DEST, return pointer to bytes after the
  52. last written byte. */
  53. #if @GNULIB_MEMPCPY@
  54. # if ! @HAVE_MEMPCPY@
  55. extern void *mempcpy (void *restrict __dest, void const *restrict __src,
  56. size_t __n);
  57. # endif
  58. #elif defined GNULIB_POSIXCHECK
  59. # undef mempcpy
  60. # define mempcpy(a,b,n) \
  61. (GL_LINK_WARNING ("mempcpy is unportable - " \
  62. "use gnulib module mempcpy for portability"), \
  63. mempcpy (a, b, n))
  64. #endif
  65. /* Search backwards through a block for a byte (specified as an int). */
  66. #if @GNULIB_MEMRCHR@
  67. # if ! @HAVE_DECL_MEMRCHR@
  68. extern void *memrchr (void const *, int, size_t)
  69. __attribute__ ((__pure__));
  70. # endif
  71. #elif defined GNULIB_POSIXCHECK
  72. # undef memrchr
  73. # define memrchr(a,b,c) \
  74. (GL_LINK_WARNING ("memrchr is unportable - " \
  75. "use gnulib module memrchr for portability"), \
  76. memrchr (a, b, c))
  77. #endif
  78. /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
  79. #if @GNULIB_STPCPY@
  80. # if ! @HAVE_STPCPY@
  81. extern char *stpcpy (char *restrict __dst, char const *restrict __src);
  82. # endif
  83. #elif defined GNULIB_POSIXCHECK
  84. # undef stpcpy
  85. # define stpcpy(a,b) \
  86. (GL_LINK_WARNING ("stpcpy is unportable - " \
  87. "use gnulib module stpcpy for portability"), \
  88. stpcpy (a, b))
  89. #endif
  90. /* Copy no more than N bytes of SRC to DST, returning a pointer past the
  91. last non-NUL byte written into DST. */
  92. #if @GNULIB_STPNCPY@
  93. # if ! @HAVE_STPNCPY@
  94. # define stpncpy gnu_stpncpy
  95. extern char *stpncpy (char *restrict __dst, char const *restrict __src,
  96. size_t __n);
  97. # endif
  98. #elif defined GNULIB_POSIXCHECK
  99. # undef stpncpy
  100. # define stpncpy(a,b,n) \
  101. (GL_LINK_WARNING ("stpncpy is unportable - " \
  102. "use gnulib module stpncpy for portability"), \
  103. stpncpy (a, b, n))
  104. #endif
  105. #if defined GNULIB_POSIXCHECK
  106. /* strchr() does not work with multibyte strings if the locale encoding is
  107. GB18030 and the character to be searched is a digit. */
  108. # undef strchr
  109. # define strchr(s,c) \
  110. (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
  111. "in some multibyte locales - " \
  112. "use mbschr if you care about internationalization"), \
  113. strchr (s, c))
  114. #endif
  115. /* Find the first occurrence of C in S or the final NUL byte. */
  116. #if @GNULIB_STRCHRNUL@
  117. # if ! @HAVE_STRCHRNUL@
  118. extern char *strchrnul (char const *__s, int __c_in)
  119. __attribute__ ((__pure__));
  120. # endif
  121. #elif defined GNULIB_POSIXCHECK
  122. # undef strchrnul
  123. # define strchrnul(a,b) \
  124. (GL_LINK_WARNING ("strchrnul is unportable - " \
  125. "use gnulib module strchrnul for portability"), \
  126. strchrnul (a, b))
  127. #endif
  128. /* Duplicate S, returning an identical malloc'd string. */
  129. #if @GNULIB_STRDUP@
  130. # if ! @HAVE_DECL_STRDUP@ && ! defined strdup
  131. extern char *strdup (char const *__s);
  132. # endif
  133. #elif defined GNULIB_POSIXCHECK
  134. # undef strdup
  135. # define strdup(a) \
  136. (GL_LINK_WARNING ("strdup is unportable - " \
  137. "use gnulib module strdup for portability"), \
  138. strdup (a))
  139. #endif
  140. /* Return a newly allocated copy of at most N bytes of STRING. */
  141. #if @GNULIB_STRNDUP@
  142. # if ! @HAVE_STRNDUP@
  143. # undef strndup
  144. # define strndup rpl_strndup
  145. # endif
  146. # if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
  147. extern char *strndup (char const *__string, size_t __n);
  148. # endif
  149. #elif defined GNULIB_POSIXCHECK
  150. # undef strndup
  151. # define strndup(a,n) \
  152. (GL_LINK_WARNING ("strndup is unportable - " \
  153. "use gnulib module strndup for portability"), \
  154. strndup (a, n))
  155. #endif
  156. /* Find the length (number of bytes) of STRING, but scan at most
  157. MAXLEN bytes. If no '\0' terminator is found in that many bytes,
  158. return MAXLEN. */
  159. #if @GNULIB_STRNLEN@
  160. # if ! @HAVE_DECL_STRNLEN@
  161. extern size_t strnlen (char const *__string, size_t __maxlen)
  162. __attribute__ ((__pure__));
  163. # endif
  164. #elif defined GNULIB_POSIXCHECK
  165. # undef strnlen
  166. # define strnlen(a,n) \
  167. (GL_LINK_WARNING ("strnlen is unportable - " \
  168. "use gnulib module strnlen for portability"), \
  169. strnlen (a, n))
  170. #endif
  171. #if defined GNULIB_POSIXCHECK
  172. /* strcspn() assumes the second argument is a list of single-byte characters.
  173. Even in this simple case, it does not work with multibyte strings if the
  174. locale encoding is GB18030 and one of the characters to be searched is a
  175. digit. */
  176. # undef strcspn
  177. # define strcspn(s,a) \
  178. (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
  179. "in multibyte locales - " \
  180. "use mbscspn if you care about internationalization"), \
  181. strcspn (s, a))
  182. #endif
  183. /* Find the first occurrence in S of any character in ACCEPT. */
  184. #if @GNULIB_STRPBRK@
  185. # if ! @HAVE_STRPBRK@
  186. extern char *strpbrk (char const *__s, char const *__accept)
  187. __attribute__ ((__pure__));
  188. # endif
  189. # if defined GNULIB_POSIXCHECK
  190. /* strpbrk() assumes the second argument is a list of single-byte characters.
  191. Even in this simple case, it does not work with multibyte strings if the
  192. locale encoding is GB18030 and one of the characters to be searched is a
  193. digit. */
  194. # undef strpbrk
  195. # define strpbrk(s,a) \
  196. (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
  197. "in multibyte locales - " \
  198. "use mbspbrk if you care about internationalization"), \
  199. strpbrk (s, a))
  200. # endif
  201. #elif defined GNULIB_POSIXCHECK
  202. # undef strpbrk
  203. # define strpbrk(s,a) \
  204. (GL_LINK_WARNING ("strpbrk is unportable - " \
  205. "use gnulib module strpbrk for portability"), \
  206. strpbrk (s, a))
  207. #endif
  208. #if defined GNULIB_POSIXCHECK
  209. /* strspn() assumes the second argument is a list of single-byte characters.
  210. Even in this simple case, it cannot work with multibyte strings. */
  211. # undef strspn
  212. # define strspn(s,a) \
  213. (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
  214. "in multibyte locales - " \
  215. "use mbsspn if you care about internationalization"), \
  216. strspn (s, a))
  217. #endif
  218. #if defined GNULIB_POSIXCHECK
  219. /* strrchr() does not work with multibyte strings if the locale encoding is
  220. GB18030 and the character to be searched is a digit. */
  221. # undef strrchr
  222. # define strrchr(s,c) \
  223. (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
  224. "in some multibyte locales - " \
  225. "use mbsrchr if you care about internationalization"), \
  226. strrchr (s, c))
  227. #endif
  228. /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
  229. If one is found, overwrite it with a NUL, and advance *STRINGP
  230. to point to the next char after it. Otherwise, set *STRINGP to NULL.
  231. If *STRINGP was already NULL, nothing happens.
  232. Return the old value of *STRINGP.
  233. This is a variant of strtok() that is multithread-safe and supports
  234. empty fields.
  235. Caveat: It modifies the original string.
  236. Caveat: These functions cannot be used on constant strings.
  237. Caveat: The identity of the delimiting character is lost.
  238. Caveat: It doesn't work with multibyte strings unless all of the delimiter
  239. characters are ASCII characters < 0x30.
  240. See also strtok_r(). */
  241. #if @GNULIB_STRSEP@
  242. # if ! @HAVE_STRSEP@
  243. extern char *strsep (char **restrict __stringp, char const *restrict __delim);
  244. # endif
  245. # if defined GNULIB_POSIXCHECK
  246. # undef strsep
  247. # define strsep(s,d) \
  248. (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
  249. "in multibyte locales - " \
  250. "use mbssep if you care about internationalization"), \
  251. strsep (s, d))
  252. # endif
  253. #elif defined GNULIB_POSIXCHECK
  254. # undef strsep
  255. # define strsep(s,d) \
  256. (GL_LINK_WARNING ("strsep is unportable - " \
  257. "use gnulib module strsep for portability"), \
  258. strsep (s, d))
  259. #endif
  260. #if @GNULIB_STRSTR@
  261. # if @REPLACE_STRSTR@
  262. # define strstr rpl_strstr
  263. char *strstr (const char *haystack, const char *needle)
  264. __attribute__ ((__pure__));
  265. # endif
  266. #elif defined GNULIB_POSIXCHECK
  267. /* strstr() does not work with multibyte strings if the locale encoding is
  268. different from UTF-8:
  269. POSIX says that it operates on "strings", and "string" in POSIX is defined
  270. as a sequence of bytes, not of characters. */
  271. # undef strstr
  272. # define strstr(a,b) \
  273. (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
  274. "work correctly on character strings in most " \
  275. "multibyte locales - " \
  276. "use mbsstr if you care about internationalization, " \
  277. "or use strstr if you care about speed"), \
  278. strstr (a, b))
  279. #endif
  280. /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
  281. comparison. */
  282. #if @GNULIB_STRCASESTR@
  283. # if @REPLACE_STRCASESTR@
  284. # define strcasestr rpl_strcasestr
  285. # endif
  286. # if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
  287. extern char *strcasestr (const char *haystack, const char *needle)
  288. __attribute__ ((__pure__));
  289. # endif
  290. #elif defined GNULIB_POSIXCHECK
  291. /* strcasestr() does not work with multibyte strings:
  292. It is a glibc extension, and glibc implements it only for unibyte
  293. locales. */
  294. # undef strcasestr
  295. # define strcasestr(a,b) \
  296. (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
  297. "in multibyte locales - " \
  298. "use mbscasestr if you care about " \
  299. "internationalization, or use c-strcasestr if you want " \
  300. "a locale independent function"), \
  301. strcasestr (a, b))
  302. #endif
  303. /* Parse S into tokens separated by characters in DELIM.
  304. If S is NULL, the saved pointer in SAVE_PTR is used as
  305. the next starting point. For example:
  306. char s[] = "-abc-=-def";
  307. char *sp;
  308. x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
  309. x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
  310. x = strtok_r(NULL, "=", &sp); // x = NULL
  311. // s = "abc\0-def\0"
  312. This is a variant of strtok() that is multithread-safe.
  313. For the POSIX documentation for this function, see:
  314. http://www.opengroup.org/susv3xsh/strtok.html
  315. Caveat: It modifies the original string.
  316. Caveat: These functions cannot be used on constant strings.
  317. Caveat: The identity of the delimiting character is lost.
  318. Caveat: It doesn't work with multibyte strings unless all of the delimiter
  319. characters are ASCII characters < 0x30.
  320. See also strsep(). */
  321. #if @GNULIB_STRTOK_R@
  322. # if ! @HAVE_DECL_STRTOK_R@
  323. extern char *strtok_r (char *restrict s, char const *restrict delim,
  324. char **restrict save_ptr);
  325. # endif
  326. # if defined GNULIB_POSIXCHECK
  327. # undef strtok_r
  328. # define strtok_r(s,d,p) \
  329. (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
  330. "in multibyte locales - " \
  331. "use mbstok_r if you care about internationalization"), \
  332. strtok_r (s, d, p))
  333. # endif
  334. #elif defined GNULIB_POSIXCHECK
  335. # undef strtok_r
  336. # define strtok_r(s,d,p) \
  337. (GL_LINK_WARNING ("strtok_r is unportable - " \
  338. "use gnulib module strtok_r for portability"), \
  339. strtok_r (s, d, p))
  340. #endif
  341. /* The following functions are not specified by POSIX. They are gnulib
  342. extensions. */
  343. #if @GNULIB_MBSLEN@
  344. /* Return the number of multibyte characters in the character string STRING.
  345. This considers multibyte characters, unlike strlen, which counts bytes. */
  346. extern size_t mbslen (const char *string);
  347. #endif
  348. #if @GNULIB_MBSNLEN@
  349. /* Return the number of multibyte characters in the character string starting
  350. at STRING and ending at STRING + LEN. */
  351. extern size_t mbsnlen (const char *string, size_t len);
  352. #endif
  353. #if @GNULIB_MBSCHR@
  354. /* Locate the first single-byte character C in the character string STRING,
  355. and return a pointer to it. Return NULL if C is not found in STRING.
  356. Unlike strchr(), this function works correctly in multibyte locales with
  357. encodings such as GB18030. */
  358. # define mbschr rpl_mbschr /* avoid collision with HP-UX function */
  359. extern char * mbschr (const char *string, int c);
  360. #endif
  361. #if @GNULIB_MBSRCHR@
  362. /* Locate the last single-byte character C in the character string STRING,
  363. and return a pointer to it. Return NULL if C is not found in STRING.
  364. Unlike strrchr(), this function works correctly in multibyte locales with
  365. encodings such as GB18030. */
  366. # define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
  367. extern char * mbsrchr (const char *string, int c);
  368. #endif
  369. #if @GNULIB_MBSSTR@
  370. /* Find the first occurrence of the character string NEEDLE in the character
  371. string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
  372. Unlike strstr(), this function works correctly in multibyte locales with
  373. encodings different from UTF-8. */
  374. extern char * mbsstr (const char *haystack, const char *needle);
  375. #endif
  376. #if @GNULIB_MBSCASECMP@
  377. /* Compare the character strings S1 and S2, ignoring case, returning less than,
  378. equal to or greater than zero if S1 is lexicographically less than, equal to
  379. or greater than S2.
  380. Note: This function may, in multibyte locales, return 0 for strings of
  381. different lengths!
  382. Unlike strcasecmp(), this function works correctly in multibyte locales. */
  383. extern int mbscasecmp (const char *s1, const char *s2);
  384. #endif
  385. #if @GNULIB_MBSNCASECMP@
  386. /* Compare the initial segment of the character string S1 consisting of at most
  387. N characters with the initial segment of the character string S2 consisting
  388. of at most N characters, ignoring case, returning less than, equal to or
  389. greater than zero if the initial segment of S1 is lexicographically less
  390. than, equal to or greater than the initial segment of S2.
  391. Note: This function may, in multibyte locales, return 0 for initial segments
  392. of different lengths!
  393. Unlike strncasecmp(), this function works correctly in multibyte locales.
  394. But beware that N is not a byte count but a character count! */
  395. extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
  396. #endif
  397. #if @GNULIB_MBSPCASECMP@
  398. /* Compare the initial segment of the character string STRING consisting of
  399. at most mbslen (PREFIX) characters with the character string PREFIX,
  400. ignoring case, returning less than, equal to or greater than zero if this
  401. initial segment is lexicographically less than, equal to or greater than
  402. PREFIX.
  403. Note: This function may, in multibyte locales, return 0 if STRING is of
  404. smaller length than PREFIX!
  405. Unlike strncasecmp(), this function works correctly in multibyte
  406. locales. */
  407. extern char * mbspcasecmp (const char *string, const char *prefix);
  408. #endif
  409. #if @GNULIB_MBSCASESTR@
  410. /* Find the first occurrence of the character string NEEDLE in the character
  411. string HAYSTACK, using case-insensitive comparison.
  412. Note: This function may, in multibyte locales, return success even if
  413. strlen (haystack) < strlen (needle) !
  414. Unlike strcasestr(), this function works correctly in multibyte locales. */
  415. extern char * mbscasestr (const char *haystack, const char *needle);
  416. #endif
  417. #if @GNULIB_MBSCSPN@
  418. /* Find the first occurrence in the character string STRING of any character
  419. in the character string ACCEPT. Return the number of bytes from the
  420. beginning of the string to this occurrence, or to the end of the string
  421. if none exists.
  422. Unlike strcspn(), this function works correctly in multibyte locales. */
  423. extern size_t mbscspn (const char *string, const char *accept);
  424. #endif
  425. #if @GNULIB_MBSPBRK@
  426. /* Find the first occurrence in the character string STRING of any character
  427. in the character string ACCEPT. Return the pointer to it, or NULL if none
  428. exists.
  429. Unlike strpbrk(), this function works correctly in multibyte locales. */
  430. # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
  431. extern char * mbspbrk (const char *string, const char *accept);
  432. #endif
  433. #if @GNULIB_MBSSPN@
  434. /* Find the first occurrence in the character string STRING of any character
  435. not in the character string REJECT. Return the number of bytes from the
  436. beginning of the string to this occurrence, or to the end of the string
  437. if none exists.
  438. Unlike strspn(), this function works correctly in multibyte locales. */
  439. extern size_t mbsspn (const char *string, const char *reject);
  440. #endif
  441. #if @GNULIB_MBSSEP@
  442. /* Search the next delimiter (multibyte character listed in the character
  443. string DELIM) starting at the character string *STRINGP.
  444. If one is found, overwrite it with a NUL, and advance *STRINGP to point
  445. to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
  446. If *STRINGP was already NULL, nothing happens.
  447. Return the old value of *STRINGP.
  448. This is a variant of mbstok_r() that supports empty fields.
  449. Caveat: It modifies the original string.
  450. Caveat: These functions cannot be used on constant strings.
  451. Caveat: The identity of the delimiting character is lost.
  452. See also mbstok_r(). */
  453. extern char * mbssep (char **stringp, const char *delim);
  454. #endif
  455. #if @GNULIB_MBSTOK_R@
  456. /* Parse the character string STRING into tokens separated by characters in
  457. the character string DELIM.
  458. If STRING is NULL, the saved pointer in SAVE_PTR is used as
  459. the next starting point. For example:
  460. char s[] = "-abc-=-def";
  461. char *sp;
  462. x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
  463. x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
  464. x = mbstok_r(NULL, "=", &sp); // x = NULL
  465. // s = "abc\0-def\0"
  466. Caveat: It modifies the original string.
  467. Caveat: These functions cannot be used on constant strings.
  468. Caveat: The identity of the delimiting character is lost.
  469. See also mbssep(). */
  470. extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
  471. #endif
  472. /* Map any int, typically from errno, into an error message. */
  473. #if @GNULIB_STRERROR@
  474. # if @REPLACE_STRERROR@
  475. # undef strerror
  476. # define strerror rpl_strerror
  477. extern char *strerror (int);
  478. # endif
  479. #elif defined GNULIB_POSIXCHECK
  480. # undef strerror
  481. # define strerror(e) \
  482. (GL_LINK_WARNING ("strerror is unportable - " \
  483. "use gnulib module strerror to guarantee non-NULL result"), \
  484. strerror (e))
  485. #endif
  486. #if @GNULIB_STRSIGNAL@
  487. # if @REPLACE_STRSIGNAL@
  488. # define strsignal rpl_strsignal
  489. # endif
  490. # if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@
  491. extern char *strsignal (int __sig);
  492. # endif
  493. #elif defined GNULIB_POSIXCHECK
  494. # undef strsignal
  495. # define strsignal(a) \
  496. (GL_LINK_WARNING ("strsignal is unportable - " \
  497. "use gnulib module strsignal for portability"), \
  498. strsignal (a))
  499. #endif
  500. #ifdef __cplusplus
  501. }
  502. #endif
  503. #endif /* _GL_STRING_H */
  504. #endif /* _GL_STRING_H */