commit e5464f8a7ce14048ea4d64e0d5dba7f0508babe3
parent cd73c58a8888c0f557c4ab3a6f6a92c81576c452
Author: qorg11 <qorg@vxempire.xyz>
Date: Fri, 7 Aug 2020 00:22:16 +0200
Added logname.c
differences with whoami.c:
* whoami prints who you are
* logname prints the username you logged with
meaning that if you run logname with doas(1) or sudo(8) you'll get the
real username instead of root
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/logname.c b/src/logname.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <unistd.h>
+
+int
+main(void)
+{
+ printf("%s\n",getlogin());
+}