X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=psi.d%2Fglob.psi;h=d0c62cbd16a856bfbe13a2afdfbfa0cd23e2b7aa;hp=f4a762a729e1a0bfbac6e1877954d12abf449486;hb=fecb0372ee8e219a7ebd51406dee3e1008ccb7ec;hpb=9bcb1df0786a8193d65949c857baaba2f4296e84 diff --git a/psi.d/glob.psi b/psi.d/glob.psi index f4a762a..d0c62cb 100644 --- a/psi.d/glob.psi +++ b/psi.d/glob.psi @@ -1,7 +1,12 @@ +#include + function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $errfn = NULL) : int { let path = strval($pattern); let flags = intval($flags); - let err = callback intval($errfn( + let err = callback( + epath, + eerrno + ) as intval($errfn( to_string(epath), to_int(eerrno) )); @@ -14,7 +19,7 @@ function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $er strval($gl_pathv) ) ); - return to_int(glob); + return glob(path, flags, err, buf) as to_int(glob); set $glob = to_array(*buf, to_int(gl_matchc), to_int(gl_pathc), @@ -22,5 +27,4 @@ function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $er to_int(gl_flags), to_array(*gl_pathv, gl_pathc + gl_offs, to_string(*gl_pathv)) ); - free globfree(buf); }