1 /*
2  * have_memmv - Determine if we have memmove()
3  *
4  * Copyright (C) 1999,2021  Landon Curt Noll
5  *
6  * Calc is open software; you can redistribute it and/or modify it under
7  * the terms of the version 2.1 of the GNU Lesser General Public License
8  * as published by the Free Software Foundation.
9  *
10  * Calc is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU Lesser General
13  * Public License for more details.
14  *
15  * A copy of version 2.1 of the GNU Lesser General Public License is
16  * distributed with calc under the filename COPYING-LGPL.  You should have
17  * received a copy with calc; if not, write to Free Software Foundation, Inc.
18  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  *
20  * Under source code control:	1997/04/16 02:02:34
21  * File existed as early as:	1997
22  *
23  * chongo <was here> /\oo/\	http://www.isthe.com/chongo/
24  * Share and enjoy!  :-)	http://www.isthe.com/chongo/tech/comp/calc/
25  */
26 
27 /*
28  * usage:
29  *	have_memmv
30  *
31  * Not all systems with memcpy() have memmove() functions, so this may not
32  * compile on your system.
33  *
34  * This prog outputs several defines:
35  *
36  *	HAVE_MEMMOVE
37  *		defined ==> use memmove()
38  *		undefined ==> use internal slow memmove() instead
39  */
40 
41 #include <stdio.h>
42 #include "have_string.h"
43 #ifdef HAVE_STRING_H
44 # include <string.h>
45 #endif
46 
47 
48 #include "banned.h"	/* include after system header <> includes */
49 
50 
51 #define MOVELEN 3
52 
53 char src[] = "chongo was here";
54 char dest[MOVELEN+1];
55 
56 int
main(void)57 main(void)
58 {
59 #if defined(HAVE_NO_MEMMOVE)
60 
61 	printf("#undef HAVE_MEMMOVE /* no */\n");
62 
63 #else /* HAVE_NO_MEMMOVE */
64 
65 	(void) memmove(dest, src, MOVELEN);
66 
67 	printf("#define HAVE_MEMMOVE /* yes */\n");
68 
69 #endif /* HAVE_NO_MEMMOVE */
70 
71 	/* exit(0); */
72 	return 0;
73 }
74