1bb183703505e5ce1636e22aad6ae61686392b5b
2 ** Copyright (C) 2010-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
4 ** This program is free software; you can redistribute it and/or modify
5 ** it under the terms of the GNU Lesser General Public License as published by
6 ** the Free Software Foundation; either version 2.1 of the License, or
7 ** (at your option) any later version.
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ** GNU Lesser General Public License for more details.
14 ** You should have received a copy of the GNU Lesser General Public License
15 ** along with this program; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "test_main.h"
29 test_psf_strlcpy_crlf (void)
30 { const char *src
= "a\nb\nc\n" ;
34 print_test_name ("Testing psf_strlcpy_crlf") ;
36 for (dest_len
= 3 ; dest_len
< 30 ; dest_len
++)
37 { dest
= calloc (1, dest_len
+ 1) ;
39 { printf ("\n\nLine %d: calloc failed!\n\n", __LINE__
) ;
43 dest
[dest_len
] = '\xea' ;
45 psf_strlcpy_crlf (dest
, src
, dest_len
, sizeof (src
)) ;
47 if (dest
[dest_len
] != '\xea')
48 { printf ("\n\nLine %d: buffer overrun for dest_len == %d\n\n", __LINE__
, dest_len
) ;
56 } /* test_psf_strlcpy_crlf */