diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-09-22 18:06:51 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-09-22 18:06:51 +0200 |
| commit | 676586f2034ff112b309dccc430893d73e919191 (patch) | |
| tree | 2571918ca87edde3fcb4cd5955a6051d535d57fa /ttwhy | |
| parent | 1212a302b500c37420613086a1b85f0659f09d57 (diff) | |
| download | ttwhy-676586f2034ff112b309dccc430893d73e919191.tar.xz ttwhy-676586f2034ff112b309dccc430893d73e919191.zip | |
apps: extract applications
Diffstat (limited to 'ttwhy')
| -rw-r--r-- | ttwhy/main.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/ttwhy/main.cpp b/ttwhy/main.cpp deleted file mode 100644 index ab635a7..0000000 --- a/ttwhy/main.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include <asio.hpp> -#include <asio/experimental/awaitable_operators.hpp> - -#include <stdio.h> - -import ttwhy.io; -import ttwhy.routers; - -auto app(int in, int out, int error) -> asio::awaitable<void> -{ - using namespace asio::experimental::awaitable_operators; - - auto terminal_attributes = ttwhy::io::scoped_attributes{fileno(stdin)} // - .canonical_mode(false) - .echo(false); - - auto executor = co_await asio::this_coro::executor; - - auto input_stream = asio::posix::stream_descriptor{executor, in}; - auto output_stream = asio::posix::stream_descriptor{executor, out}; - auto error_stream = asio::posix::stream_descriptor{executor, error}; - - auto router = ttwhy::routers::echo{output_stream}; - - co_await (ttwhy::io::handle_signals(error_stream, terminal_attributes) || - ttwhy::io::read_events(input_stream, router)); -} - -auto main() -> int -{ - auto context = asio::io_context{}; - - asio::co_spawn(context, app(::fileno(::stdin), ::fileno(::stdout), ::fileno(::stderr)), asio::detached); - - context.run(); -} |
