atattribute(3) | AtFS Toolkit Library | atattribute(3) |
atRetAttr, atSetAttr, atAttrName, atAttrValue, atAllAttrs, atFreeAttrs - attribute handling
#include <atfs.h>
#include <atfstk.h>
char* atRetAttr (Af_key *aso, char *attributeName);
void atFreeAttr (char *attributeValue);
int atSetAttr (Af_key *aso, char *attribute, int mode);
int atSetAttrFile (Af_key *aso, char *filename);
char* atAttrName (char *attribute);
char* atAttrValue (char *attribute);
int atMatchAttr (Af_key *aso, char *attribute);
The AtFS Toolkit Library extends the AtFS attribute handling. It introduces additional standard attribute names and a list of attribute value types.
atRetAttr returns a string representation of the value(s) of the aso attribute named attributeName. If the attribute value is preceded by a value special character (see list below), it will be evaluated accordingly. When the evaluation fails, the original attribute value, including value special character, is returned. When the attribute value is empty, an empty string is returned. When the attribute does not exist or on any other error condition, a null pointer is returned.
Attribute citations (like 7.0) in attribute values will always be expanded by atRetAttr. There is no way to disable attribute expansion. If you need the raw, unexpanded attribute value, use af_retattr (manual page af_attrs(3)).
The attribute value returned by atRetAttr either resides in static memory (in case of AtFS standard attributes) or in allocated memory. Use atFreeAttr on each attribute value returned by atRetAttr when this not needed any longer. This will recycle allocated memory if possible.
atSetAttr sets the attribute attribute for aso. It calls af_setattr (manual page af_attrs(3)) and hence understands the modes AF_ADD, AF_REMOVE, and AF_REPLACE. Alternatively, the mode argument is ignored, when the equal sign between attribute name and value is preceded by either a plus (+) or a minus (-) sign for adding and deleting attribute values. The value special character at (@) will also be evaluated. atSetAttr opens the file and reads its contents. If either the opening or reading fails, the attribute setting is aborted and returns FALSE. On successful execution, atSetAttr returns TRUE, otherwise FALSE.
atSetAttrFile evaluates a file containing attributes. If opens the named file (filename) and interprets each line in the file as attribute argument to atSetAttr.
atAttrName fills a static memory buffer with the name of the given attribute and returns a pointer to this buffer. Subsequent calls of atAttrName overwrite previous results.
atAttrValue returns a pointer to the value part of attribute.
atMatchAttr checks if aso has the given attribute. Result values are TRUE or FALSE. If just an attribute name is given, atMatchAttr returns a positive result if the attribute exists in the asos attribute list or, in the case that it is a standard attribute, if it's value is non null. A full attribute (name and value) must match an attribute in the asos attribute list. The value of the given attribute argument may be a (sh(1)) pattern.
Attributes have the general format name=value. Additionally, a plus or minus sign may precede and a value special character may follow the equal sign (<name>[+-]=[^@!*]<value>).
The following is the complete list of value special characters recognized by AtFStk.
There are a number of standard attributes defined by the AtFS toolkit library and by AtFS (Attribute Filesystem) for each ASO. For a list of the AtFS standard attributes see the af_attrs(3) manual page. This is a list of all standard attribute names defined in AtFStk.
Some other names are mapped to the appropriate AtFS standard name:
AtFStk name AtFS name (constant definition) AtFStk name AtFS name (constant definition) atime AF_ATTATIME revision AF_ATTREV author AF_ATTAUTHOR self AF_ATTBOUND ctime AF_ATTCTIME selfpath AF_ATTBOUNDPATH dsize AF_ATTDSIZE size AF_ATTSIZE generation AF_ATTGEN state AF_ATTSTATE host AF_ATTHOST stime AF_ATTSTIME lock AF_ATTLOCKER syspath AF_ATTSPATH ltime AF_ATTLTIME type AF_ATTTYPE mtime AF_ATTMTIME unixname AF_ATTUNIXNAME name AF_ATTNAME version AF_ATTVERSION owner AF_ATTOWNER
atSetAttr may also be used to set standard attributes where possible. Attributes that may be altered are
Attribute Mapped to AtFS function author af_chauthor (af_protect(3)) generation, revision, version af_svnum (af_version(3)) mode af_chmod (af_protect(3)) owner af_chowner (af_protect(3)) state af_sstate (af_version(3)) note af_snote (af_note(3))
On error, the atError variable is set to a nun null value, and atErrMsg holds a diagnostic message. atRetAttr returns a null pointer on error, or if the desired attribute does not exist. atSetAttr and atSetAttrFile return FALSE on any error condition. atMatchAttr returns FALSE if an error occurred or if the attribute does not match.
Tue Jun 29 16:16:22 1993 | AtFStk-1.12 |