From 3913f5c4ec9af921d8b516be53b4b8fce52f9208 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer <mschiffer@universe-factory.net> Date: Sat, 11 Apr 2020 14:28:35 +0200 Subject: [PATCH] unix: add strndup() Add strndup(), as specified by POSIX.1-2008. --- src/unix/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 364ff559..1084d9aa 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -525,6 +525,7 @@ extern "C" { pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; pub fn strdup(cs: *const c_char) -> *mut c_char; + pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char; pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; -- GitLab