commit 59018df6414bb3bc7c2a0b2220ba8fab58c656c3
parent 08eaec1c4b7c3e1c392dd6217aaefeb39ac59c98
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 28 Oct 2023 02:35:03 -0400
shlex: add strerror
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/shlex/split.ha b/shlex/split.ha
@@ -8,6 +8,9 @@ use strings;
// Invalid shell syntax.
export type syntaxerr = !void;
+// Converts an error into a human-friendly string.
+export fn strerror(err: syntaxerr) str = "Invalid shell syntax";
+
// Splits a string of arguments according to shell quoting. The result must be
// freed using [[strings::freeall]] when the caller is done processing it.
export fn split(in: const str) ([]str | syntaxerr) = {