STAT
NAME
stat - Used to stat a file.
SYNOPSIS
stat([error:variable], "filename");
DESCRIPTION
This function is used to stat a file.
PARAMETERS
Here is the list of parameters:
- ERROR
- If an error occured while trying to stat te file, the errcode and errmsg will be put in this associative array. If no error occur, errcode will be zero.
- INCLUDES
- The file extenso.sn contains the following definitions for this functions:
{_{
// Definitions for function stat
%define FILE_SOURCE_PERMS 0x1000; // Copy source file's permissions
// Definitions for set file permissions
%define USETID 0x8000; /* Set user id */
%define UREAD 0x0400; /* Read by user */
%define UWRITE 0x0200; /* Write by user */
%define UEXECUTE 0x0100; /* Execute by user */
%define GSETID 0x4000; /* Set group id */
%define GREAD 0x0040; /* Read by group */
%define GWRITE 0x0020; /* Write by group */
%define GEXECUTE 0x0010; /* Execute by group */
%define WSTICKY 0x2000; /* Sticky bit */
%define WREAD 0x0004; /* Read by others */
%define WWRITE 0x0002; /* Write by others */
%define WEXECUTE 0x0001; /* Execute by others */
%define OS_DEFAULT 0x0FFF; /* use OS's default permissions */
}}
EXAMPLES
Note: In the followings examples, the _ between the { should be removed to make it work.
res={_{ a=stat("/time"); datetime(date:a.atime, format:"%Y");}}. return res=2013.
res={_{ a=stat("/time"); datetime(date:a.mtime);}}. return res=2013-06-01 18:20:38.
res={_{ a=stat("/time"); datetime(date:a.ctime);}}. return res=2013-06-01 18:21:41.
res={_{ a=stat("/time"); a.size;}}. return res=23.
res={_{ a=stat("/time"); a.csize;}}. return res=4096.
res={_{ a=stat("/time"); a.file;}}. return res=/time.
res={_{ a=stat("/time"); a.path;}}. return res=/usr/local/website/v5/time.
res={_{ a=stat("/time"); a.filetype;}}. return res=reg.
res={_{ a=stat("/"); a.filetype;}}. return res=dir.
res={_{ a=stat("/xyxy"); a.filetype;}}. return .*No such file or directory.*
res={_{ a=stat("/xyxy",error:x); x;}}. return .*No such file or directory.*
res={_{ a=stat("/",error:x); x.errcode;}}. return res=0.
test(_{asm => "-a"},q(res={_{
%include "/includes/extenso.sn";
a=stat("/time");
a.fileperms & STAT_UWRITE;
printf("%x", a.fileperms);}}. return res=512644.
res={_{ a=stat("/time"); a.user;}}. return res=99.
res={_{ a=stat("/time"); a.group;}}. return res=99.
res={_{ a=stat("/time"); a.inode;}}. return res=72119.
res={_{ a=stat("/time"); a.device;}}. return res=2058.
res={_{ a=stat("/time"); a.nlink;}}. return res=1.
res={_{ a=stat("/time"); a.fname;}}. return res=/usr/local/website/v5/time.
SEE ALSO
{{ include("includes/files.sn") }}
AUTHOR
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
MODIFICATIONS
1.0 2014-09-09 21:24:14 laplante@sednove.com
Edit