Manual Page Result
0
Command: get_proplist_entry | Section: 3 | Source: Digital UNIX | File: get_proplist_entry.3.gz
get_proplist_entry(3) Library Functions Manual get_proplist_entry(3)
NAME
get_proplist_entry - Initializes pointers to the corresponding entries
in an Extended File Attribute buffer
SYNOPSIS
#include <sys/proplist.h> int get_proplist_entry ( char **name,
int **flags, int **value_size, char **value, char
**bufptr );
PARAMETERS
Points to the Extended File Attribute name.
Points to the system-wide file attributes for Extended File At-
tribute entries in the Property List.
Points to the size in bytes of the Extended File Attribute
value.
Points to the Extended File Attribute value.
Points to the Extended File Attribute buffer.
DESCRIPTION
The get_proplist_entry function initializes the **name, **value_size,
and **value parameters with the corresponding values in the Extended
File Attribute buffer pointed to by **bufptr. The function can be
called repeatedly, because it advances the Extended File Attribute
buffer pointer **bufptr to the end of the current entry. An Extended
File Attribute is a name and value pair that is contained in a vari-
able-sized structure called a Property List. A Property List is part
of a file's metadata and can contain abstract name and value pairs (Ex-
tended File Attributes) that can be set either by the operating system
(for example, ACLs and privileges) or by a user-level application (for
example, PC File Attributes).
This function should be used to parse the Extended File Attribute
buffer returned by the getproplist(3) function.
EXAMPLES
#include <sys/proplist.h> main() { char *ptr, *buf, *name, *value; int
*value_len, *flags, buffer_size, min_buffer_size, ret, nbytes; struct pro-
plistname_args; static char *names[] = { "primary_name", "sec-
ondary_name", "" }; /*
* How big a buffer do I need to store my name and value
* pair in a property list ?
*/ buffer_size = sizeof_proplist_entry("primary_name", 18); buffer_size +=
sizeof_proplist_entry("secondary_name", 13); /*
* Malloc the buffer
*/ buf = ptr = (char *)malloc(buffer_size);
.
.
.
again: /*
* Call the system call to load buffer with property list
* entries.
*/ ret = getproplist("/tmp/foo", &getargs, buffer_size, buf,
&min_buffer_size); if (ret < 0) { perror("getproplist"); free(buf);
exit(1); } /*
* If buffer_size is not sufficient to store the name and value
* pairs, malloc a bigger buffer and try again.
*/ if (ret == 0 && min_buffer_size) {
free(buf);
buf = (char *)malloc(min_buffer_size);
buffer_size = min_buffer_size;
goto again; } /*
* Buffer contains ret bytes of name and value pairs
*/ ptr = buf; while (ret > 0) { /* * Call getproplist_entry to
initialize name and value * pointers to entries position within buffer.
*/ ret -= get_proplist_entry(&name, &flags, &value_len, &value,
&ptr); printf("name %s value len %d value %s0,
name, *value_len, value); }
.
.
.
RETURN VALUES
If successful, the function returns the size of the current Extended
File Attribute in the Property List.
RELATED INFORMATION
Functions: add_proplist_entry(3), delproplist(3), fdelproplist(3),
fgetproplist(3), fsetproplist(3), get_proplist_entry(3), getpro-
plist(3), setproplist(3), sizeof_proplist_entry(3).
Files: proplist(4), sys/proplist.h.
delim off
get_proplist_entry(3)