serval-dna/strlcpy.h
Andrew Bettison 1efe6686fc Use config.h instead of -DHAVE_FOO=1
swiftc(1) requires every -D option to be prefixed with -Xcc, which
is not easy to achieve using autoconf.

Now instead of setting configuration macros like HAVE_LSEEK64 on the
command line using -D, they are defined in config.h, which is generated
by ./configure, ignored by Git, and included by all headers and source
files that use any configuration macro.

The dependency on Makefile has been replaced with a dependency on
Makefile.in and config.h, which helps avoid some redundant full
recompiles after running ./configure, because the configure script
does not overwrit config.h if its content does not change.
2016-10-19 16:27:20 +10:30

39 lines
1.2 KiB
C

/*
Copyright (C) 2012,2015 Serval Project Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __STRLCPY_H__
#define __STRLCPY_H__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
// Do not use strlcpy() in Serval DNA source code, use strncpy_nul() or
// buf_strncpy_nul() from "str.h" instead. This strlcpy() is provided only
// because it is needed by sqlite3.c.
#ifdef HAVE_STRLCPY
# include <string.h>
#else
# include <stdlib.h> // for size_t
size_t strlcpy(char *dst, const char *src, size_t sz);
#endif
#endif