blob: 1ea0e6a4aa0f9c0348c7f2f7d95f2f74ee9a4c62 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
namespace;
include rt, std;
// print the length and first character of the file named by ZC_FILE
include std;
fn main() {
let name[80], s, n;
n = std.Host.env("ZC_FILE", name, 80);
if (n < 0) { rt.put_s("no file\n"); return 1; }
s = rt.readfile(name);
if (!s) { rt.put_s("can't read\n"); return 1; }
rt.put_n(rt.len_w(s)); rt.put_c(' '); rt.put_c(s[0]); rt.put_c(10);
rt.free(s);
return 0;
}
|