Last active
August 29, 2015 14:20
-
-
Save niconii/81ed93d3fb4fb9fdd284 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
use libc::*; | |
use libc::funcs::posix01::signal::signal; | |
fn main() { | |
unsafe { signal(SIGINT, goodbye as u64); } | |
println!("Hello, world!"); | |
loop { | |
// spinning spinning spinning spinniiiing... | |
} | |
} | |
extern fn goodbye() { | |
println!("Goodbye, cruel world!"); | |
unsafe { exit(1); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment