summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2023-03-11 20:33:39 +0000
committerDavid Carlier <devnexen@gmail.com>2023-03-12 09:00:22 +0000
commitcb25d0923d8c2516a61840a0c9b72a3bb339c94c (patch)
treec047491a41f47a1dc5d03c7ad271f6cd588d16af
parentad7bbf4b5d4f61d2b05b6dad1bd5880e40fc22f7 (diff)
downloadrust-libc-cb25d0923d8c2516a61840a0c9b72a3bb339c94c.tar.gz
Haiku StringList api addition
-rw-r--r--libc-test/build.rs2
-rw-r--r--src/unix/haiku/mod.rs13
2 files changed, 14 insertions, 1 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 80b73e911b..33558a9345 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -4123,7 +4123,6 @@ fn test_haiku(target: &str) {
"arpa/nameser.h",
"arpa/nameser_compat.h",
"assert.h",
- "bsd_mem.h",
"complex.h",
"ctype.h",
"dirent.h",
@@ -4228,6 +4227,7 @@ fn test_haiku(target: &str) {
"libutil.h",
"link.h",
"pty.h",
+ "stringlist.h",
}
// Native API
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index 1c40c51e66..89f8806eb4 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -55,6 +55,8 @@ pub type ACTION = ::c_int;
pub type posix_spawnattr_t = *mut ::c_void;
pub type posix_spawn_file_actions_t = *mut ::c_void;
+pub type StringList = _stringlist;
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
@@ -437,6 +439,12 @@ s! {
pub flag: *mut ::c_int,
pub val: ::c_int,
}
+
+ pub struct _stringlist {
+ pub sl_str: *mut *mut ::c_char,
+ pub sl_max: ::size_t,
+ pub sl_cur: ::size_t,
+ }
}
s_no_extra_traits! {
@@ -2017,6 +2025,11 @@ extern "C" {
pub fn strsep(string: *mut *mut ::c_char, delimiters: *const ::c_char) -> *mut ::c_char;
pub fn explicit_bzero(buf: *mut ::c_void, len: ::size_t);
pub fn login_tty(_fd: ::c_int) -> ::c_int;
+
+ pub fn sl_init() -> *mut StringList;
+ pub fn sl_add(sl: *mut StringList, n: *mut ::c_char) -> ::c_int;
+ pub fn sl_free(sl: *mut StringList, i: ::c_int);
+ pub fn sl_find(sl: *mut StringList, n: *mut ::c_char) -> *mut ::c_char;
}
cfg_if! {