1 /* $NetBSD: ntp_string.h,v 1.2 2014/12/19 20:43:14 christos 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_MEMORY_H 11 # include <memory.h> 12 #endif 13 14 #ifdef HAVE_STRING_H 15 # include <string.h> 16 #endif 17 18 #ifdef HAVE_BSTRING_H 19 # include <bstring.h> 20 #endif 21 22 #ifdef NTP_NEED_BOPS 23 24 #ifdef HAVE_STRINGS_H 25 # include <strings.h> /* bcmp, bcopy, bzero */ 26 #endif 27 28 void ntp_memset (char *, int, int); 29 30 #define memcmp(a, b, c) bcmp(a, b, (int)(c)) 31 #define memmove(t, f, c) bcopy(f, t, (int)(c)) 32 #define memcpy(t, f, c) bcopy(f, t, (int)(c)) 33 #define memset(a, x, c) if (0 == (x)) \ 34 bzero(a, (int)(c)); \ 35 else \ 36 ntp_memset((char *)(a), x, c) 37 #endif /* NTP_NEED_BOPS */ 38 39 #endif /* NTP_STRING_H */ 40