beta-0.89.2
[luatex.git] / source / texk / kpathsea / c-memstr.h
blobe8e107a6f9830348f693cc89b6ba3b1d49b6150e
1 /* c-memstr.h: memcpy, strchr, etc.
3 Copyright 1992-2013 Karl Berry and Olaf Weber.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this library; if not, see <http://www.gnu.org/licenses/>. */
18 #ifndef KPATHSEA_C_MEMSTR_H
19 #define KPATHSEA_C_MEMSTR_H
21 /* <X11/Xfuncs.h> tries to declare bcopy etc., which can only conflict. */
22 #define _XFUNCS_H_
24 #ifdef HAVE_STRING_H
25 #include <string.h>
26 #else
27 /* don't ever want both string.h and strings.h; fails on AIX. */
28 #ifdef HAVE_STRINGS_H
29 #include <strings.h>
30 #endif
31 #endif
33 /* An ANSI string.h and pre-ANSI memory.h might conflict. */
34 #if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
35 #include <memory.h>
36 #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
38 /* For ancient systems that lack the system V/ANSI version of the
39 string functions we express them in terms of the BSD versions. */
40 #if !defined(HAVE_STRCHR) && !defined(strchr)
41 #define strchr index
42 #endif
44 #if !defined(HAVE_STRRCHR) && !defined(strrchr)
45 #define strrchr rindex
46 #endif
48 #if !defined(HAVE_MEMCMP) && !defined(memcmp)
49 #define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
50 #endif
52 #if !defined(HAVE_MEMCPY) && !defined(memcpy)
53 #define memcpy(to, from, len) bcopy ((from), (to), (len))
54 #endif
56 #if !defined(HAVE_STRING_H)
57 extern char *strtok ();
58 #ifndef strstr
59 extern char *strstr ();
60 #endif
61 #endif
63 #endif /* not KPATHSEA_C_MEMSTR_H */