1/*	$NetBSD: ntp_string.h,v 1.1.1.1 2009/12/13 16:54:53 kardel Exp $	*/
2
3/*
4 * Define string ops: strchr strrchr memcmp memmove memset
5 */
6
7#ifndef  _ntp_string_h
8#define  _ntp_string_h
9
10#ifdef HAVE_CONFIG_H
11#include <config.h>
12#endif
13
14#ifdef HAVE_MEMORY_H
15# include <memory.h>
16#endif
17
18#ifdef HAVE_STRING_H
19# include <string.h>
20#endif
21
22#ifdef HAVE_BSTRING_H
23# include <bstring.h>
24#endif
25
26#ifndef STDC_HEADERS
27# ifndef HAVE_STRCHR
28#  include <strings.h>
29#  define strchr index
30#  define strrchr rindex
31# endif
32# ifndef __GNUC__
33char *strchr(), *strrchr();
34# endif
35# ifndef HAVE_MEMCPY
36#  define NTP_NEED_BOPS
37# endif
38#endif /* STDC_HEADERS */
39
40#ifdef NTP_NEED_BOPS
41
42#ifdef HAVE_STRINGS_H
43# include <strings.h>		/* bcmp, bcopy, bzero */
44#endif
45
46void	ntp_memset	(char *, int, int);
47
48#define memcmp(a, b, c)		bcmp(a, b, (int)(c))
49#define memmove(t, f, c)	bcopy(f, t, (int)(c))
50#define memcpy(t, f, c)		bcopy(f, t, (int)(c))
51#define memset(a, x, c)		if (0 == (x)) \
52					bzero(a, (int)(c)); \
53				else \
54					ntp_memset((char *)(a), x, c)
55#endif /*  NTP_NEED_BOPS */
56
57#endif /* _ntp_string_h */
58