summaryrefslogtreecommitdiffstats
path: root/src/strscpy.h
diff options
context:
space:
mode:
authorlibuv upstream <libuv@googlegroups.com>2019-01-15 15:42:13 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-16 19:48:27 (GMT)
commit4fcb0d0213112bb2fdb04bb27e82543b93cfe41d (patch)
tree746a72d3795b562075d66fab8947dfd7527b6044 /src/strscpy.h
parentc8b67ea119c4000018238f6c3201a1364356d93a (diff)
downloadCMake-4fcb0d0213112bb2fdb04bb27e82543b93cfe41d.zip
CMake-4fcb0d0213112bb2fdb04bb27e82543b93cfe41d.tar.gz
CMake-4fcb0d0213112bb2fdb04bb27e82543b93cfe41d.tar.bz2
libuv 2019-01-15 (f84c5e69)
Code extracted from: https://github.com/libuv/libuv.git at commit f84c5e693b80cb0c62bcefba147e7a66e2b839c9 (v1.x).
Diffstat (limited to 'src/strscpy.h')
-rw-r--r--src/strscpy.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/strscpy.h b/src/strscpy.h
new file mode 100644
index 0000000..fbe0a39
--- /dev/null
+++ b/src/strscpy.h
@@ -0,0 +1,18 @@
+#ifndef UV_STRSCPY_H_
+#define UV_STRSCPY_H_
+
+/* Include uv.h for its definitions of size_t and ssize_t.
+ * size_t can be obtained directly from <stddef.h> but ssize_t requires
+ * some hoop jumping on Windows that I didn't want to duplicate here.
+ */
+#include "uv.h"
+
+/* Copies up to |n-1| bytes from |d| to |s| and always zero-terminates
+ * the result, except when |n==0|. Returns the number of bytes copied
+ * or UV_E2BIG if |d| is too small.
+ *
+ * See https://www.kernel.org/doc/htmldocs/kernel-api/API-strscpy.html
+ */
+ssize_t uv__strscpy(char* d, const char* s, size_t n);
+
+#endif /* UV_STRSCPY_H_ */