.ig Copyright (C) 1993,1994 by the author(s). This software is published in the hope that it will be useful, but WITHOUT ANY WARRANTY for any part of this software to work correctly or as described in the manuals. See the ShapeTools Public License for details. Permission is granted to use, copy, modify, or distribute any part of this software but only under the conditions described in the ShapeTools Public License. A copy of this license is supposed to have been given to you along with ShapeTools in a file named LICENSE. Among other things, this copyright notice and the Public License must be preserved on all copies. Author: Andreas Lampen (Andreas.Lampen@cs.tu-berlin.de) $Header: af_attrs.3[7.0] Fri Jun 25 14:33:00 1993 andy@cs.tu-berlin.de frozen $ .. .TH af_attrs 3 "Fri Jun 25 14:33:00 1993" "AtFS-1.71" "Attribute Filesystem (AtFS)" .SH NAME af_retattr, af_retnumattr, af_retuserattr, af_rettimeattr, af_setattr, af_allattrs, af_isstdval, af_freeattr, af_freeattrbuf \- AtFS attribute handling .SH SYNOPSIS #include .sp .ta 1.5c char *af_retattr (Af_key *aso, char *attrName) .sp int af_retnumattr (Af_key *aso, char *attrName) .sp Af_user af_retuserattr (Af_key *aso, char *attrName) .sp time_t af_rettimeattr (Af_key *aso, char *attrName) .sp int af_setattr (Af_key *aso, int mode, char *attrName) .sp int af_allattrs (Af_key *aso, Af_attrs *attrBuf) .sp void af_freeattr (char *attrValue); .sp void af_freeattrbuf (Af_attrs *attrBuf); .sp int af_isstdval (char *attrValue); .sp .SH DESCRIPTION \fIaf_retattr\fP returns the value of any ASO attribute in string representation. The \fIattrName\fP argument denotes either a standard attribute (according to the list below) or a user defined attribute. Standard attributes are converted to a meaningful string representation if necessary. If the attribute name given to af_retattr contains an equal sign (this may be the case with user defined attributes), only the part before the equal sign will be interpreted as name. If the named attribute is a user defined attribute carrying multiple values, these will be returned in \fIone\fP string, with the values separated by newline ('\en') characters. If the named attribute does not exist, af_retattr returns a null pointer. If the value is empty, an empty string is returned. \fBNote:\fP The result string of af_retattr may reside in static memory which is overwritten on subsequent calls of af_retattr. .LP \fIaf_retnumattr\fP, \fIaf_retuserattr\fP, and \fIaf_rettimeattr\fP return the value of the named attribute as integer, user structure or time value. These functions only apply to standard attributes with a matching type. .LP \fIAf_setattr\fP sets, modifies, or deletes user defined attributes of the ASO identified by \fIaso\fP. The \fIattr\fR parameter is a string of the form: \fIname=value\fP. The name may consist of any characters (even non\-printable) but it may not contain Ctrl-A (\e001) characters. The first equal sign that appears in the string is interpreted as the delimiter between name and value. If the string does not contain an equal sign, it is interpreted as just an attribute name without value. The \fImode\fR parameter is one of the following: .TP 2.5c AF_ADD Attach the given attribute to the identified ASO. If an attribute with the given name already exists, add just the value to the existing attribute. Subsequent calls of af_setattr with the same attribute name construct attributes with multiple (any number) values. .TP AF_REMOVE Remove the named attribute. This mode requires only the attribute name to be given as attr parameter. Removal of single values is not supported. .TP AF_REPLACE Replace an existing user defined attribute. The replacement fails, if no attribute with the given name exists. .LP \fIaf_allattrs\fP returns the complete attribute buffer (\fIattrBuf\fP) of the ASO identified by \fIaso\fP including standard and user defined attributes. The af_retrieve(3) manual page shows the structure of the attribute buffer. .LP \fIaf_freeattr\fP and \fIaf_freeattrbuf\fP release memory eventually allocated during a af_retattr or af_allattrs call. As the result of af_retattr may reside either in static or dynamic (malloc(3)) memory, you should not use free(3) for releasing attribute value memory. .LP \fIaf_isstdval\fP returns TRUE if the given \fIattrValue\fP string is the return value of an af_retattr call where the result was written to static rather than allocated memory. Otherwise it returns FALSE. .SH AtFS STANDARD ATTRIBUTES The following is an alphabetically ordered list of all known standard attributes. AF_ATT... are string constants that may be used as \fIattrName\fP argument for any of the function calls described on this manual page. In parenthesis behind each symbolic constant, the type of the attribute is shown. .TP 4.5c AF_ATTAUTHOR (user) The versions author. .TP AF_ATTATIME (time) The date of last access (read or write) to the version contents. .TP AF_ATTBOUND (string) The version name in bound version notation (e.g. \fIfoo.c[1.2]\fP). .TP AF_ATTBOUNDPATH (string) Absolute pathname of the version in bound version notation (e.g. \fI/usr/andy/foo.c[1.2]\fP). .TP AF_ATTCTIME (time) The date of last status change. Updated, when an attributes value is changed. .TP AF_ATTDSIZE (numeric) The size of the delta if there is any. If the version is not stored as delta, -1 is returned. .TP AF_ATTGEN (numeric) The generation number. .TP AF_ATTHOST (string) The host from where the version was accessed (this attribute is quite useless, as this is always the current host). .TP AF_ATTLOCKER (user) The user who has set a lock on the version (if any). .TP AF_ATTLTIME (time) The date of last lock change. This is empty, when there was never a lock set. .TP AF_ATTMODE (numeric) The version file type and protection. Same as st_mode in struct stat (see stat(2)). .TP AF_ATTMTIME (time) The date of the last contents modification. .TP AF_ATTNAME (string) The AtFS name of the version. This has the filename extension, if there is any, stripped off. .TP AF_ATTOWNER (user) The versions owner. .TP AF_ATTREV (numeric) The revision number. .TP AF_ATTSIZE (numeric) The file size. This may be independent of the real storage size, as most saved versions are stored as deltas (see also AF_ATTDSIZE). .TP AF_ATTSPATH (string) The UNIX pathname leading to the version. This may be different when accessing the version from different hosts. .TP AF_ATTSTATE (numeric) The version state. States are numbered 0 trough 5 from \fIbusy\fP to \fIfrozen\fP. .TP AF_ATTSTIME (time) The save date. This date is not set for busy versions. .TP AF_ATTTYPE (string) The filename extension (the string behind the rightmost period in the versions full name). See af_misc(3) for details. .TP AF_ATTUNIXNAME (string) The full UNIX name (without path). .TP AF_ATTUNIXPATH (string) The full UNIX path. .TP AF_ATTVERSION (string) The complete version number \fIgeneration.revision\fP . .SH SEE ALSO stat(2), free(3), af_misc(3), af_retrieve(3) .SH DIAGNOSTICS Upon error, \-1 or a nil pointer (depending on the return type) is returned and \fIaf_errno\fP is set to the corresponding error number. .SH LIMITS Although AtFS promises the storage of an arbitrary number of user defined attributes, the current implementation limits their number to 255. af_setattr sets the corresponding error condition if the limit is reached.