From cb25d0923d8c2516a61840a0c9b72a3bb339c94c Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 11 Mar 2023 20:33:39 +0000 Subject: Haiku StringList api addition --- libc-test/build.rs | 2 +- src/unix/haiku/mod.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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! { -- cgit v1.2.1