1UPSCLI_LIST_START(3)              NUT Manual              UPSCLI_LIST_START(3)
2
3
4

NAME

6       upscli_list_start - begin multi-item retrieval from a UPS
7

SYNOPSIS

9       #include <upsclient.h>
10       int upscli_list_start(UPSCONN_t *ups, int numq, const char **query)
11

DESCRIPTION

13       The upscli_list_start() function takes the pointer ups to a UPSCONN_t
14       state structure, and the pointer query to an array of numq query
15       elements. It builds a properly-formatted request from those elements
16       and transmits it to upsd(8).
17
18       Upon success, the caller must call upscli_list_next(3) to retrieve the
19       elements of the list. Failure to retrieve the list will most likely
20       result in the client getting out of sync with the server due to
21       buffered data.
22

USES

24       This function implements the "LIST" command in the protocol. As a
25       result, you can use it to request many different things from the
26       server. Some examples are:
27
28       ·   LIST UPS
29
30       ·   LIST VAR <ups>
31
32       ·   LIST RW <ups>
33
34       ·   LIST CMD <ups>
35
36       ·   LIST ENUM <ups> <var>
37

QUERY FORMATTING

39       To see the list of variables on a UPS called su700, the protocol
40       command would be LIST VAR su700. To start that list with this function,
41       you would populate query and numq as follows:
42
43           int numq;
44           const char *query[2];
45
46           query[0] = "VAR";
47           query[1] = "su700";
48           numq = 2;
49
50       All escaping of special characters and quoting of elements with spaces
51       are handled for you inside this function.
52

ERROR CHECKING

54       This function checks the response from upsd(8) against your query. If
55       it is not starting a list, or is starting the wrong type of list, it
56       will return an error code.
57
58       When this happens, upscli_upserror(3) will return UPSCLI_ERR_PROTOCOL.
59

RETURN VALUE

61       The upscli_list_start() function returns 0 on success, or -1 if an
62       error occurs.
63

SEE ALSO

65       upscli_fd(3), upscli_get(3), upscli_readline(3), upscli_sendline(3),
66       upscli_ssl(3), upscli_strerror(3), upscli_upserror(3)
67
68
69
70Network UPS Tools                 09/15/2011              UPSCLI_LIST_START(3)
Impressum