1 /*
2  *  RNtrack - FTN message tracker/router
3  *
4  *  string.hpp - String subroutines
5  *
6  *  Copyright (c) 2003-2005 Alex Soukhotine, 2:5030/1157
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  $Id: string.hpp 131 2011-03-20 16:48:35Z dukelsky $
14  */
15 
16 #ifndef _STRING_HPP_
17 #define _STRING_HPP_
18 
19 #include <string.h>
20 
21 /*
22 #if defined(__OpenBSD__)
23     # define my_strlcpy strlcpy
24     # define my_strlcat strlcat
25 #else
26 */
27 size_t my_strlcpy(char * dst, const char * src, size_t siz);
28 size_t my_strlcat(char * dst, const char * src, size_t siz);
29 // #endif
30 
31 
32 #define RSTRLCPY(d, s, l) \
33     if(my_strlcpy((d), (s), (l) + 1) > (l)) \
34         Log.Level(LOGD) << __FILE__ << " (line " << __LINE__ << \
35         "): strlcpy() error (src=\'" << (s) << "\' dest=\'" << (d) << \
36         "\' length=" << (l) << EOL
37 
38 #define RSTRLCAT(d, s, l) \
39     if(my_strlcat((d), (s), (l) + 1) > (l)) \
40         Log.Level(LOGD) << __FILE__ << " (line " << __LINE__ << \
41         "): strlcat() error (src=\'" << (s) << "\' dest=\'" << (d) << \
42         "\' length=" << (l) << EOL
43 
44 #endif
45