c-scape 0.22.3

A libc bottom-half implementation in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use rustix::fd::BorrowedFd;

use libc::c_int;

use crate::convert_res;

#[no_mangle]
unsafe extern "C" fn isatty(fd: c_int) -> c_int {
    libc!(libc::isatty(fd));

    match convert_res(rustix::termios::tcgetwinsize(BorrowedFd::borrow_raw(fd))) {
        Some(_) => 1,
        None => 0,
    }
}