ladybird/Userland/Utilities/whoami.cpp

21 lines
442 B
C++
Raw Normal View History

/*
2021-11-29 21:16:35 +01:00
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
2021-11-29 21:16:35 +01:00
#include <LibCore/System.h>
#include <LibMain/Main.h>
2019-05-16 20:18:17 +02:00
#include <stdio.h>
#include <unistd.h>
2021-11-29 21:16:35 +01:00
ErrorOr<int> serenity_main(Main::Arguments)
2019-05-16 20:18:17 +02:00
{
2021-11-29 21:16:35 +01:00
TRY(Core::System::pledge("stdio rpath"));
TRY(Core::System::unveil("/etc/passwd", "r"));
TRY(Core::System::unveil(nullptr, nullptr));
2020-02-18 11:01:31 +01:00
2019-05-16 20:18:17 +02:00
puts(getlogin());
return 0;
}