Skip to content

Instantly share code, notes, and snippets.

@niconii
Last active August 29, 2015 14:20
Show Gist options
  • Save niconii/81ed93d3fb4fb9fdd284 to your computer and use it in GitHub Desktop.
Save niconii/81ed93d3fb4fb9fdd284 to your computer and use it in GitHub Desktop.
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