1// The -*- C++ -*- null-terminated string header.
2// This file is part of the GNU ANSI C++ Library.
3
4#ifndef __CSTRING__
5#define __CSTRING__
6
7#include <string.h>
8
9#if 0 // Let's not bother with this just yet.
10#include <cstddef>
11
12#ifdef __GNUG__
13#pragma interface "cstring"
14#endif
15
16// The ANSI C prototypes for these functions have a const argument type and
17// non-const return type, so we can't use them.
18
19extern "C++" {
20extern inline const char *
21_G_strchr (const char *s, int c)
22{
23  return strchr (s, c);
24}
25
26extern inline char *
27_G_strchr (char *s, int c)
28{
29  return const_cast<char *> (strchr (s, c));
30}
31
32extern inline const char *
33_G_strpbrk (const char *s1, const char *s2)
34{
35  return strpbrk (s1, s2);
36}
37
38extern inline char *
39_G_strpbrk (char *s1, const char *s2)
40{
41  return const_cast<char *> (strpbrk (s1, s2));
42}
43
44extern inline const char *
45_G_strrchr (const char *s, int c)
46{
47  return strrchr (s, c);
48}
49
50extern inline char *
51_G_strrchr (char *s, int c)
52{
53  return const_cast<char *> (strrchr (s, c));
54}
55
56extern inline const char *
57_G_strstr (const char *s1, const char *s2)
58{
59  return strstr (s1, s2);
60}
61
62extern inline char *
63_G_strstr (char *s1, const char *s2)
64{
65  return const_cast<char *> (strstr (s1, s2));
66}
67
68extern inline const void *
69_G_memchr (const void *s, int c, size_t n)
70{
71  return memchr (s, c, n);
72}
73
74extern inline void *
75_G_memchr (void *s, int c, size_t n)
76{
77  return const_cast<void *> (memchr (s, c, n));
78}
79} // extern "C++"
80
81// Lose any vendor macros for these functions.
82#undef strchr
83#undef strpbrk
84#undef strrchr
85#undef strstr
86#undef memchr
87
88// Ewww, namespace pollution.  Anyone have a better idea?
89#define strchr  _G_strchr
90#define strpbrk _G_strpbrk
91#define strrchr _G_strrchr
92#define strstr  _G_strstr
93#define memchr  _G_memchr
94#endif // 0
95
96#endif // !defined (__CSTRING__)
97