commit 8065fedd7016eb4cbaa09e10d148fcc0414a22d5 parent 7d414e2c5dac0812818b15c1af61117dedb14d9a Author: qorg11 <qorg@vxempire.xyz> Date: Wed, 8 Jul 2020 08:07:01 +0200 Better whoami Diffstat:
M | src/whoami.c | | | 6 | ++++-- |
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/whoami.c b/src/whoami.c @@ -1,8 +1,10 @@ #include <stdio.h> +#include <pwd.h> #include <unistd.h> + int main(void) { - printf("%s\n",getlogin()); - return 0; + struct passwd *user_data = getpwuid(getuid()); + printf("%s\n",user_data->pw_name); }