add malloc stubs
[m6w6/ext-psi] / psi.d / glob.psi
1 function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $errfn = NULL) : int {
2 let path = strval($pattern);
3 let flags = intval($flags);
4 let err = callback intval($errfn(
5 to_string(epath),
6 to_int(eerrno)
7 ));
8 let buf = &arrval($glob,
9 intval($gl_matchc),
10 intval($gl_pathc),
11 intval($gl_offs),
12 intval($gl_flags),
13 &arrval($gl_pathv,
14 strval($gl_pathv)
15 )
16 );
17 return to_int(glob);
18 set $glob = to_array(*buf,
19 to_int(gl_matchc),
20 to_int(gl_pathc),
21 to_int(gl_offs),
22 to_int(gl_flags),
23 to_array(*gl_pathv, gl_pathc + gl_offs, to_string(*gl_pathv))
24 );
25 }