mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
DHCPClient: Port to LibMain :^)
This commit is contained in:
parent
6e7ff8cf1c
commit
74a6fb64b2
Notes:
sideshowbarker
2024-07-17 23:16:59 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/74a6fb64b2c
|
@ -11,4 +11,4 @@ set(SOURCES
|
|||
)
|
||||
|
||||
serenity_bin(DHCPClient)
|
||||
target_link_libraries(DHCPClient LibCore)
|
||||
target_link_libraries(DHCPClient LibCore LibMain)
|
||||
|
|
|
@ -5,35 +5,20 @@
|
|||
*/
|
||||
|
||||
#include "DHCPv4Client.h"
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
if (pledge("stdio unix inet cpath rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
TRY(Core::System::pledge("stdio unix inet cpath rpath"));
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
if (unveil("/proc/net/", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::unveil("/proc/net/", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
unveil(nullptr, nullptr);
|
||||
|
||||
auto client = DHCPv4Client::construct();
|
||||
|
||||
if (pledge("stdio inet cpath rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
auto client = TRY(DHCPv4Client::try_create());
|
||||
|
||||
TRY(Core::System::pledge("stdio inet cpath rpath"));
|
||||
return event_loop.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue