mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
less: Replace LibC calls with their LibCore equivalents
This commit is contained in:
parent
e0fcfc8a99
commit
6d2f9f0316
Notes:
sideshowbarker
2024-07-17 02:57:43 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/6d2f9f0316 Pull-request: https://github.com/SerenityOS/serenity/pull/19980 Reviewed-by: https://github.com/petelliott ✅
1 changed files with 7 additions and 7 deletions
|
@ -9,9 +9,7 @@
|
|||
#include <LibCore/System.h>
|
||||
#include <LibLine/Editor.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <csignal>
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -181,8 +179,8 @@ public:
|
|||
{
|
||||
// First, we get the current size of the window.
|
||||
struct winsize window;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &window) == -1) {
|
||||
perror("ioctl(2)");
|
||||
if (auto maybe_error = Core::System::ioctl(STDOUT_FILENO, TIOCGWINSZ, &window); maybe_error.is_error()) {
|
||||
warnln("ioctl(2): {}", strerror(maybe_error.error().code()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -522,9 +520,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
// On SIGWINCH set this flag so that the main-loop knows when the terminal
|
||||
// has been resized.
|
||||
signal(SIGWINCH, [](auto) {
|
||||
struct sigaction resize_action;
|
||||
resize_action.sa_handler = [](auto) {
|
||||
g_resized = true;
|
||||
});
|
||||
};
|
||||
TRY(Core::System::sigaction(SIGWINCH, &resize_action, nullptr));
|
||||
|
||||
TRY(Core::System::pledge("stdio tty sigaction"));
|
||||
|
||||
|
@ -535,7 +535,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
prompt = "--More--";
|
||||
}
|
||||
|
||||
if (!isatty(STDOUT_FILENO)) {
|
||||
if (!TRY(Core::System::isatty(STDOUT_FILENO))) {
|
||||
cat_file(file);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue