1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:14:58 +00:00

Userland: Remove unecessary uses of __serenity__ macro

This commit is contained in:
Andrew Kaster 2022-10-09 15:38:06 -06:00 committed by Linus Groh
parent 828441852f
commit 539fb08551
10 changed files with 4 additions and 51 deletions

View file

@ -90,15 +90,9 @@ static String format_ntp_timestamp(NtpTimestamp ntp_timestamp)
buffer[written] = '\0';
return buffer;
}
#ifdef __serenity__
ErrorOr<int> serenity_main(Main::Arguments arguments)
#else
int main(int argc, char** argv)
#endif
{
#ifdef __serenity__
TRY(Core::System::pledge("stdio inet unix settime"));
#endif
bool adjust_time = false;
bool set_time = false;
@ -119,22 +113,16 @@ int main(int argc, char** argv)
args_parser.add_option(set_time, "Immediately set system time (requires root)", "set", 's');
args_parser.add_option(verbose, "Verbose output", "verbose", 'v');
args_parser.add_positional_argument(host, "NTP server", "host", Core::ArgsParser::Required::No);
#ifdef __serenity__
args_parser.parse(arguments);
#else
args_parser.parse(argc, argv);
#endif
if (adjust_time && set_time) {
warnln("-a and -s are mutually exclusive");
return 1;
}
#ifdef __serenity__
if (!adjust_time && !set_time) {
TRY(Core::System::pledge("stdio inet unix"));
}
#endif
auto* hostent = gethostbyname(host);
if (!hostent) {
@ -142,10 +130,8 @@ int main(int argc, char** argv)
return 1;
}
#ifdef __serenity__
TRY(Core::System::pledge((adjust_time || set_time) ? "stdio inet settime"sv : "stdio inet"sv));
TRY(Core::System::unveil(nullptr, nullptr));
#endif
int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (fd < 0) {