1*9034ec65Schristos /*	$NetBSD: ntp_string.h,v 1.5 2020/05/25 20:47:20 christos Exp $	*/
2abb0f93cSkardel 
3abb0f93cSkardel /*
4abb0f93cSkardel  * Define string ops: strchr strrchr memcmp memmove memset
5abb0f93cSkardel  */
6abb0f93cSkardel 
72b3787f6Schristos #ifndef NTP_STRING_H
82b3787f6Schristos #define NTP_STRING_H
9abb0f93cSkardel 
10abb0f93cSkardel #ifdef HAVE_MEMORY_H
11abb0f93cSkardel # include <memory.h>
12abb0f93cSkardel #endif
13abb0f93cSkardel 
14abb0f93cSkardel #ifdef HAVE_STRING_H
15abb0f93cSkardel # include <string.h>
16abb0f93cSkardel #endif
17abb0f93cSkardel 
18abb0f93cSkardel #ifdef HAVE_BSTRING_H
19abb0f93cSkardel # include <bstring.h>
20abb0f93cSkardel #endif
21abb0f93cSkardel 
22abb0f93cSkardel #ifdef NTP_NEED_BOPS
23abb0f93cSkardel 
24abb0f93cSkardel #ifdef HAVE_STRINGS_H
25abb0f93cSkardel # include <strings.h>		/* bcmp, bcopy, bzero */
26abb0f93cSkardel #endif
27abb0f93cSkardel 
28abb0f93cSkardel void	ntp_memset	(char *, int, int);
29abb0f93cSkardel 
30abb0f93cSkardel #define memcmp(a, b, c)		bcmp(a, b, (int)(c))
31abb0f93cSkardel #define memmove(t, f, c)	bcopy(f, t, (int)(c))
32abb0f93cSkardel #define memcpy(t, f, c)		bcopy(f, t, (int)(c))
33abb0f93cSkardel #define memset(a, x, c)		if (0 == (x)) \
34abb0f93cSkardel 					bzero(a, (int)(c)); \
35abb0f93cSkardel 				else \
36abb0f93cSkardel 					ntp_memset((char *)(a), x, c)
37abb0f93cSkardel #endif /*  NTP_NEED_BOPS */
38abb0f93cSkardel 
392b3787f6Schristos #endif	/* NTP_STRING_H */
40