diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:20:54 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:20:54 +0000 |
commit | 7c720bec5600a9e607c875c670ca30ed351fa4ba (patch) | |
tree | c38c9bedf07616180feee6b91a1dbea038500b54 /include/snprintf.h | |
parent | Initial commit. (diff) | |
download | iperf-7c720bec5600a9e607c875c670ca30ed351fa4ba.tar.xz iperf-7c720bec5600a9e607c875c670ca30ed351fa4ba.zip |
Adding upstream version 2.1.9+dfsg.upstream/2.1.9+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/snprintf.h')
-rw-r--r-- | include/snprintf.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/snprintf.h b/include/snprintf.h new file mode 100644 index 0000000..26e870f --- /dev/null +++ b/include/snprintf.h @@ -0,0 +1,40 @@ +#ifndef SNPRINTF_H +#define SNPRINTF_H + +/* =================================================================== + * snprintf.h + * + * This is from + * W. Richard Stevens, 'UNIX Network Programming', Vol 1, 2nd Edition, + * Prentice Hall, 1998. + * + * Mark Gates <mgates@nlanr.net> + * July 1998 + * + * to use this prototype, make sure HAVE_SNPRINTF is not defined + * + * =================================================================== */ + +/* + * Throughout the book I use snprintf() because it's safer than sprintf(). + * But as of the time of this writing, not all systems provide this + * function. The function below should only be built on those systems + * that do not provide a real snprintf(). + * The function below just acts like sprintf(); it is not safe, but it + * tries to detect overflow. + */ + +#ifndef HAVE_SNPRINTF + + #ifdef __cplusplus +extern "C" { +#endif + +int snprintf(char *buf, size_t size, const char *fmt, ...); + +#ifdef __cplusplus +} /* end extern "C" */ + #endif + +#endif /* HAVE_SNPRINTF */ +#endif /* SNPRINTF_H */ |