1 /*
2  * test-strlcpy.c - strlcpy() replacement test
3  */
4 
5 /***********************************************************************
6  *  Copyright © 2006 Rémi Denis-Courmont.                              *
7  *  This program is free software; you can redistribute and/or modify  *
8  *  it under the terms of the GNU General Public License as published  *
9  *  by the Free Software Foundation; version 2 of the license, or (at  *
10  *  your option) any later version.                                    *
11  *                                                                     *
12  *  This program is distributed in the hope that it will be useful,    *
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               *
15  *  See the GNU General Public License for more details.               *
16  *                                                                     *
17  *  You should have received a copy of the GNU General Public License  *
18  *  along with this program; if not, you can get it from:              *
19  *  http://www.gnu.org/copyleft/gpl.html                               *
20  ***********************************************************************/
21 
22 #ifdef HAVE_CONFIG_H
23 # include <config.h>
24 #endif
25 
26 #include <string.h>
27 
main(void)28 int main (void)
29 {
30 	char buf[6];
31 
32 	return (
33 	    (strlcpy (NULL, "1234", 0) != 4)
34 	 || (strlcpy (buf, "1234", 0) != 4)
35 	 || (strlcpy (buf, "1234", 1) != 4)
36 	 || strcmp (buf, "")
37 	 || (strlcpy (buf, "1234", 4) != 4)
38 	 || strcmp (buf, "123")
39 	 || (strlcpy (buf, "1234", 5) != 4)
40 	 || strcmp (buf, "1234")
41 	 || (strlcpy (buf, "1234", 6) != 4)
42 	 || strcmp (buf, "1234"));
43 }
44