diff options
author | Tom Parker-Shemilt <palfrey@tevp.net> | 2018-11-21 23:55:23 +0000 |
---|---|---|
committer | Tom Parker-Shemilt <palfrey@tevp.net> | 2018-11-21 23:55:23 +0000 |
commit | 08eaa2c45e13a0f5324f086eed5c262642bf12bb (patch) | |
tree | d8199c4711001f4df8ca75ce2db2e94bb6eb2dd1 /src | |
parent | d931cd27eab1c5fc8d1075ae2009e1be343860d9 (diff) | |
download | rust-libc-08eaa2c45e13a0f5324f086eed5c262642bf12bb.tar.gz |
Split out strcase* into unix, MSVC and Windows-GNU
Diffstat (limited to 'src')
-rw-r--r-- | src/unix/mod.rs | 3 | ||||
-rw-r--r-- | src/windows.rs | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 7f7c19d289..cfbb1e7fa8 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -475,6 +475,9 @@ extern { pub fn strdup(cs: *const c_char) -> *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; + pub fn strncasecmp(s1: *const c_char, s2: *const c_char, + n: size_t) -> c_int; pub fn strlen(cs: *const c_char) -> size_t; pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; #[cfg_attr( diff --git a/src/windows.rs b/src/windows.rs index 4fc2c16a61..0f0dc6b0ba 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -379,6 +379,22 @@ extern { #[link_name = "_wsetlocale"] pub fn wsetlocale(category: ::c_int, locale: *const wchar_t) -> *mut wchar_t; + + cfg_if! { + if #[cfg(all(target_env = "gnu"))] { + pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; + pub fn strncasecmp(s1: *const c_char, s2: *const c_char, + n: size_t) -> c_int; + } else if #[cfg(all(target_env = "msvc"))] { + #[link_name = "_stricmp"] + pub fn stricmp(s1: *const c_char, s2: *const c_char) -> c_int; + #[link_name = "_strnicmp"] + pub fn strnicmp(s1: *const c_char, s2: *const c_char, + n: size_t) -> c_int; + } else { + // Unknown target_env + } + } } cfg_if! { |