DragonFly On-Line Manual Pages
ph_encode_selector(3) C Library Calls ph_encode_selector(3)
NAME
ph_encode_selector, ph_free_selectors - retrieve data from a PH server
SYNOPSIS
#include <phclient.h>
int ph_encode_selector(char *string, int requirefield, int *lastindex,
struct ph_fieldselector **selectors);
void ph_free_selectors(struct ph_fieldselector *selectors);
VERSION
This man page documents version 1.2 of libphclient.
DESCRIPTION
The ph_encode_selector() function is a utility function for text-based
applications which need to convert field specifiers from a string
format into an array of ph_fieldselector structures.
The string argument is a text string consisting of an optional field
name and operator, as well as a mandantory value. The requirefield
argument indicates whether the field portion of string is required.
The selectors argument is a pointer to a dynamically-allocated array of
ph_fieldselector structures. The lastindex argument is a pointer to an
integer which keeps track of the size of the selectors array.
Successive calls to ph_encode_selector() add the selector encoded in
string to the array pointed to by selectors. Before calling
ph_encode_selector() for the first time on a given array, the caller
should initialize selectors to NULL and lastindex to 0.
The ph_free_selectors() function is used to free memory allocated by
ph_encode_selector() for the selectors array.
RETURN VALUE
On success, the ph_encode_selector() function returns 0. On error, it
returns -1 and sets errno.
ERRORS
If the requirefield argument is non-zero and string does not include
the field name and operator, ph_encode_selector() returns -1 and sets
errno to EINVAL.
SEE ALSO
ph_query(3)
University of Illinois Oct 2002 ph_encode_selector(3)