mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-26 13:56:27 +00:00
Start using the libc crate from crates.io
This commit is contained in:
parent
00ae71850b
commit
2594690aff
17
Cargo.lock
generated
17
Cargo.lock
generated
@ -6,7 +6,8 @@ dependencies = [
|
||||
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"datetime 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"git2 0.2.9 (git+https://github.com/alexcrichton/git2-rs.git)",
|
||||
"git2 0.2.10 (git+https://github.com/alexcrichton/git2-rs.git)",
|
||||
"libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"locale 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"natord 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -53,13 +54,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.2.9"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs.git#3a5f0b5698c5203fa48e33094158990a2c53c979"
|
||||
version = "0.2.10"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs.git#f820ef645e2275c80c3009da770a5b6a9b5ce0f0"
|
||||
dependencies = [
|
||||
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libgit2-sys 0.2.12 (git+https://github.com/alexcrichton/git2-rs.git)",
|
||||
"url 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libgit2-sys 0.2.13 (git+https://github.com/alexcrichton/git2-rs.git)",
|
||||
"url 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -69,8 +70,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.2.12"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs.git#3a5f0b5698c5203fa48e33094158990a2c53c979"
|
||||
version = "0.2.13"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs.git#f820ef645e2275c80c3009da770a5b6a9b5ce0f0"
|
||||
dependencies = [
|
||||
"libc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libssh2-sys 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -232,7 +233,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.2.33"
|
||||
version = "0.2.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -11,6 +11,7 @@ ansi_term = "0.5.0"
|
||||
bitflags = "0.1"
|
||||
datetime = "0.1.3"
|
||||
getopts = "0.2.1"
|
||||
libc = "*"
|
||||
locale = "0.1.2"
|
||||
natord = "1.0.7"
|
||||
num_cpus = "*"
|
||||
|
@ -1,9 +1,10 @@
|
||||
#![feature(collections, convert, core, exit_status, file_type, fs_ext, fs_mode)]
|
||||
#![feature(libc, metadata_ext, raw_ext, scoped, symlink_metadata)]
|
||||
#![feature(metadata_ext, raw_ext, scoped, symlink_metadata)]
|
||||
|
||||
extern crate ansi_term;
|
||||
extern crate datetime;
|
||||
extern crate getopts;
|
||||
extern crate libc;
|
||||
extern crate locale;
|
||||
extern crate natord;
|
||||
extern crate num_cpus;
|
||||
@ -12,7 +13,6 @@ extern crate pad;
|
||||
extern crate users;
|
||||
extern crate unicode_width;
|
||||
|
||||
|
||||
#[cfg(feature="git")]
|
||||
extern crate git2;
|
||||
|
||||
|
17
src/term.rs
17
src/term.rs
@ -1,19 +1,12 @@
|
||||
mod c {
|
||||
#![allow(non_camel_case_types)]
|
||||
extern crate libc;
|
||||
pub use self::libc::{
|
||||
c_int,
|
||||
c_ushort,
|
||||
c_ulong,
|
||||
STDOUT_FILENO,
|
||||
};
|
||||
pub use libc::{c_int, c_ushort, c_ulong, STDOUT_FILENO};
|
||||
use std::mem::zeroed;
|
||||
|
||||
// Getting the terminal size is done using an ioctl command that
|
||||
// takes the file handle to the terminal (which in our case is
|
||||
// stdout), and populates a structure with the values.
|
||||
|
||||
pub struct winsize {
|
||||
pub struct Winsize {
|
||||
pub ws_row: c_ushort,
|
||||
pub ws_col: c_ushort,
|
||||
}
|
||||
@ -30,9 +23,9 @@ mod c {
|
||||
pub fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int;
|
||||
}
|
||||
|
||||
pub unsafe fn dimensions() -> winsize {
|
||||
let mut window: winsize = zeroed();
|
||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut window as *mut winsize);
|
||||
pub unsafe fn dimensions() -> Winsize {
|
||||
let mut window: Winsize = zeroed();
|
||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut window as *mut Winsize);
|
||||
window
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user