From ecc350ca5c2eb50be8309c5f14f8bf0d87db9a02 Mon Sep 17 00:00:00 2001 From: Moon Flower Date: Mon, 12 Oct 2026 08:46:23 +0330 Subject: a --- examples/cli.zc | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/cli.zc (limited to 'examples/cli.zc') diff --git a/examples/cli.zc b/examples/cli.zc new file mode 100644 index 0000000..113a0da --- /dev/null +++ b/examples/cli.zc @@ -0,0 +1,12 @@ +// print the length and first character of the file named by ZC_FILE +include "src/lib/std.zc"; +fn main() { + let name[80], s, n; + n = Host.env("ZC_FILE", name, 80); + if (n < 0) { put_s("no file\n"); return 1; } + s = readfile(name); + if (!s) { put_s("can't read\n"); return 1; } + put_n(len_w(s)); put_c(' '); put_c(s[0]); put_c(10); + free(d*s); + return 0; +} -- cgit v1.2.3