main.rs 518 B

123456789101112131415161718192021222324
  1. #![feature(lang_items)]
  2. #![feature(start)]
  3. #![feature(no_std)]
  4. #![no_std]
  5. extern crate libc;
  6. pub mod hex;
  7. #[start]
  8. fn start(argc: isize, argv: *const *const u8) -> isize {
  9. let mut buffer: [u8; 64] = [0; 64];
  10. let mut out: [u8; 129] = [0; 129];
  11. out[128] = 0;
  12. loop {
  13. let read = unsafe{ libc::read(libc::STDIN_FILENO, buffer.as_mut_ptr() as _, 64) }; //input.read(&mut buffer);
  14. hex::create_line(&buffer, &mut out, 0);
  15. unsafe { libc::puts(out.as_ptr() as *const _); }
  16. }
  17. }