blob: 4e0947eacecb70d7363b6ac8009df49404dc3e66 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
namespace;
include rt, std;
// the command line and the environment, as the host hands them over. argv[0]
// is the program path, and <eval> when the source came from stdin, so argc is
// 1 even with nothing on the command line. run through a shell with no extra
// arguments, which is how test.sh calls it, so the line is fixed.
include std;
fn main() {
rt.put_n(std.argc); rt.put_c(32); rt.put_s(std.argv[0]);
rt.put_c(32); rt.put_c(32); rt.put_s(std.argv[std.argc - 1]);
// envc counts every entry, envp holds NAME=value strings
rt.put_c(32); rt.put_n(std.envc > 0);
let hit = 0;
for (int i = 0; i < std.envc; i++) if (rt.eq_w(std.envp[i], "ZC_ARG_TEST=ok")) hit = 1;
rt.put_c(32); rt.put_n(hit);
return 0;
}
|