summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-12 13:45:56 +0000
committerbors <bors@rust-lang.org>2023-03-12 13:45:56 +0000
commitd30ac466e4ae42dc2b9dbe2b07081f7f39acf7d7 (patch)
treed1d34300fc0fd7699c1e80b461b712daac3be8b9
parent71ec1cfb837923569c99e64f7a94c2d37fdc02e5 (diff)
parentcb25d0923d8c2516a61840a0c9b72a3bb339c94c (diff)
downloadrust-libc-d30ac466e4ae42dc2b9dbe2b07081f7f39acf7d7.tar.gz
Auto merge of #3147 - devnexen:haiku_stringlist, r=JohnTitor
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! {