Skip to content

Commit

Permalink
migrate to @org_iceboy_trunk//io:native-file
Browse files Browse the repository at this point in the history
  • Loading branch information
iceboy233 committed Jun 8, 2024
1 parent b8e4d16 commit c970e66
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ boost_deps()

git_repository(
name = "org_iceboy_trunk",
commit = "d15780f227aba09dafd471a9855beeb47e21e070",
commit = "0be2a93fa780f608f8bfffa48a5e0367a5c08605",
remote = "https://github.com/iceboy233/trunk.git",
)
4 changes: 2 additions & 2 deletions net/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cc_binary(
deps = [
"@org_iceboy_trunk//base:flags",
"@org_iceboy_trunk//base:logging",
"@org_iceboy_trunk//io:native-file",
"@org_iceboy_trunk//io:stream",
"@org_iceboy_trunk//io/posix:file",
"@org_iceboy_trunk//net:asio",
"@org_iceboy_trunk//net:asio-flags",
"@org_iceboy_trunk//net:blocking-result",
Expand Down Expand Up @@ -46,7 +46,7 @@ cc_binary(
"@org_iceboy_trunk//base:flags",
"@org_iceboy_trunk//base:logging",
"@org_iceboy_trunk//io:file-utils",
"@org_iceboy_trunk//io/posix:file",
"@org_iceboy_trunk//io:native-file",
"@org_iceboy_trunk//net:asio",
"@org_iceboy_trunk//net:blocking-result",
"@org_iceboy_trunk//net:endpoint",
Expand Down
4 changes: 2 additions & 2 deletions net/tools/icmp-scanner.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "base/flags.h"
#include "base/logging.h"
#include "io/posix/file.h"
#include "io/native-file.h"
#include "io/stream.h"
#include "net/asio.h"
#include "net/asio-flags.h"
Expand Down Expand Up @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
auto executor = io_context.get_executor();
IcmpClient icmp_client(executor, {});
steady_timer timer(executor);
io::OStream os(io::posix::stdout);
io::OStream os(io::std_output());
int64_t pending_requests = 0;
if (flags::from.is_v4()) {
address_v4_iterator first(flags::from.to_v4());
Expand Down
6 changes: 3 additions & 3 deletions net/tools/rpc-client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "base/logging.h"
#include "flatbuffers/idl.h"
#include "io/file-utils.h"
#include "io/posix/file.h"
#include "io/native-file.h"
#include "net/asio.h"
#include "net/blocking-result.h"
#include "net/endpoint.h"
Expand Down Expand Up @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) {
parser.Parse(schema.c_str());
parser.SetRootType(flags::request_type.c_str());
std::string request_json;
ec = read_to_end(io::posix::stdin, request_json);
ec = read_to_end(io::std_input(), request_json);
if (ec) {
LOG(fatal) << "read failed: " << ec;
return 1;
Expand Down Expand Up @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) {
<< std::get<0>(result.args());
return 1;
}
ec = write(io::posix::stdout, response_json);
ec = write(io::std_output(), response_json);
if (ec) {
LOG(fatal) << "write failed: " << ec;
return 1;
Expand Down
2 changes: 1 addition & 1 deletion sys/tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ cc_binary(
"@com_google_absl//absl/strings",
"@org_iceboy_trunk//base:flags",
"@org_iceboy_trunk//io:file-utils",
"@org_iceboy_trunk//io/posix:file",
"@org_iceboy_trunk//io:native-file",
]
)
10 changes: 5 additions & 5 deletions sys/tools/base64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "absl/strings/escaping.h"
#include "base/flags.h"
#include "io/file-utils.h"
#include "io/posix/file.h"
#include "io/native-file.h"

DEFINE_FLAG(bool, d, false, "Decode.");
DEFINE_FLAG(bool, url, false, "Use URL encoding.");
Expand All @@ -20,7 +20,7 @@ std::error_code encode() {

size_t size;
do {
std::error_code ec = read(io::posix::stdin, src, size);
std::error_code ec = read(io::std_input(), src, size);
if (ec) {
return ec;
}
Expand All @@ -29,7 +29,7 @@ std::error_code encode() {
} else {
absl::WebSafeBase64Escape({src.data(), size}, &dest);
}
ec = write(io::posix::stdout, dest);
ec = write(io::std_output(), dest);
if (ec) {
return ec;
}
Expand All @@ -44,7 +44,7 @@ std::error_code decode() {

size_t size;
do {
std::error_code ec = read(io::posix::stdin, src, size);
std::error_code ec = read(io::std_input(), src, size);
if (ec) {
return ec;
}
Expand All @@ -57,7 +57,7 @@ std::error_code decode() {
if (!success) {
return make_error_code(std::errc::bad_message);
}
ec = write(io::posix::stdout, dest);
ec = write(io::std_output(), dest);
if (ec) {
return ec;
}
Expand Down

0 comments on commit c970e66

Please sign in to comment.