'\" t .\" Title: upscli_list_next .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.76.1 .\" Date: 09/13/2013 .\" Manual: NUT Manual .\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" .TH "UPSCLI_LIST_NEXT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" upscli_list_next \- retrieve list items from a UPS .SH "SYNOPSIS" .sp .nf #include .fi .sp .nf int upscli_list_next(UPSCONN_t *ups, int numq, const char **query, int *numa, char ***answer) .fi .SH "DESCRIPTION" .sp The \fBupscli_list_next()\fR function takes the pointer \fIups\fR to a UPSCONN_t state structure, and the pointer \fIquery\fR to an array of \fInumq\fR query elements\&. It performs a read from the network and expects to find either another list item or the end of a list\&. .sp You must call \fBupscli_list_start\fR(3) before calling this function\&. .sp This function will return 1 and set values in \fInuma\fR and \fIanswer\fR if a list item is received\&. If the list is done, it will return 0, and the values in \fInuma\fR and \fIanswer\fR are undefined\&. .sp Calling this function after it returns something other than 1 is undefined\&. .SH "QUERY FORMATTING" .sp You may not change the values of \fInumq\fR or \fIquery\fR between the call to \fBupscli_list_start\fR(3) and the first call to this function\&. You also may not change the values between calls to this function\&. .SH "ANSWER FORMATTING" .sp The contents of \fInuma\fR and \fIanswer\fR work just like a call to \fBupscli_get\fR(3)\&. The values returned by \fBupsd\fR(8) are identical to a single item request, so this is not surprising\&. .SH "ERROR CHECKING" .sp This function checks the response from \fBupsd\fR(8) against your query\&. If the response is not part of the list you have requested, it will return an error code\&. .sp When this happens, \fBupscli_upserror\fR(3) will return UPSCLI_ERR_PROTOCOL\&. .SH "RETURN VALUE" .sp The \fBupscli_list_next()\fR function returns 1 when list data is present, 0 if the list is finished, or \-1 if an error occurs\&. .sp It is possible to have an empty list\&. The function will return 0 for its first call in that case\&. .SH "SEE ALSO" .sp \fBupscli_list_start\fR(3), \fBupscli_strerror\fR(3), \fBupscli_upserror\fR(3)