mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:47:45 +00:00
man: Port to Core::Stream
This commit is contained in:
parent
75208f2333
commit
ccebf8bf59
1 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/Stream.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
#include <LibMarkdown/Document.h>
|
#include <LibMarkdown/Document.h>
|
||||||
|
@ -108,12 +108,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
pager_command = String::formatted("less -P 'Manual Page {}({}) line %l?e (END):.'", StringView(name).replace("'"sv, "'\\''"sv, ReplaceMode::FirstOnly), StringView(section).replace("'"sv, "'\\''"sv, ReplaceMode::FirstOnly));
|
pager_command = String::formatted("less -P 'Manual Page {}({}) line %l?e (END):.'", StringView(name).replace("'"sv, "'\\''"sv, ReplaceMode::FirstOnly), StringView(section).replace("'"sv, "'\\''"sv, ReplaceMode::FirstOnly));
|
||||||
pid_t pager_pid = TRY(pipe_to_pager(pager_command));
|
pid_t pager_pid = TRY(pipe_to_pager(pager_command));
|
||||||
|
|
||||||
auto file = TRY(Core::File::open(filename, Core::OpenMode::ReadOnly));
|
auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Read));
|
||||||
|
|
||||||
TRY(Core::System::pledge("stdio proc"));
|
TRY(Core::System::pledge("stdio proc"));
|
||||||
|
|
||||||
dbgln("Loading man page from {}", file->filename());
|
dbgln("Loading man page from {}", filename);
|
||||||
auto buffer = file->read_all();
|
auto buffer = TRY(file->read_all());
|
||||||
auto source = String::copy(buffer);
|
auto source = String::copy(buffer);
|
||||||
|
|
||||||
const String title("SerenityOS manual");
|
const String title("SerenityOS manual");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue