~sircmpwn/powerctl

64efe1d46a0dc054fb6f1f1f1824cfcdf3cad18f — Ember Sawady 7 months ago 1c30fc7
update for hare stdlib changes
2 files changed, 6 insertions(+), 6 deletions(-)

M main.ha
M sysfs.ha
M main.ha => main.ha +5 -5
@@ 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);

M sysfs.ha => sysfs.ha +1 -1
@@ 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))?;
};