|  | @@ -105,12 +105,22 @@ pub extern "C" fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FI
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  #[no_mangle]
 |  |  #[no_mangle]
 | 
											
												
													
														|  |  pub extern "C" fn fputc(c: c_int, stream: *mut FILE) -> c_int {
 |  |  pub extern "C" fn fputc(c: c_int, stream: *mut FILE) -> c_int {
 | 
											
												
													
														|  | -    unimplemented!();
 |  | 
 | 
											
												
													
														|  | 
 |  | +    platform::FileWriter(stream as c_int).write_char(c as u8 as char).map_err(|_| return -1);
 | 
											
												
													
														|  | 
 |  | +    c
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  #[no_mangle]
 |  |  #[no_mangle]
 | 
											
												
													
														|  | -pub extern "C" fn fputs(s: *const c_char, stream: *mut FILE) -> c_int {
 |  | 
 | 
											
												
													
														|  | -    unimplemented!();
 |  | 
 | 
											
												
													
														|  | 
 |  | +pub unsafe extern "C" fn fputs(s: *const c_char, stream: *mut FILE) -> c_int {
 | 
											
												
													
														|  | 
 |  | +    extern "C" {
 | 
											
												
													
														|  | 
 |  | +        fn strlen(s: *const c_char) -> size_t;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    use core::{ str, slice };
 | 
											
												
													
														|  | 
 |  | +    let len = strlen(s);
 | 
											
												
													
														|  | 
 |  | +    platform::FileWriter(stream as c_int).write_str(str::from_utf8_unchecked(slice::from_raw_parts(
 | 
											
												
													
														|  | 
 |  | +                        s as *const u8,
 | 
											
												
													
														|  | 
 |  | +                        len,
 | 
											
												
													
														|  | 
 |  | +                    ))).map_err(|_| return -1);
 | 
											
												
													
														|  | 
 |  | +    len as i32
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  #[no_mangle]
 |  |  #[no_mangle]
 | 
											
										
											
												
													
														|  | @@ -245,8 +255,9 @@ pub unsafe extern "C" fn putchar_unlocked(c: c_int) -> c_int {
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  #[no_mangle]
 |  |  #[no_mangle]
 | 
											
												
													
														|  | -pub extern "C" fn puts(s: *const c_char) -> c_int {
 |  | 
 | 
											
												
													
														|  | -    unimplemented!();
 |  | 
 | 
											
												
													
														|  | 
 |  | +pub unsafe extern "C" fn puts(s: *const c_char) -> c_int {
 | 
											
												
													
														|  | 
 |  | +    fputs(s, stdout);
 | 
											
												
													
														|  | 
 |  | +    putchar(b'\n' as c_int)
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  #[no_mangle]
 |  |  #[no_mangle]
 |