summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2020-04-13 02:13:58 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2020-04-13 02:13:58 +0200
commit5b449f4e1e43bc59109da5a37edf5ec911d3df8e (patch)
tree46968e5619a1088f131f532a5d78e8ff4d033325 /src
parentfff906a78ba545e77d087a82711b30bcc8e0d0c5 (diff)
downloadneco-5b449f4e1e43bc59109da5a37edf5ec911d3df8e.tar
neco-5b449f4e1e43bc59109da5a37edf5ec911d3df8e.zip
IO, error handling
Diffstat (limited to 'src')
-rw-r--r--src/main.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index c79f1da..26882ff 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,11 +8,11 @@ use core::fmt::Write;
#[no_mangle]
pub extern "C" fn main(_nargs: libc::c_int, _args: *const *const libc::c_char) -> libc::c_int {
- let mut stdout = unsafe { libc::stdio::stdout() };
+ let mut stdout = libc::stdio::stdout();
{
let foo = cstr!("Foo!\n");
- stdout.puts(foo);
+ let _ = stdout.puts(foo);
}
{
@@ -29,11 +29,12 @@ pub extern "C" fn main(_nargs: libc::c_int, _args: *const *const libc::c_char) -
let b = libc::boxed::CBox::new(42);
let _ = writeln!(stdout, "Bar: {}", b);
}
+
0
}
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
- let _ = writeln!(unsafe { libc::stdio::stderr() }, "Panic: {}", info);
+ let _ = writeln!(libc::stdio::stderr(), "Panic: {}", info);
unsafe { libc::abort() }
}