forked from github/server
strnzcpy - strncpy mit 0-terminierungsgarantie
This commit is contained in:
parent
4d7210014f
commit
0960a541ea
14
src/config.h
14
src/config.h
|
@ -23,9 +23,6 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**** ****
|
/**** ****
|
||||||
** Debugging Libraries **
|
** Debugging Libraries **
|
||||||
**** ****/
|
**** ****/
|
||||||
|
@ -71,6 +68,10 @@
|
||||||
** Architecture Dependent **
|
** Architecture Dependent **
|
||||||
**** ****/
|
**** ****/
|
||||||
|
|
||||||
|
#if _MSC_VER
|
||||||
|
# define STRNCPY_HAS_ZEROTERMINATION
|
||||||
|
#endif
|
||||||
|
|
||||||
/* für solaris: */
|
/* für solaris: */
|
||||||
#ifdef SOLARIS
|
#ifdef SOLARIS
|
||||||
# define _SYS_PROCSET_H
|
# define _SYS_PROCSET_H
|
||||||
|
@ -89,7 +90,7 @@
|
||||||
/* warning C4100: <name> : unreferenced formal parameter */
|
/* warning C4100: <name> : unreferenced formal parameter */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __GNUC__
|
||||||
# ifndef _BSD_SOURCE
|
# ifndef _BSD_SOURCE
|
||||||
# define _BSD_SOURCE
|
# define _BSD_SOURCE
|
||||||
# define __USE_BSD
|
# define __USE_BSD
|
||||||
|
@ -240,4 +241,9 @@ extern char * strdup(const char *s);
|
||||||
# define true ((boolean)!false)
|
# define true ((boolean)!false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef STRNCPY_HAS_ZEROTERMINATION
|
||||||
|
# define strnzcpy(dst, src, len) strncpy(dst, src, len)
|
||||||
|
#else
|
||||||
|
# define strnzcpy(dst, src, len) for(;;) { strncpy(dst, src, len); if (len) dst[len-1]=0; break; }
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue