ladybird/Userland/Utilities/whoami.cpp

21 lines
442 B
C++
Raw Normal View History

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