#![feature(libc)]
extern crate libc;



fn isatty() -> bool {
    let isatty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
    isatty
}

pub fn readline() -> Option<String> {
    if isatty() {
        Some(buffer)
    } else {
        None
    }
}




#![feature(libc)]
extern crate libc;

pub fn readline() -> Option<String> {
    // Buffer to hold readline input
    let buffer = String::new();

    let isatty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0; 
    if isatty  {
        println!("stdin is a tty");
    } else {
        println!("stdin is not a tty");
    }

    buffer
}

--- 
+++ 
@@ -1,20 +1,16 @@
 #![feature(libc)]
 extern crate libc;
 
+pub fn readline() -> Option<String> {
+    // Buffer to hold readline input
+    let buffer = String::new();
 
+    let isatty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0; 
+    if isatty  {
+        println!("stdin is a tty");
+    } else {
+        println!("stdin is not a tty");
+    }
 
-fn isatty() -> bool {
-    let isatty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
-    isatty
+    buffer
 }
-
-pub fn readline() -> Option<String> {
-    if isatty() {
-        Some(buffer)
-    } else {
-        None
-    }
-}
-
-
-
Split out tty check to a separate function
