~sircmpwn/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] Fix getopts and fs::flag to match latest Hare changes

Details
Message ID
<20230915183625.3289-2-porcellis@eletrotupi.com>
DKIM signature
missing
Download raw message
Patch: +6 -6
---
It would be nice if you could release a new version containing
these fixes, so I could package downstream.

 main.ha  | 10 +++++-----
 sysfs.ha |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/main.ha b/main.ha
index 9e80e9a..0a59752 100644
--- a/main.ha
+++ b/main.ha
@@ -44,7 +44,7 @@ export fn main() void = {

	if (op == operation::QUERY) {
		if (len(cmd.args) != 0) {
			getopt::printhelp(os::stderr, "powerctl", help...);
			getopt::printhelp(os::stderr, "powerctl", help...)!;
			os::exit(1);
		};

@@ -64,7 +64,7 @@ export fn main() void = {
	};

	if (len(cmd.args) != 1) {
		getopt::printhelp(os::stderr, "powerctl", help...);
		getopt::printhelp(os::stderr, "powerctl", help...)!;
		os::exit(1);
	};

@@ -76,7 +76,7 @@ export fn main() void = {
		case let state: disk_state =>
			yield state;
		case errors::invalid =>
			getopt::printhelp(os::stderr, "powerctl", help...);
			getopt::printhelp(os::stderr, "powerctl", help...)!;
			os::exit(1);
		};
		const result = set_disk_state(state);
@@ -95,7 +95,7 @@ export fn main() void = {
		case let state: mem_state =>
			yield state;
		case errors::invalid =>
			getopt::printhelp(os::stderr, "powerctl", help...);
			getopt::printhelp(os::stderr, "powerctl", help...)!;
			os::exit(1);
		};
		const result = set_mem_state(state);
@@ -105,7 +105,7 @@ export fn main() void = {
		case let state: sleep_state =>
			yield state;
		case errors::invalid =>
			getopt::printhelp(os::stderr, "powerctl", help...);
			getopt::printhelp(os::stderr, "powerctl", help...)!;
			os::exit(1);
		};
		const result = set_sleep_state(state);
diff --git a/sysfs.ha b/sysfs.ha
index 3473086..df7f373 100644
--- a/sysfs.ha
+++ b/sysfs.ha
@@ -46,7 +46,7 @@ fn read_states(path: str) (strings::tokenizer | fs::error | io::error) = {
};

fn write_sysfs_file(path: str, content: str) (void | fs::error | io::error) = {
	const file = os::open(path, fs::flags::WRONLY | fs::flags::TRUNC)?;
	const file = os::open(path, fs::flag::WRONLY | fs::flag::TRUNC)?;
	defer io::close(file)!;
	io::write(file, strings::toutf8(content))?;
};
-- 
2.42.0
Reply to thread Export thread (mbox)