home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / kpathsea / c-memstr.h < prev    next >
C/C++ Source or Header  |  1993-12-18  |  2KB  |  77 lines

  1. /* c-memstr.h: memcpy, strchr, etc.
  2.  
  3. Copyright (C) 1992, 93 Free Software Foundation, Inc.
  4.  
  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 2, or (at your option)
  8. any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef KPATHSEA_C_MEMSTR_H
  20. #define KPATHSEA_C_MEMSTR_H
  21.  
  22. /* Just to be complete, we make both the system V/ANSI and the BSD
  23.    versions of the string functions available.  */
  24. #if defined (STDC_HEADERS) || defined (HAVE_STRING_H)
  25. #include <string.h>
  26.  
  27. /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
  28. #if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
  29. #include <memory.h>
  30. #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
  31.  
  32. /* Do not define these if we are not STDC_HEADERS, because in that
  33.    case X11/Xos.h defines `strchr' to be `index'. */
  34. #ifdef STDC_HEADERS
  35. /* Let's hope that if index/rindex are defined, they're defined to the
  36.    right thing.  */
  37. #ifndef index
  38. #define index strchr
  39. #endif
  40. #ifndef rindex
  41. #define rindex strrchr
  42. #endif
  43. #endif /* STDC_HEADERS */
  44.  
  45. #ifndef HAVE_BCOPY
  46. #ifndef bcmp
  47. #define bcmp(s1, s2, len) memcmp ((s1), (s2), (len))
  48. #endif
  49. #ifndef bcopy
  50. #define bcopy(from, to, len) memcpy ((to), (from), (len))
  51. #endif
  52. #ifndef bzero
  53. #define bzero(s, len) memset ((s), 0, (len))
  54. #endif
  55. #endif /* not HAVE_BCOPY */
  56.  
  57. #else /* not (STDC_HEADERS or HAVE_STRING_H) */
  58.  
  59. #include <strings.h>
  60.  
  61. #ifndef strchr
  62. #define strchr index
  63. #endif
  64. #ifndef strrchr
  65. #define strrchr rindex
  66. #endif
  67.  
  68. #define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
  69. #define memcpy(to, from, len) bcopy ((from), (to), (len))
  70.  
  71. extern char *strtok ();
  72. extern char *strstr ();
  73.  
  74. #endif /* not (STDC_HEADERS or HAVE_STRING_H) */
  75.  
  76. #endif /* not KPATHSEA_C_MEMSTR_H */
  77.