Jelajahi Sumber

stdio: add support for %o to printf()

Alex Lyon 7 tahun lalu
induk
melakukan
a7e71717cb
1 mengubah file dengan 7 tambahan dan 0 penghapusan
  1. 7 0
      src/stdio/src/printf.rs

+ 7 - 0
src/stdio/src/printf.rs

@@ -85,6 +85,13 @@ pub unsafe fn printf<W: fmt::Write>(mut w: W, format: *const c_char, mut ap: VaL
 
                     found_percent = false;
                 }
+                'o' => {
+                    let a = ap.get::<c_uint>();
+
+                    w.write_fmt(format_args!("{:o}", a));
+
+                    found_percent = false;
+                }
                 '-' => {}
                 '+' => {}
                 ' ' => {}