banan-os/userspace/programs/whoami/main.cpp

15 lines
200 B
C++
Raw Normal View History

2023-08-15 09:03:51 +03:00
#include <stdio.h>
#include <unistd.h>
int main()
{
2024-05-23 15:44:21 +03:00
char* login = getlogin();
if (login == nullptr)
2023-08-15 09:03:51 +03:00
{
printf("unknown user %d\n", geteuid());
return 1;
}
2024-05-23 15:44:21 +03:00
printf("%s\n", login);
2023-08-15 09:03:51 +03:00
return 0;
}