dvitomp fix from Akira
[mplib] / src / texk / kpathsea / c-memstr.h
1 /* c-memstr.h: memcpy, strchr, etc.
2
3    Copyright 1992, 1993, 1994, 1995, 1997 1998, 1999, 2000, 2004, 2005,
4    2006, 2008 Karl Berry and Olaf Weber.
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public License
17    along with this library; if not, see <http://www.gnu.org/licenses/>.  */
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 #ifdef HAVE_STRING_H
26 #include <string.h>
27 #else
28 /* don't ever want both string.h and strings.h; fails on AIX.  */
29 #ifdef HAVE_STRINGS_H
30 #include <strings.h>
31 #endif
32 #endif
33
34 /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
35 #if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
36 #include <memory.h>
37 #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
38
39 /* Just to be complete, we make both the system V/ANSI and the BSD
40    versions of the string functions available.  */
41 #if !defined(HAVE_STRCHR) && !defined(strchr)
42 #define strchr index
43 #endif
44
45 #if !defined(HAVE_STRRCHR) && !defined(strrchr)
46 #define strrchr rindex
47 #endif
48
49 #if !defined(HAVE_MEMCMP) && !defined(memcmp)
50 #define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
51 #endif
52
53 #if !defined(HAVE_MEMCPY) && !defined(memcpy)
54 #define memcpy(to, from, len) bcopy ((from), (to), (len))
55 #endif
56
57 /* Note that these functions should not be used. */
58 #if !defined(HAVE_BCMP) && !defined(bcmp)
59 #define bcmp(s1, s2, len) memcmp ((s1), (s2), (len))
60 #endif
61
62 #if !defined(HAVE_BCOPY) && !defined(bcopy)
63 #define bcopy(from, to, len) memcpy ((to), (from), (len))
64 #endif
65
66 #if !defined(HAVE_BZERO) && !defined(bzero)
67 #define bzero(s, len) memset ((s), 0, (len))
68 #endif
69
70 #if !defined(HAVE_INDEX) && !defined(index)
71 #define index(s, c) strchr ((s), (c))
72 #endif
73
74 #if !defined(HAVE_RINDEX) && !defined(rindex)
75 #define rindex(s, c) strrchr ((s), (c))
76 #endif
77
78 #if !defined(HAVE_STRING_H)
79 extern char *strtok ();
80 #ifndef strstr
81 extern char *strstr ();
82 #endif
83 #endif
84
85 #endif /* not KPATHSEA_C_MEMSTR_H */