2022-10-30 00:13:30 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Beckett Normington <beckett@b0ba.dev>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2022-10-31 13:04:01 +00:00
|
|
|
#include <AK/StringView.h>
|
2023-02-09 02:02:46 +00:00
|
|
|
#include <LibCore/File.h>
|
2022-10-30 00:13:30 +00:00
|
|
|
#include <LibCore/System.h>
|
|
|
|
#include <LibMain/Main.h>
|
|
|
|
|
|
|
|
ErrorOr<int> serenity_main(Main::Arguments)
|
|
|
|
{
|
|
|
|
TRY(Core::System::pledge("stdio rpath"sv));
|
|
|
|
|
2023-02-09 02:02:46 +00:00
|
|
|
auto file_or_error = Core::File::open("/etc/nologin"sv, Core::File::OpenMode::Read);
|
2022-10-30 00:13:30 +00:00
|
|
|
if (file_or_error.is_error()) {
|
2022-10-31 13:04:01 +00:00
|
|
|
outln("This account is currently not available.");
|
2022-10-30 00:13:30 +00:00
|
|
|
} else {
|
2022-12-11 16:49:00 +00:00
|
|
|
auto message_from_file = TRY(file_or_error.value()->read_until_eof());
|
2022-10-31 13:04:01 +00:00
|
|
|
out("{}", StringView { message_from_file });
|
2022-10-30 00:13:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|