From b9cf4251f8dcd843bba3a984ac87950fc78eb7f3 Mon Sep 17 00:00:00 2001 From: Julian Hurst Date: Fri, 16 Dec 2022 11:12:47 +0100 Subject: Add support for nul terminated output --- main.ha | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'main.ha') diff --git a/main.ha b/main.ha index 40718e6..467f773 100644 --- a/main.ha +++ b/main.ha @@ -11,12 +11,15 @@ use unix::tty; use unix::signal; use unix::poll; use errors; +use getopt; let u: mainUI = mainUI {...}; let searchterm: str = ""; let searchforward: bool = true; +let nulterm: bool = false; + type mainUI = struct { list: *list::listwidget, }; @@ -72,6 +75,20 @@ fn resize(list: *list::listwidget) void = { }; export fn main() void = { + const cmd = getopt::parse(os::args, + "interactive list", + ('0', "NUL terminated output") + ); + defer getopt::finish(&cmd); + + for (let i = 0z; i < len(cmd.opts); i += 1) { + const opt = cmd.opts[i]; + switch (opt.0) { + case '0' => + nulterm = true; + }; + }; + let in = match (io::drain(os::stdin)) { case let in: []u8 => yield in; -- cgit v1.2.3