access
access — checks a file for various permissions.
access (filename, mode)
filenameThe name of a file on disk.
modeThe file mode to be tested. The legal modes are discussed below.
Zero is returned if the access mode is valid,
otherwise -1 is returned and the errno is set.
This function checks a file for the following permissions. Two or more permissions in bitwise OR combinations can be checked at one time.
R_OK Test for read permission.
W_OK Test for write permission.
X_OK Test for execute permission.
F_OK Test for existence of file.
The library "const/Filesys.lsp" must be required to use the constants listed above.
Gamma>require_lisp("const/Filesys");"/usr/cogent/lib/const/Filesys.lsp"Gamma>system("touch /tmp/access_test");0Gamma>system("chmod a=rx /tmp/access_test");0Gamma>access("/tmp/access_test", R_OK|X_OK);0Gamma>access("/tmp/access_test", W_OK);-1Gamma>