Check input device is a terminal: Difference between revisions
Content added Content deleted
(→{{header|Julia}}: A new entry for Julia) |
(→{{header|Rust}}: Updated to the Rust 1.2.0) |
||
Line 208: | Line 208: | ||
=={{header|Rust}}== |
=={{header|Rust}}== |
||
<lang rust>/* |
<lang rust>/* Uses C library interface */ |
||
extern mod std; |
|||
extern crate libc; |
|||
fn main() { |
fn main() { |
||
let istty = unsafe { libc::isatty(libc:: |
let istty = unsafe { libc::isatty(libc::STDOUT_FILENO as i32) } != 0; |
||
if |
if istty { |
||
println(" |
println!("stdout is tty"); |
||
} else { |
} else { |
||
println(" |
println!("stdout is not tty"); |
||
} |
} |
||
}</lang> |
}</lang> |