diff options
| author | 2026-10-12 08:46:23 +0330 | |
|---|---|---|
| committer | 2026-10-12 08:46:23 +0330 | |
| commit | ecc350ca5c2eb50be8309c5f14f8bf0d87db9a02 (patch) | |
| tree | 70e0af76a1b13affff7c6cc8aac7b3e6ef960478 /examples/cli.zc | |
a
Diffstat (limited to 'examples/cli.zc')
| -rw-r--r-- | examples/cli.zc | 12 |
1 files changed, 12 insertions, 0 deletions
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; +} |
