ph_change(3)

NAME
ph_change, ph_add, ph_delete - modify data on PH server

SYNOPSIS
#include <phclient.h>

int ph_change(PH *ph, struct ph_fieldselector query[], struct ph_fieldselector change[], int flags);
int ph_add(PH *ph, struct ph_fieldselector fields[]);
int ph_delete(PH *ph, struct ph_fieldselector query[]);

VERSION
This man page documents version 1.2 of libphclient.

DESCRIPTION
The ph_change() function changes data on the PH server associated with the PH handle ph. The query argument selects which entries will be changed in the same manner as for the ph_query() function. The change argument is an array of changes to make on the server. Each element of the array is a structure with three fields: field (the name of the field to modify encoded as a string), operation (a character value which must be set to '='), and value (a string value to set the field to). The last element in the array must be set to all zeros. If the flags argument is set to PH_CHANGE_FORCE, the "force" clause is used instead of the "make" clause when sending the change command to the server. The ph_add() function adds a new PH entry whose contents are specified in fields. This data is encoded just as the change argument to ph_change() above. The ph_delete() function deletes entries from the PH server. The query argument selects which entries will be deleted in the same manner as for the ph_query() function.

RETURN VALUE
On success, the ph_change() and ph_delete() functions return the number of entries changed or deleted, or PH_ERR_DATAERR if the supplied field data is invalid. All of the functions described here return PH_ERR_NOTLOG if no user is logged in, and PH_ERR_READONLY if the server is in read-only mode. On error, they return -1 and set errno.

ERRORS
The functions describe here will fail with EINVAL if they receive an unexpected response code from the server. In addition, they may fail with any error from the functions read() or write().

SEE ALSO
read(2), write(2), ph_query(3), ph_open(3)