OSICAT 0.5.0
Osicat is a lightweight operating system interface for Common Lisp on Unix-platforms. It is not a POSIX-style API, but rather a simple lispy accompaniment to the standard ANSI facilities.
Osicat homepage:
http://www.common-lisp.net/project/osicat/
- Concepts
Designated directory
When a relative pathname designator is used as a directory designator it is first resolved agains default-pathname-default, and then against the current directory. (With MERGE-PATHNAMES in both cases.)
---
- Dictionary
-
- osicat-version
- absolute-pathname
- absolute-pathname-p
- current-directory
- delete-directory
- environment
- environment-variable
- file-kind
- file-permissions
- make-link
- makunbound-environment-variable
- mapdir
- open-temporary-file
- read-link
- relative-pathname-p
- unmerge-pathnames
- user-info
- with-directory-iterator
- with-temporary-file
---
variable OSICAT-VERSION
Osicat version number represented as a list of three integers. The three integers represent major, minor, and revision versions.
---
function ABSOLUTE-PATHNAME pathspec &optional default => pathname
Returns an absolute pathname corresponding to pathspec by merging it with default, and (current-directory) if necessary.
---
function ABSOLUTE-PATHNAME-P pathspec => boolean
Returns T if the pathspec designates an absolute pathname, NIL otherwise.
---
function CURRENT-DIRECTORY => pathname
function (SETF CURRENT-DIRECTORY) pathspec => pathspec
CURRENT-DIRECTORY returns the operating system's current directory, which may or may not correspond to DEFAULT-PATHNAME-DEFAULTS.
SETF CURRENT-DIRECTORY changes the operating system's current directory to the pathspec. An error is signalled if the pathspec is wild or does not designate a directory.
---
function DELETE-DIRECTORY pathspec => T
Deletes the directory designated by pathspec. Returns T. The directory must be empty. Symbolic links are not followed.
Signals an error if pathspec is wild, doesn't designate a directory, or if the directory could not be deleted.
---
function ENVIRONMENT => alist
function (SETF ENVIRONMENT) alist => alist
ENVIRONMENT return the current environment as an assoc-list. SETF ENVIRONMENT modifies the environment its argument.
Often it is preferable to use SETF ENVIRONMENT-VARIABLE and MAKUNBOUND-ENVIRONMENT-VARIABLE to modify the environment instead of SETF ENVIRONMENT.
---
function ENVIRONMENT-VARIABLE name => string function (SETF (ENVIRONMENT-VARIABLE name) value) => value
ENVIRONMENT-VARIABLE returns the environment variable identified by name, or NIL if one does not exist. Name can either be a symbol or a string.
SETF ENVIRONMENT-VARIABLE sets the environment variable identified by name to value. Both name and value can be either a symbols or strings. Signals an error on failure.
---
function FILE-KIND pathspec => file-kind
Returns a keyword indicating the kind of file designated by pathspec, or NIL if the file does not exist. Does not follow symbolic links.
Possible file-kinds in addition to NIL are: :regular-file, :symbolic-link, :directory,:pipe, :socket, :character-device, and :block-device.
Signals an error if pathspec is wild.
---
function FILE-PERMISSIONS pathspec => list function (SETF (FILE-PERMISSIONS pathspec) list) => list
FILE-PERMISSIONS returns a list of keywords identifying the permissions of pathspec.
SETF FILE-PERMISSIONS sets the permissions of pathspec as identified by the symbols in list.
If pathspec designates a symbolic link, that link is implicitly resolved.
Permission symbols consist of :user-read, :user-write, :user-exec, :group-read, :group-write, :group-exec, :other-read, :other-write, :other-exec, :set-user-id, :set-group-id, and :sticky.
Both signal an error is pathspec is wild, or doesn't designate an exiting file.
---
function MAKE-LINK link &key target hard => pathname
Creates link that points to target. Defaults to a symbolic link, but giving a non-NIL value to the keyword argument :HARD creates a hard link. Returns the pathname of the link.
Relative targets are resolved against the link. Relative links are resolved against default-pathname-defaults.
Signals an error if either target or link is wild, target does not exist, or link exists already.
---
function MAKUNBOUND-ENVIRONMENT-VARIABLE name => string
Removes the environment variable identified by name from the current environment. name can be either a string or a symbol. Returns the string designated by name. Signals an error on failure.
---
function MAPDIR function pathspec => list
Applies function to each entry in directory designated by pathspec in turn and returns a list of the results. Binds default-pathname-defaults to the directory designated by pathspec round to function call.
If pathspec designates a symbolic link, it is implicitly resolved.
Signals an error if pathspec is wild or doesn't designate a directory.
---
function OPEN-TEMPORARY-FILE (&key element-type) => stream
Creates a temporary file setup for input and output, and returns a stream connected to that file. The file itself is unlinked once it has been opened. ELEMENT-TYPE specifies the unit of transaction of the stream. Consider using WITH-TEMPORARY-FILE instead of this function.
On failure, a FILE-ERROR may be signalled.
---
function READ-LINK pathspec => pathname
Returns the pathname pointed to by the symbolic link designated by pathspec. If the link is relative, then the returned pathname is relative to the link, not default-pathname-defaults.
Signals an error if pathspec is wild, or does not designate a symbolic link.
---
function RELATIVE-PATHNAME-p pathspec => boolean
Returns T if the pathspec designates a relative pathname, NIL otherwise.
---
function UNMERGE-PATHNAMES pathspec &optional default => pathname
Removes those leading directory components from pathspec that are shared with default.
---
function USER-INFO name => alist
function USER-INFO user-id => alist
USER-INFO returns the password entry for the given name or numerical user ID, as an assoc-list.
---
macro WITH-DIRECTORY-ITERATOR (iterator pathspec) &body forms => value
Pathspec must be a valid directory designator: default-pathname-defaults is bound, and (current-directory) is set to the designated directory for the dynamic scope of the body.
Within the lexical scope of the body, iterator is defined via macrolet such that successive invocations of (iterator) return the directory entries, one by one. Both files and directories are returned, except '.' and '..'. The order of entries is not guaranteed. The entries are returned as relative pathnames against the designated directory. Entries that are symbolic links are not resolved, but links that point to directories are interpreted as directory designators. Once all entries have been returned, further invocations of (iterator) will all return NIL.
The value returned is the value of the last form evaluated in body. Signals an error if pathspec is wild or does not designate a directory.
---
macro WITH-TEMPORARY-FILE (stream &key element-type) &body body => stream
Within the lexical scope of the body, stream is connected to a temporary file as created by OPEN-TEMPORARY-FILE. The file is closed automatically once BODY exits.
