Back to index

tetex-bin  3.0
c-memstr.h
Go to the documentation of this file.
00001 /* c-memstr.h: memcpy, strchr, etc.
00002 
00003 Copyright (C) 1992, 93, 94, 95, 97, 2000 Free Software Foundation, Inc.
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Library General Public
00007 License as published by the Free Software Foundation; either
00008 version 2 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Library General Public License for more details.
00014 
00015 You should have received a copy of the GNU Library General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00018 
00019 #ifndef KPATHSEA_C_MEMSTR_H
00020 #define KPATHSEA_C_MEMSTR_H
00021 
00022 /* <X11/Xfuncs.h> tries to declare bcopy etc., which can only conflict.  */
00023 #define _XFUNCS_H_
00024 
00025 #ifdef HAVE_STRING_H
00026 #include <string.h>
00027 #endif
00028 #ifdef HAVE_STRINGS_H
00029 #include <strings.h>
00030 #endif
00031 
00032 /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
00033 #if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
00034 #include <memory.h>
00035 #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
00036 
00037 /* Just to be complete, we make both the system V/ANSI and the BSD
00038    versions of the string functions available.  */
00039 #if !defined(HAVE_STRCHR) && !defined(strchr)
00040 #define strchr index
00041 #endif
00042 
00043 #if !defined(HAVE_STRRCHR) && !defined(strrchr)
00044 #define strrchr rindex
00045 #endif
00046 
00047 #if !defined(HAVE_MEMCMP) && !defined(memcmp)
00048 #define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
00049 #endif
00050 
00051 #if !defined(HAVE_MEMCPY) && !defined(memcpy)
00052 #define memcpy(to, from, len) bcopy ((from), (to), (len))
00053 #endif
00054 
00055 /* Note that these functions should not be used. */
00056 #if !defined(HAVE_BCMP) && !defined(bcmp)
00057 #define bcmp(s1, s2, len) memcmp ((s1), (s2), (len))
00058 #endif
00059 
00060 #if !defined(HAVE_BCOPY) && !defined(bcopy)
00061 #define bcopy(from, to, len) memcpy ((to), (from), (len))
00062 #endif
00063 
00064 #if !defined(HAVE_BZERO) && !defined(bzero)
00065 #define bzero(s, len) memset ((s), 0, (len))
00066 #endif
00067 
00068 #if !defined(HAVE_INDEX) && !defined(index)
00069 #define index(s, c) strchr ((s), (c))
00070 #endif
00071 
00072 #if !defined(HAVE_RINDEX) && !defined(rindex)
00073 #define rindex(s, c) strrchr ((s), (c))
00074 #endif
00075 
00076 #if !defined(HAVE_STRING_H)
00077 extern char *strtok ();
00078 #ifndef strstr
00079 extern char *strstr ();
00080 #endif
00081 #endif
00082 
00083 #endif /* not KPATHSEA_C_MEMSTR_H */