home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-src.tgz / tar.out / contrib / unixtex / kpathsea / c-memstr.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  2KB  |  81 lines

  1. /* c-memstr.h: memcpy, strchr, etc.
  2.  
  3. Copyright (C) 1992, 93, 94 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. /* <X11/Xfuncs.h> tries to declare bcopy etc., which can only conflict.  */
  23. #define _XFUNCS_H_
  24.  
  25. /* Just to be complete, we make both the system V/ANSI and the BSD
  26.    versions of the string functions available.  */
  27. #if defined (STDC_HEADERS) || defined (HAVE_STRING_H)
  28. #define SYSV /* so <X11/Xos.h> knows not to include <strings.h> */
  29. #include <string.h>
  30.  
  31. /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
  32. #if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
  33. #include <memory.h>
  34. #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
  35.  
  36. /* Do not define these if we are not STDC_HEADERS, because in that
  37.    case X11/Xos.h defines `strchr' to be `index'. */
  38. #ifdef STDC_HEADERS
  39. /* Let's hope that if index/rindex are defined, they're defined to the
  40.    right thing.  */
  41. #ifndef index
  42. #define index strchr
  43. #endif
  44. #ifndef rindex
  45. #define rindex strrchr
  46. #endif
  47. #endif /* STDC_HEADERS */
  48.  
  49. #ifndef HAVE_BCOPY
  50. #ifndef bcmp
  51. #define bcmp(s1, s2, len) memcmp ((s1), (s2), (len))
  52. #endif
  53. #ifndef bcopy
  54. #define bcopy(from, to, len) memcpy ((to), (from), (len))
  55. #endif
  56. #ifndef bzero
  57. #define bzero(s, len) memset ((s), 0, (len))
  58. #endif
  59. #endif /* not HAVE_BCOPY */
  60.  
  61. #else /* not (STDC_HEADERS or HAVE_STRING_H) */
  62.  
  63. #include <strings.h>
  64.  
  65. #ifndef strchr
  66. #define strchr index
  67. #endif
  68. #ifndef strrchr
  69. #define strrchr rindex
  70. #endif
  71.  
  72. #define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
  73. #define memcpy(to, from, len) bcopy ((from), (to), (len))
  74.  
  75. extern char *strtok ();
  76. extern char *strstr ();
  77.  
  78. #endif /* not (STDC_HEADERS or HAVE_STRING_H) */
  79.  
  80. #endif /* not KPATHSEA_C_MEMSTR_H */
  81.