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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright ⓒ 2015-2017 Benjamin Sago, Kevin Knapp, and [`term_size` contributors.](https://github.com/kbknapp/term_size-rs/blob/master/CONTRIBUTORS.md).
//
// Licensed under either of
//
// * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
// * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
//
// at your option. Unless specifically stated otherwise, all contributions will be licensed in the same manner.
// The following was originally taken and adapated from exa source
// repo: https://github.com/ogham/exa
// commit: b9eb364823d0d4f9085eb220233c704a13d0f611
// license: MIT - Copyright (c) 2014 Benjamin Sago
//! System calls for getting the terminal size.
//!
//! Getting the terminal size is performed using an ioctl command that takes
//! the file handle to the terminal -- which in this case, is stdout -- and
//! populates a structure containing the values.
//!
//! The size is needed when the user wants the output formatted into columns:
//! the default grid view, or the hybrid grid-details view.
//!
//! # Example
//!
//! To get the dimensions of your terminal window, simply use the following:
//!
//! ```no_run
//! # use term_size;
//! if let Some((w, h)) = term_size::dimensions() {
//! println!("Width: {}\nHeight: {}", w, h);
//! } else {
//! println!("Unable to get term size :(")
//! }
//! ```
extern crate libc;
extern crate winapi;
// A facade to allow exposing functions depending on the platform
pub use ;