~tomterl/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH thp] bufio::scan* => bufio::read*

Carlos Une <une@fastmail.fm>
Details
Message ID
<20230909183240.32867-1-une@fastmail.fm>
DKIM signature
missing
Download raw message
Patch: +5 -5
---
 cmd/thp/main.ha       | 2 +-
 cmd/thpd/main.ha      | 6 +++---
 mods/uptime+uptime.ha | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmd/thp/main.ha b/cmd/thp/main.ha
index 767d49c..cb08db0 100644
--- a/cmd/thp/main.ha
+++ b/cmd/thp/main.ha
@@ -122,7 +122,7 @@ export fn main() void = {
		};
		fmt::fprintln(sock, spec)!;
		// handle server response
		match(bufio::scanline(sock)) {
		match(bufio::read_line(sock)) {
		case let u: []u8 =>
			const prompt = strings::fromutf8(u)!;
			defer free(prompt);
diff --git a/cmd/thpd/main.ha b/cmd/thpd/main.ha
index 89c2dd8..07be64f 100644
--- a/cmd/thpd/main.ha
+++ b/cmd/thpd/main.ha
@@ -125,7 +125,7 @@ export fn main() void = {
fn serve(client: io::file, pe: *env::env) bool = {
	for(true) {
		const start = time::now(0: time::clock);
		const pwd: str = match(bufio::scanline(client)) {
		const pwd: str = match(bufio::read_line(client)) {
		case let u: []u8 =>
			if (len(u)==1 && u[0] == 'q') { free(u); break; };
			yield match(strings::fromutf8(u)) {
@@ -141,7 +141,7 @@ fn serve(client: io::file, pe: *env::env) bool = {
		};
		const pwd = strings::split(pwd, "/:/");
		defer free(pwd);
		const control: *env::control = match(bufio::scanline(client)) {
		const control: *env::control = match(bufio::read_line(client)) {
		case let u: []u8 =>
			defer free(u);
			yield match(env::getctrl(u)) {
@@ -157,7 +157,7 @@ fn serve(client: io::file, pe: *env::env) bool = {
			log::println("reloading config");
			config::load();
		};
		const pd: str = match(bufio::scanline(client)) {
		const pd: str = match(bufio::read_line(client)) {
		case let u: []u8 =>
			yield match(strings::fromutf8(u)) {
			case let s: str => yield s;
diff --git a/mods/uptime+uptime.ha b/mods/uptime+uptime.ha
index 8d3e3b8..0f29b53 100644
--- a/mods/uptime+uptime.ha
+++ b/mods/uptime+uptime.ha
@@ -29,7 +29,7 @@ export fn mod_uptime(pe: *env::env) str = {
	};
	defer io::close(file)!;

	let buf = match(bufio::scantok(file, '.')) {
	let buf = match(bufio::read_tok(file, '.')) {
	case let e: io::error =>
		return io::strerror(e);
	case io::EOF =>
-- 
2.39.2
Reply to thread Export thread (mbox)