Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haiku StringList api addition #3147

Merged
merged 1 commit into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -4228,6 +4227,7 @@ fn test_haiku(target: &str) {
"libutil.h",
"link.h",
"pty.h",
"stringlist.h",
}

// Native API
Expand Down
13 changes: 13 additions & 0 deletions src/unix/haiku/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -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! {
Expand Down Expand Up @@ -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! {
Expand Down