Added a lot of the string function wrappers.
This commit is contained in:
parent
eb9f0628ab
commit
1633174506
@ -1,3 +1,7 @@
|
|||||||
/// This defines the size_t type.
|
/// This defines the size_t type.
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub type size_t = usize;
|
pub type size_t = usize;
|
||||||
|
|
||||||
|
/// This defines the wchar_t type.
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
pub type wchar_t = i32;
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
use binding::{CChar, CInt};
|
||||||
|
|
||||||
|
use crate::stddef::{size_t, wchar_t};
|
||||||
|
|
||||||
|
|
||||||
#[cfg(not(feature="no_mem_manip"))]
|
#[cfg(not(feature="no_mem_manip"))]
|
||||||
#[link(name="c")]
|
#[link(name="c")]
|
||||||
extern
|
extern
|
||||||
@ -49,3 +54,36 @@ extern
|
|||||||
/// to the specified value c (interpreted as an unsigned char).
|
/// to the specified value c (interpreted as an unsigned char).
|
||||||
pub fn memset(s: *mut u8, c: i32, n: usize);
|
pub fn memset(s: *mut u8, c: i32, n: usize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[link(name="c")]
|
||||||
|
extern
|
||||||
|
{
|
||||||
|
pub fn strcpy(dst: *mut CChar, src: *const CChar) -> *mut CChar;
|
||||||
|
pub fn strncpy(dst: *mut CChar, src: *const CChar,
|
||||||
|
n: size_t) -> *mut CChar;
|
||||||
|
pub fn strcat(s: *mut CChar, ct: *const CChar) -> *mut CChar;
|
||||||
|
pub fn strncat(s: *mut CChar, ct: *const CChar,
|
||||||
|
n: size_t) -> *mut CChar;
|
||||||
|
pub fn strcmp(cs: *const CChar, ct: *const CChar) -> CInt;
|
||||||
|
pub fn strncmp(cs: *const CChar, ct: *const CChar, n: size_t) -> CInt;
|
||||||
|
pub fn strcoll(cs: *const CChar, ct: *const CChar) -> CInt;
|
||||||
|
pub fn strchr(cs: *const CChar, c: CInt) -> *mut CChar;
|
||||||
|
pub fn strrchr(cs: *const CChar, c: CInt) -> *mut CChar;
|
||||||
|
pub fn strspn(cs: *const CChar, ct: *const CChar) -> size_t;
|
||||||
|
pub fn strcspn(cs: *const CChar, ct: *const CChar) -> size_t;
|
||||||
|
pub fn strdup(cs: *const CChar) -> *mut CChar;
|
||||||
|
pub fn strpbrk(cs: *const CChar, ct: *const CChar) -> *mut CChar;
|
||||||
|
pub fn strstr(cs: *const CChar, ct: *const CChar) -> *mut CChar;
|
||||||
|
pub fn strcasecmp(s1: *const CChar, s2: *const CChar) -> CInt;
|
||||||
|
pub fn strncasecmp(s1: *const CChar, s2: *const CChar,
|
||||||
|
n: size_t) -> CInt;
|
||||||
|
pub fn strlen(cs: *const CChar) -> size_t;
|
||||||
|
pub fn strnlen(cs: *const CChar, maxlen: size_t) -> size_t;
|
||||||
|
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||||
|
link_name = "strerror$UNIX2003")]
|
||||||
|
pub fn strerror(n: CInt) -> *mut CChar;
|
||||||
|
pub fn strtok(s: *mut CChar, t: *const CChar) -> *mut CChar;
|
||||||
|
pub fn strxfrm(s: *mut CChar, ct: *const CChar, n: size_t) -> size_t;
|
||||||
|
pub fn wcslen(buf: *const wchar_t) -> size_t;
|
||||||
|
pub fn wcstombs(dest: *mut CChar, src: *const wchar_t, n: size_t) -> size_t;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user