1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
pub use self::os::{wordexp_t};
pub use self::os::{WRDE_APPEND};
pub use self::os::{WRDE_DOOFFS};
pub use self::os::{WRDE_NOCMD};
pub use self::os::{WRDE_REUSE};
pub use self::os::{WRDE_SHOWERR};
pub use self::os::{WRDE_UNDEF};
pub use self::os::{WRDE_BADCHAR};
pub use self::os::{WRDE_BADVAL};
pub use self::os::{WRDE_CMDSUB};
pub use self::os::{WRDE_NOSPACE};
pub use self::os::{WRDE_SYNTAX};

use {NTStr, int_t, char_t};

#[cfg(target_os = "linux")]
#[path = "linux/mod.rs"]
mod os;

pub fn wordexp<T: NTStr>(words: &T, pwordexp: &mut wordexp_t,
                           flags: int_t) -> int_t {
    extern { fn wordexp(words: *const char_t, pwordexp: *mut wordexp_t,
                        flags: int_t) -> int_t; }
    unsafe { wordexp(words.as_ptr(), pwordexp as *mut _, flags) }
}

pub fn wordfree(wordexp: &mut wordexp_t) {
    extern { fn wordfree(wordexp: *mut wordexp_t); }
    unsafe { wordfree(wordexp as *mut _); }
}