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\&.