From 39a1cc73d32d33bbd91d80e2bc12e3980d0e6ae9 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Mon, 4 Jun 2018 11:29:28 +0900 Subject: [PATCH] Add whoami --- apps/whoami.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 apps/whoami.c diff --git a/apps/whoami.c b/apps/whoami.c new file mode 100644 index 00000000..e8ddf36d --- /dev/null +++ b/apps/whoami.c @@ -0,0 +1,25 @@ +/* vim: tabstop=4 shiftwidth=4 noexpandtab + * This file is part of ToaruOS and is released under the terms + * of the NCSA / University of Illinois License - see LICENSE.md + * Copyright (C) 2013-2014 K. Lange + * + * Who Am I? + * + */ +#include +#include +#include +#include +#include + +int main(int argc, char ** argv) { + struct passwd * p = getpwuid(getuid()); + if (!p) return 0; + + fprintf(stdout, "%s\n", p->pw_name); + + endpwent(); + + return 0; +} +