X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=psis%2Fstat.psi;fp=psis%2Fstat.psi;h=e5d8eba135b6e22a4052ca4e90c550332db44f84;hp=0000000000000000000000000000000000000000;hb=6a8a77b52b636041de54d1022016b4f2aa510c05;hpb=596f215b67dd267284df4fe0e11f0ca4d197bfc1 diff --git a/psis/stat.psi b/psis/stat.psi new file mode 100644 index 0000000..e5d8eba --- /dev/null +++ b/psis/stat.psi @@ -0,0 +1,48 @@ +extern int stat(char *path, struct stat *buf); +function psi\stat(string $path, array &$buf = NULL) : int { + let path = strval($path); + let buf = calloc(1, struct stat); + return to_int(stat); + set $buf = to_array(*buf, + to_int(st_dev), + to_int(st_ino), + to_int(st_mode), + to_int(st_nlink), + to_int(st_uid), + to_int(st_gid), + to_int(st_rdev), + to_int(st_size), + to_array(st_atim, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_atimespec, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_mtim, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_mtimespec, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_ctim, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_ctimespec, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_array(st_birthtimespec, + to_int(tv_sec), + to_int(tv_nsec) + ), + to_int(st_blksize), + to_int(st_blocks), + to_int(st_flags), + to_int(st_gen) + ); +}