From 63985a11ffe6e9cab9b41e928c5a8f9fc38bbe8f Mon Sep 17 00:00:00 2001 From: xTibor Date: Mon, 16 Jan 2017 00:19:24 +0100 Subject: [PATCH] Implement whoami --- Cargo.toml | 4 ++++ README.md | 1 + src/bin/whoami.rs | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 src/bin/whoami.rs diff --git a/Cargo.toml b/Cargo.toml index c471915093..053014efa0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,10 @@ path = "src/bin/su.rs" name = "sudo" path = "src/bin/sudo.rs" +[[bin]] +name = "whoami" +path = "src/bin/whoami.rs" + [dependencies] argon2rs = { version = "0.2", default-features = false } liner = "0.1" diff --git a/README.md b/README.md index 8bf00c5afc..573a365a29 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,4 @@ This repository contains utilities for user and group management for Redox. Addi - `id` - `login` - `sudo` +- `whoami` diff --git a/src/bin/whoami.rs b/src/bin/whoami.rs new file mode 100644 index 0000000000..4106fc2e70 --- /dev/null +++ b/src/bin/whoami.rs @@ -0,0 +1,5 @@ +use std::env; + +pub fn main() { + println!("{}", env::var("USER").unwrap_or(String::new())); +}