aboutsummaryrefslogtreecommitdiffstats
path: root/src/ios.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-03-20 00:36:08 -0500
committerJesse Luehrs <doy@tozt.net>2013-03-20 00:36:08 -0500
commit8fc473d033a4c38f7c0024bd259ff54b9867d50d (patch)
tree945a6323eb4d457871c7e2e26fc2684cc26ddcaa /src/ios.rs
parent28eeecd93029db4b756844852e3608eba83bf455 (diff)
downloadrust-term-8fc473d033a4c38f7c0024bd259ff54b9867d50d.tar.gz
rust-term-8fc473d033a4c38f7c0024bd259ff54b9867d50d.zip
implement getting terminal size
Diffstat (limited to 'src/ios.rs')
-rw-r--r--src/ios.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ios.rs b/src/ios.rs
index 7a9c33f..5945f38 100644
--- a/src/ios.rs
+++ b/src/ios.rs
@@ -1,4 +1,4 @@
-use core::libc::c_int;
+use core::libc::{c_int,c_uint};
pub fn cooked () -> int {
unsafe { c::cooked() as int }
@@ -25,6 +25,15 @@ pub fn isatty() -> bool {
unsafe { c_isatty(0) as bool }
}
+pub fn size() -> (uint, uint) {
+ let rows: c_uint = 0;
+ let cols: c_uint = 0;
+ unsafe {
+ c::size(&rows, &cols)
+ }
+ (rows as uint, cols as uint)
+}
+
enum struct_termios {}
struct PreserveTermios {
@@ -50,6 +59,8 @@ extern mod c {
fn get() -> *struct_termios;
fn set(t: *struct_termios);
+
+ fn size(rows: *c_uint, cols: *c_uint);
}
extern {