home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / libg++-2.7.1-bin.lha / lib / g++-include / std / cstring.h < prev    next >
C/C++ Source or Header  |  1996-10-12  |  2KB  |  72 lines

  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. #if 0 // Let's not bother with this just yet.
  8. // The ANSI C prototypes for these functions have a const argument type and
  9. // non-const return type, so we can't use them.
  10.  
  11. #define strchr  __hide_strchr
  12. #define strpbrk __hide_strpbrk
  13. #define strrchr __hide_strrchr
  14. #define strstr  __hide_strstr
  15. #define memchr  __hide_memchr
  16. #endif // 0
  17.  
  18. #include_next <string.h>
  19.  
  20. #if 0 // Let's not bother with this just yet.
  21. #undef strchr
  22. #undef strpbrk
  23. #undef strrchr
  24. #undef strstr
  25. #undef memchr
  26.  
  27. #include <std/cstddef.h>
  28.  
  29. #ifdef __GNUG__
  30. #pragma interface "std/cstring.h"
  31. #endif
  32.  
  33. extern "C++" {
  34. extern "C" const char *strchr (const char *, int);
  35. inline char *
  36. strchr (char *s, int c)
  37. {
  38.   return const_cast<char *> (strchr (static_cast<const char *> (s), c));
  39. }
  40.  
  41. extern "C" const char *strpbrk (const char *, const char *);
  42. inline char *
  43. strpbrk (char *s1, const char *s2)
  44. {
  45.   return const_cast<char *> (strpbrk (static_cast<const char *> (s1), s2));
  46. }
  47.  
  48. extern "C" const char *strrchr (const char *, int);
  49. inline char *
  50. strrchr (char *s, int c)
  51. {
  52.   return const_cast<char *> (strrchr (static_cast<const char *> (s), c));
  53. }
  54.  
  55. extern "C" const char *strstr (const char *, const char *);
  56. inline char *
  57. strstr (char *s1, const char *s2)
  58. {
  59.   return const_cast<char *> (strstr (static_cast<const char *> (s1), s2));
  60. }
  61.  
  62. extern "C" const void *memchr (const void *, int, size_t);
  63. inline void *
  64. memchr (void *s, int c, size_t n)
  65. {
  66.   return const_cast<void *> (memchr (static_cast<const void *> (s), c, n));
  67. }
  68. } // extern "C++"
  69.  
  70. #endif // 0
  71. #endif // !defined (__CSTRING__)
  72.