1UPSCLI_LIST_NEXT(3) NUT Manual UPSCLI_LIST_NEXT(3)
2
3
4
6 upscli_list_next - retrieve list items from a UPS
7
9 #include <upsclient.h>
10
11 int upscli_list_next(UPSCONN_t *ups, unsigned int numq, const char **query,
12 unsigned int *numa, char ***answer)
13
15 The upscli_list_next() function takes the pointer ups to a UPSCONN_t
16 state structure, and the pointer query to an array of numq query
17 elements. It performs a read from the network and expects to find
18 either another list item or the end of a list.
19
20 You must call upscli_list_start(3) before calling this function.
21
22 This function will return 1 and set values in numa and answer if a list
23 item is received. If the list is done, it will return 0, and the values
24 in numa and answer are undefined.
25
26 Calling this function after it returns something other than 1 is
27 undefined.
28
30 You may not change the values of numq or query between the call to
31 upscli_list_start(3) and the first call to this function. You also may
32 not change the values between calls to this function.
33
35 The contents of numa and answer work just like a call to upscli_get(3).
36 The values returned by upsd(8) are identical to a single item request,
37 so this is not surprising.
38
40 This function checks the response from upsd(8) against your query. If
41 the response is not part of the list you have requested, it will return
42 an error code.
43
44 When this happens, upscli_upserror(3) will return UPSCLI_ERR_PROTOCOL.
45
47 The upscli_list_next() function returns 1 when list data is present, 0
48 if the list is finished, or -1 if an error occurs.
49
50 It is possible to have an empty list. The function will return 0 for
51 its first call in that case.
52
54 upscli_list_start(3), upscli_strerror(3), upscli_upserror(3)
55
56
57
58Network UPS Tools 2.7.3. 03/02/2016 UPSCLI_LIST_NEXT(3)