diff options
Diffstat (limited to 'Userland/Utilities')
39 files changed, 53 insertions, 53 deletions
diff --git a/Userland/Utilities/arp.cpp b/Userland/Utilities/arp.cpp index 1f27f4a552..e34d620fec 100644 --- a/Userland/Utilities/arp.cpp +++ b/Userland/Utilities/arp.cpp @@ -90,7 +90,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (!flag_set && !flag_delete) { auto file = TRY(Core::Stream::File::open("/sys/kernel/net/arp"sv, Core::Stream::OpenMode::Read)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); Vector<JsonValue> sorted_regions = json.as_array().values(); diff --git a/Userland/Utilities/base64.cpp b/Userland/Utilities/base64.cpp index dbcd0a1221..e4e2b1dfcd 100644 --- a/Userland/Utilities/base64.cpp +++ b/Userland/Utilities/base64.cpp @@ -23,7 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.parse(arguments); auto file = TRY(Core::Stream::File::open_file_or_standard_stream(filepath, Core::Stream::OpenMode::Read)); - ByteBuffer buffer = TRY(file->read_all()); + ByteBuffer buffer = TRY(file->read_until_eof()); TRY(Core::System::pledge("stdio")); diff --git a/Userland/Utilities/copy.cpp b/Userland/Utilities/copy.cpp index 1a6f80de9f..b3103c7146 100644 --- a/Userland/Utilities/copy.cpp +++ b/Userland/Utilities/copy.cpp @@ -43,7 +43,7 @@ static ErrorOr<Options> parse_options(Main::Arguments arguments) } else if (text.is_empty()) { // Copy our stdin. auto c_stdin = TRY(Core::Stream::File::standard_input()); - auto buffer = TRY(c_stdin->read_all()); + auto buffer = TRY(c_stdin->read_until_eof()); dbgln("Read size {}", buffer.size()); dbgln("Read data: `{}`", StringView(buffer.bytes())); options.data = buffer.bytes(); diff --git a/Userland/Utilities/cpp-lexer.cpp b/Userland/Utilities/cpp-lexer.cpp index 1bce9e6f7f..fdbe49c5e8 100644 --- a/Userland/Utilities/cpp-lexer.cpp +++ b/Userland/Utilities/cpp-lexer.cpp @@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.parse(arguments); auto file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read)); - auto content = TRY(file->read_all()); + auto content = TRY(file->read_until_eof()); StringView content_view(content); Cpp::Lexer lexer(content); diff --git a/Userland/Utilities/cpp-parser.cpp b/Userland/Utilities/cpp-parser.cpp index 790dc42868..91e6f5a4de 100644 --- a/Userland/Utilities/cpp-parser.cpp +++ b/Userland/Utilities/cpp-parser.cpp @@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (path.is_empty()) path = "Source/little/main.cpp"sv; auto file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read)); - auto content = TRY(file->read_all()); + auto content = TRY(file->read_until_eof()); StringView content_view(content); ::Cpp::Preprocessor processor(path, content_view); diff --git a/Userland/Utilities/cpp-preprocessor.cpp b/Userland/Utilities/cpp-preprocessor.cpp index e3c97fa848..34e6148471 100644 --- a/Userland/Utilities/cpp-preprocessor.cpp +++ b/Userland/Utilities/cpp-preprocessor.cpp @@ -20,7 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.parse(arguments); auto file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read)); - auto content = TRY(file->read_all()); + auto content = TRY(file->read_until_eof()); DeprecatedString name = LexicalPath::basename(path); Cpp::Preprocessor cpp(name, StringView { content }); auto tokens = cpp.process_and_lex(); diff --git a/Userland/Utilities/df.cpp b/Userland/Utilities/df.cpp index d53e90bed3..e3ba52013e 100644 --- a/Userland/Utilities/df.cpp +++ b/Userland/Utilities/df.cpp @@ -40,7 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) outln("Filesystem Blocks Used Available Mount point"); } - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json_result = TRY(JsonValue::from_string(file_contents)); auto const& json = json_result.as_array(); json.for_each([](auto& value) { diff --git a/Userland/Utilities/diff.cpp b/Userland/Utilities/diff.cpp index b4df9da59a..b15a2f9bb4 100644 --- a/Userland/Utilities/diff.cpp +++ b/Userland/Utilities/diff.cpp @@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) bool color_output = TRY(Core::System::isatty(STDOUT_FILENO)); - auto hunks = Diff::from_text(TRY(file1->read_all()), TRY(file2->read_all())); + auto hunks = Diff::from_text(TRY(file1->read_until_eof()), TRY(file2->read_until_eof())); for (auto const& hunk : hunks) { auto original_start = hunk.original_start_line; auto target_start = hunk.target_start_line; diff --git a/Userland/Utilities/dmesg.cpp b/Userland/Utilities/dmesg.cpp index 05181b3246..cb5e94baf4 100644 --- a/Userland/Utilities/dmesg.cpp +++ b/Userland/Utilities/dmesg.cpp @@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::unveil(nullptr, nullptr)); auto file = TRY(Core::Stream::File::open("/sys/kernel/dmesg"sv, Core::Stream::OpenMode::Read)); - auto buffer = TRY(file->read_all()); + auto buffer = TRY(file->read_until_eof()); out("{}", StringView { buffer }); return 0; } diff --git a/Userland/Utilities/du.cpp b/Userland/Utilities/du.cpp index 938dd5d9be..d018e79d5a 100644 --- a/Userland/Utilities/du.cpp +++ b/Userland/Utilities/du.cpp @@ -115,7 +115,7 @@ ErrorOr<void> parse_args(Main::Arguments arguments, Vector<DeprecatedString>& fi du_option.excluded_patterns.append(pattern); if (!exclude_from.is_empty()) { auto file = TRY(Core::Stream::File::open(exclude_from, Core::Stream::OpenMode::Read)); - auto const buff = TRY(file->read_all()); + auto const buff = TRY(file->read_until_eof()); if (!buff.is_empty()) { DeprecatedString patterns = DeprecatedString::copy(buff, Chomp); du_option.excluded_patterns.extend(patterns.split('\n')); diff --git a/Userland/Utilities/fortune.cpp b/Userland/Utilities/fortune.cpp index 87b2d19bf8..3c76ae30db 100644 --- a/Userland/Utilities/fortune.cpp +++ b/Userland/Utilities/fortune.cpp @@ -87,7 +87,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); if (!json.is_array()) { warnln("{} does not contain an array of quotes", path); diff --git a/Userland/Utilities/gml-format.cpp b/Userland/Utilities/gml-format.cpp index a57c62b3df..37d10475fe 100644 --- a/Userland/Utilities/gml-format.cpp +++ b/Userland/Utilities/gml-format.cpp @@ -16,7 +16,7 @@ static ErrorOr<bool> format_file(StringView path, bool inplace) auto open_mode = (inplace && !read_from_stdin) ? Core::Stream::OpenMode::ReadWrite : Core::Stream::OpenMode::Read; auto file = TRY(Core::Stream::File::open_file_or_standard_stream(path, open_mode)); - auto contents = TRY(file->read_all()); + auto contents = TRY(file->read_until_eof()); auto formatted_gml_or_error = GUI::GML::format_gml(contents); if (formatted_gml_or_error.is_error()) { warnln("Failed to parse GML: {}", formatted_gml_or_error.error()); diff --git a/Userland/Utilities/gron.cpp b/Userland/Utilities/gron.cpp index d96c44c3cc..6e77a33f03 100644 --- a/Userland/Utilities/gron.cpp +++ b/Userland/Utilities/gron.cpp @@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio")); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); if (use_color) { diff --git a/Userland/Utilities/ifconfig.cpp b/Userland/Utilities/ifconfig.cpp index b532594f0c..2489e57ce7 100644 --- a/Userland/Utilities/ifconfig.cpp +++ b/Userland/Utilities/ifconfig.cpp @@ -32,7 +32,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (value_ipv4.is_empty() && value_adapter.is_empty() && value_mask.is_empty()) { auto file = TRY(Core::Stream::File::open("/sys/kernel/net/adapters"sv, Core::Stream::OpenMode::Read)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); json.as_array().for_each([](auto& value) { diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index fb0965debf..7e1a105341 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -370,7 +370,7 @@ static JS::ThrowCompletionOr<JS::Value> load_json_impl(JS::VM& vm) if (file_or_error.is_error()) return vm.throw_completion<JS::Error>(DeprecatedString::formatted("Failed to open '{}': {}", filename, file_or_error.error())); - auto file_contents_or_error = file_or_error.value()->read_all(); + auto file_contents_or_error = file_or_error.value()->read_until_eof(); if (file_contents_or_error.is_error()) return vm.throw_completion<JS::Error>(DeprecatedString::formatted("Failed to read '{}': {}", filename, file_contents_or_error.error())); @@ -878,7 +878,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) for (auto& path : script_paths) { auto file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto source = StringView { file_contents }; if (Utf8View { file_contents }.validate()) { diff --git a/Userland/Utilities/json.cpp b/Userland/Utilities/json.cpp index d88542af51..33907ed061 100644 --- a/Userland/Utilities/json.cpp +++ b/Userland/Utilities/json.cpp @@ -47,7 +47,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio")); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); if (!dotted_key.is_empty()) { auto key_parts = dotted_key.split_view('.'); diff --git a/Userland/Utilities/lsblk.cpp b/Userland/Utilities/lsblk.cpp index b519a02dcc..e6d611ff45 100644 --- a/Userland/Utilities/lsblk.cpp +++ b/Userland/Utilities/lsblk.cpp @@ -56,21 +56,21 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) continue; } - auto maybe_command_set = command_set_file.value()->read_all(); + auto maybe_command_set = command_set_file.value()->read_until_eof(); if (maybe_command_set.is_error()) { dbgln("Error: Could not read {}: {}", command_set_filename, maybe_command_set.error()); continue; } DeprecatedString command_set = StringView(maybe_command_set.value().bytes()); - auto maybe_last_lba = last_lba_file.value()->read_all(); + auto maybe_last_lba = last_lba_file.value()->read_until_eof(); if (maybe_last_lba.is_error()) { dbgln("Error: Could not read {}: {}", last_lba_filename, maybe_last_lba.error()); continue; } DeprecatedString last_lba = StringView(maybe_last_lba.value().bytes()); - auto maybe_sector_size = sector_size_file.value()->read_all(); + auto maybe_sector_size = sector_size_file.value()->read_until_eof(); if (maybe_sector_size.is_error()) { dbgln("Error: Could not read {}: {}", sector_size_filename, maybe_sector_size.error()); continue; diff --git a/Userland/Utilities/lscpu.cpp b/Userland/Utilities/lscpu.cpp index 0cfac0606c..6a227298b6 100644 --- a/Userland/Utilities/lscpu.cpp +++ b/Userland/Utilities/lscpu.cpp @@ -60,7 +60,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::unveil(nullptr, nullptr)); auto file = TRY(Core::Stream::File::open("/sys/kernel/cpuinfo"sv, Core::Stream::OpenMode::Read)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); auto const& array = json.as_array(); diff --git a/Userland/Utilities/lsirq.cpp b/Userland/Utilities/lsirq.cpp index 37f41868c7..c4542013df 100644 --- a/Userland/Utilities/lsirq.cpp +++ b/Userland/Utilities/lsirq.cpp @@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::pledge("stdio")); - auto file_contents = TRY(proc_interrupts->read_all()); + auto file_contents = TRY(proc_interrupts->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); auto cpu_count = json.as_array().at(0).as_object().get("per_cpu_call_counts"sv).as_array().size(); diff --git a/Userland/Utilities/lsjails.cpp b/Userland/Utilities/lsjails.cpp index 4ec5e234f0..ccf3438783 100644 --- a/Userland/Utilities/lsjails.cpp +++ b/Userland/Utilities/lsjails.cpp @@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::pledge("stdio")); outln("Index Name"); - auto file_contents = TRY(jails_data->read_all()); + auto file_contents = TRY(jails_data->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); json.as_array().for_each([](auto& value) { auto& jail = value.as_object(); diff --git a/Userland/Utilities/lsof.cpp b/Userland/Utilities/lsof.cpp index 5d38b6e24d..eef27eee81 100644 --- a/Userland/Utilities/lsof.cpp +++ b/Userland/Utilities/lsof.cpp @@ -70,7 +70,7 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid) outln("lsof: PID {}: {}", pid, file.error()); return Vector<OpenFile>(); } - auto data = file.value()->read_all(); + auto data = file.value()->read_until_eof(); if (data.is_error()) { outln("lsof: PID {}: {}", pid, data.error()); return {}; diff --git a/Userland/Utilities/lspci.cpp b/Userland/Utilities/lspci.cpp index 715fc72a6f..feac6a4ae6 100644 --- a/Userland/Utilities/lspci.cpp +++ b/Userland/Utilities/lspci.cpp @@ -119,35 +119,35 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) continue; } - auto vendor_id_contents = vendor_id_file.value()->read_all(); + auto vendor_id_contents = vendor_id_file.value()->read_until_eof(); if (vendor_id_contents.is_error()) { dbgln("Error: Could not read {}: {}", vendor_id_filename, vendor_id_contents.error()); continue; } u32 vendor_id = read_hex_string_from_bytebuffer(vendor_id_contents.value()); - auto device_id_contents = device_id_file.value()->read_all(); + auto device_id_contents = device_id_file.value()->read_until_eof(); if (device_id_contents.is_error()) { dbgln("Error: Could not read {}: {}", device_id_filename, device_id_contents.error()); continue; } u32 device_id = read_hex_string_from_bytebuffer(device_id_contents.value()); - auto revision_id_contents = revision_id_file.value()->read_all(); + auto revision_id_contents = revision_id_file.value()->read_until_eof(); if (revision_id_contents.is_error()) { dbgln("Error: Could not read {}: {}", revision_id_filename, revision_id_contents.error()); continue; } u32 revision_id = read_hex_string_from_bytebuffer(revision_id_contents.value()); - auto class_id_contents = class_id_file.value()->read_all(); + auto class_id_contents = class_id_file.value()->read_until_eof(); if (class_id_contents.is_error()) { dbgln("Error: Could not read {}: {}", class_id_filename, class_id_contents.error()); continue; } u32 class_id = read_hex_string_from_bytebuffer(class_id_contents.value()); - auto subclass_id_contents = subclass_id_file.value()->read_all(); + auto subclass_id_contents = subclass_id_file.value()->read_until_eof(); if (subclass_id_contents.is_error()) { dbgln("Error: Could not read {}: {}", subclass_id_filename, subclass_id_contents.error()); continue; @@ -183,7 +183,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) continue; } - auto bar_value_contents = bar_value_file.value()->read_all(); + auto bar_value_contents = bar_value_file.value()->read_until_eof(); if (bar_value_contents.is_error()) { dbgln("Error: Could not read {}: {}", bar_value_filename, bar_value_contents.error()); continue; diff --git a/Userland/Utilities/lsusb.cpp b/Userland/Utilities/lsusb.cpp index 473e33e845..f721a86420 100644 --- a/Userland/Utilities/lsusb.cpp +++ b/Userland/Utilities/lsusb.cpp @@ -54,7 +54,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) continue; } - auto contents = proc_usb_device.value()->read_all(); + auto contents = proc_usb_device.value()->read_until_eof(); if (contents.is_error()) { warnln("Failed to read {}: {}", full_path.string(), contents.error()); continue; diff --git a/Userland/Utilities/man.cpp b/Userland/Utilities/man.cpp index 7d0117496a..4ab40b9694 100644 --- a/Userland/Utilities/man.cpp +++ b/Userland/Utilities/man.cpp @@ -90,7 +90,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio proc")); dbgln("Loading man page from {}", TRY(page->path())); - auto buffer = TRY(file->read_all()); + auto buffer = TRY(file->read_until_eof()); auto source = DeprecatedString::copy(buffer); auto const title = TRY(String::from_utf8("SerenityOS manual"sv)); diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp index c4d438927c..e8eba49863 100644 --- a/Userland/Utilities/markdown-check.cpp +++ b/Userland/Utilities/markdown-check.cpp @@ -242,7 +242,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) } auto file = file_or_error.release_value(); - auto content_buffer_or_error = file->read_all(); + auto content_buffer_or_error = file->read_until_eof(); if (content_buffer_or_error.is_error()) { warnln("Failed to read {}: {}", path, file_or_error.error()); // Since this should never happen anyway, fail early. diff --git a/Userland/Utilities/md.cpp b/Userland/Utilities/md.cpp index 266175eb3e..a027043219 100644 --- a/Userland/Utilities/md.cpp +++ b/Userland/Utilities/md.cpp @@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio")); - auto buffer = TRY(file->read_all()); + auto buffer = TRY(file->read_until_eof()); dbgln("Read size {}", buffer.size()); auto input = DeprecatedString::copy(buffer); diff --git a/Userland/Utilities/mount.cpp b/Userland/Utilities/mount.cpp index bee21b39a0..21e731f58b 100644 --- a/Userland/Utilities/mount.cpp +++ b/Userland/Utilities/mount.cpp @@ -150,7 +150,7 @@ static ErrorOr<void> print_mounts() // Output info about currently mounted filesystems. auto df = TRY(Core::Stream::File::open("/sys/kernel/df"sv, Core::Stream::OpenMode::Read)); - auto content = TRY(df->read_all()); + auto content = TRY(df->read_until_eof()); auto json = TRY(JsonValue::from_string(content)); json.as_array().for_each([](auto& value) { diff --git a/Userland/Utilities/netstat.cpp b/Userland/Utilities/netstat.cpp index 50cdf124cc..c39a800acf 100644 --- a/Userland/Utilities/netstat.cpp +++ b/Userland/Utilities/netstat.cpp @@ -153,7 +153,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (!has_protocol_flag || flag_tcp) { auto file = TRY(Core::Stream::File::open("/sys/kernel/net/tcp"sv, Core::Stream::OpenMode::Read)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json_or_error = JsonValue::from_string(file_contents); if (json_or_error.is_error()) { warnln("Error: {}", json_or_error.error()); @@ -245,7 +245,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (!has_protocol_flag || flag_udp) { auto file = TRY(Core::Stream::File::open("/sys/kernel/net/udp"sv, Core::Stream::OpenMode::Read)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); Vector<JsonValue> sorted_regions = json.as_array().values(); diff --git a/Userland/Utilities/nologin.cpp b/Userland/Utilities/nologin.cpp index 0808b4ce37..8c187d9764 100644 --- a/Userland/Utilities/nologin.cpp +++ b/Userland/Utilities/nologin.cpp @@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments) if (file_or_error.is_error()) { outln("This account is currently not available."); } else { - auto message_from_file = TRY(file_or_error.value()->read_all()); + auto message_from_file = TRY(file_or_error.value()->read_until_eof()); out("{}", StringView { message_from_file }); } diff --git a/Userland/Utilities/nproc.cpp b/Userland/Utilities/nproc.cpp index f49bf86687..54f730fe7a 100644 --- a/Userland/Utilities/nproc.cpp +++ b/Userland/Utilities/nproc.cpp @@ -14,7 +14,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::pledge("stdio rpath")); auto file = TRY(Core::Stream::File::open("/sys/kernel/cpuinfo"sv, Core::Stream::OpenMode::Read)); - auto buffer = TRY(file->read_all()); + auto buffer = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(buffer)); auto const& cpuinfo_array = json.as_array(); outln("{}", cpuinfo_array.size()); diff --git a/Userland/Utilities/pmap.cpp b/Userland/Utilities/pmap.cpp index b38fcbbc20..c6060d5640 100644 --- a/Userland/Utilities/pmap.cpp +++ b/Userland/Utilities/pmap.cpp @@ -42,7 +42,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) outln("Address{} Size Access Name", padding); } - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); Vector<JsonValue> sorted_regions = json.as_array().values(); diff --git a/Userland/Utilities/route.cpp b/Userland/Utilities/route.cpp index 633bb58595..420ba50918 100644 --- a/Userland/Utilities/route.cpp +++ b/Userland/Utilities/route.cpp @@ -90,7 +90,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) if (modify_action.is_empty()) { auto file = TRY(Core::Stream::File::open("/sys/kernel/net/route"sv, Core::Stream::OpenMode::Read)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); outln("Kernel IP routing table"); diff --git a/Userland/Utilities/shuf.cpp b/Userland/Utilities/shuf.cpp index f291daab42..0583969e6b 100644 --- a/Userland/Utilities/shuf.cpp +++ b/Userland/Utilities/shuf.cpp @@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.parse(arguments); auto file = TRY(Core::Stream::File::open_file_or_standard_stream(path, Core::Stream::OpenMode::Read)); - ByteBuffer buffer = TRY(file->read_all()); + ByteBuffer buffer = TRY(file->read_until_eof()); u8 input_delimiter = is_zero_terminated ? '\0' : '\n'; Vector<Bytes> lines; diff --git a/Userland/Utilities/sysctl.cpp b/Userland/Utilities/sysctl.cpp index 25bda336c6..c234edbf85 100644 --- a/Userland/Utilities/sysctl.cpp +++ b/Userland/Utilities/sysctl.cpp @@ -20,7 +20,7 @@ static DeprecatedString get_variable(StringView name) warnln("Failed to open {}: {}", path, file.error()); return {}; } - auto buffer = file.value()->read_all(); + auto buffer = file.value()->read_until_eof(); if (buffer.is_error()) { warnln("Failed to read {}: {}", path, buffer.error()); return {}; diff --git a/Userland/Utilities/tail.cpp b/Userland/Utilities/tail.cpp index b5e8597fe4..2f71f45318 100644 --- a/Userland/Utilities/tail.cpp +++ b/Userland/Utilities/tail.cpp @@ -15,7 +15,7 @@ static ErrorOr<void> tail_from_pos(Core::Stream::File& file, off_t startline) { TRY(file.seek(startline + 1, Core::Stream::SeekMode::SetPosition)); - auto buffer = TRY(file.read_all()); + auto buffer = TRY(file.read_until_eof()); out("{}", StringView { buffer }); return {}; } @@ -70,7 +70,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) do { // FIXME: If f is the standard input, f->read_all() does not block // anymore after sending EOF (^D), despite f->is_open() returning true. - auto buffer = TRY(f->read_all(PAGE_SIZE)); + auto buffer = TRY(f->read_until_eof(PAGE_SIZE)); auto line_count = StringView(buffer).count("\n"sv); auto bytes = buffer.bytes(); size_t line_index = 0; @@ -108,7 +108,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto watcher = TRY(Core::FileWatcher::create()); watcher->on_change = [&](Core::FileWatcherEvent const& event) { if (event.type == Core::FileWatcherEvent::Type::ContentModified) { - auto buffer_or_error = f->read_all(); + auto buffer_or_error = f->read_until_eof(); if (buffer_or_error.is_error()) { auto error = buffer_or_error.error(); warnln(error.string_literal()); diff --git a/Userland/Utilities/test-fuzz.cpp b/Userland/Utilities/test-fuzz.cpp index 2a0b0c7bba..fea99e8686 100644 --- a/Userland/Utilities/test-fuzz.cpp +++ b/Userland/Utilities/test-fuzz.cpp @@ -152,7 +152,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto fn = parse_target_name(type); auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Read)); - auto input = TRY(file->read_all()); + auto input = TRY(file->read_until_eof()); return fn(input.data(), input.size()); } diff --git a/Userland/Utilities/utmpupdate.cpp b/Userland/Utilities/utmpupdate.cpp index 7c011243f1..b7eec59b13 100644 --- a/Userland/Utilities/utmpupdate.cpp +++ b/Userland/Utilities/utmpupdate.cpp @@ -44,7 +44,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto file = TRY(Core::Stream::File::open("/var/run/utmp"sv, Core::Stream::OpenMode::ReadWrite)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto previous_json = TRY(JsonValue::from_string(file_contents)); JsonObject json; diff --git a/Userland/Utilities/w.cpp b/Userland/Utilities/w.cpp index 5e3f0a7dc9..ca82674bc5 100644 --- a/Userland/Utilities/w.cpp +++ b/Userland/Utilities/w.cpp @@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::unveil(nullptr, nullptr)); auto file = TRY(Core::Stream::File::open("/var/run/utmp"sv, Core::Stream::OpenMode::Read)); - auto file_contents = TRY(file->read_all()); + auto file_contents = TRY(file->read_until_eof()); auto json = TRY(JsonValue::from_string(file_contents)); if (!json.is_object()) { warnln("Error: Could not parse /var/run/utmp"); diff --git a/Userland/Utilities/xml.cpp b/Userland/Utilities/xml.cpp index fc91876e3f..6ccd0b9f6d 100644 --- a/Userland/Utilities/xml.cpp +++ b/Userland/Utilities/xml.cpp @@ -372,7 +372,7 @@ static auto parse(StringView contents) return Error::from_string_literal("NYI: Nonlocal entity"); auto file = TRY(Core::Stream::File::open(url.path(), Core::Stream::OpenMode::Read)); - return DeprecatedString::copy(TRY(file->read_all())); + return DeprecatedString::copy(TRY(file->read_until_eof())); }, }, }; @@ -449,7 +449,7 @@ static void do_run_tests(XML::Document& document) warnln("Running test {}", url.path()); - auto contents = file_result.value()->read_all(); + auto contents = file_result.value()->read_until_eof(); if (contents.is_error()) { warnln("Read error for {}: {}", url.path(), contents.error()); s_test_results.set(url.path(), TestResult::RunnerFailed); @@ -474,7 +474,7 @@ static void do_run_tests(XML::Document& document) s_test_results.set(url.path(), TestResult::RunnerFailed); continue; } - auto contents = file_result.value()->read_all(); + auto contents = file_result.value()->read_until_eof(); if (contents.is_error()) { warnln("Read error for {}: {}", out_path, contents.error()); s_test_results.set(url.path(), TestResult::RunnerFailed); @@ -517,7 +517,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) s_path = Core::File::real_path_for(filename); auto file = TRY(Core::Stream::File::open(s_path, Core::Stream::OpenMode::Read)); - auto contents = TRY(file->read_all()); + auto contents = TRY(file->read_until_eof()); auto xml_parser = parse(contents); auto result = xml_parser.parse(); |