summaryrefslogtreecommitdiffstats
path: root/bins/mkdir/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bins/mkdir/src/main.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/bins/mkdir/src/main.rs b/bins/mkdir/src/main.rs
new file mode 100644
index 0000000..f6f7e66
--- /dev/null
+++ b/bins/mkdir/src/main.rs
@@ -0,0 +1,18 @@
1//! mkdir — create directories via the exports table.
2
3#![no_std]
4#![no_main]
5
6#[panic_handler]
7fn panic(_info: &core::panic::PanicInfo) -> ! {
8 loop { core::hint::spin_loop(); }
9}
10
11#[unsafe(no_mangle)]
12pub extern "C" fn efi_main(exports: &'static rsapi::Exports, argc: usize, argv: *const rsapi::Arg) -> i32 {
13 let args = unsafe { core::slice::from_raw_parts(argv, argc) };
14 if args.is_empty() { return 1; }
15 let path = unsafe { core::str::from_utf8_unchecked(core::slice::from_raw_parts(args[0].ptr, args[0].len)) };
16 let rc = (exports.fs_create)(rsapi::Line { ptr: path.as_ptr(), len: path.len() }, true);
17 rc
18}