diff options
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; +} |
