mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
uptime: Port to LibMain :^)
This commit is contained in:
parent
db36bdfeb7
commit
cd7b50a074
Notes:
sideshowbarker
2024-07-17 21:48:37 +09:00
Author: https://github.com/mjz19910 Commit: https://github.com/SerenityOS/serenity/commit/cd7b50a0747 Pull-request: https://github.com/SerenityOS/serenity/pull/11559
2 changed files with 6 additions and 9 deletions
|
@ -150,6 +150,7 @@ target_link_libraries(touch LibMain)
|
|||
target_link_libraries(truncate LibMain)
|
||||
target_link_libraries(tt LibPthread)
|
||||
target_link_libraries(unzip LibArchive LibCompress)
|
||||
target_link_libraries(uptime LibMain)
|
||||
target_link_libraries(userdel LibMain)
|
||||
target_link_libraries(usermod LibMain)
|
||||
target_link_libraries(utmpupdate LibMain)
|
||||
|
|
|
@ -5,15 +5,14 @@
|
|||
*/
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int, char**)
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
if (pledge("stdio rpath", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio rpath"));
|
||||
|
||||
FILE* fp = fopen("/proc/uptime", "r");
|
||||
if (!fp) {
|
||||
|
@ -21,10 +20,7 @@ int main(int, char**)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (pledge("stdio", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
TRY(Core::System::pledge("stdio"));
|
||||
|
||||
char buffer[BUFSIZ];
|
||||
auto* p = fgets(buffer, sizeof(buffer), fp);
|
||||
|
|
Loading…
Reference in a new issue