Replace 'connexion' with 'connection' in English contexts
[networkupstools/kirr.git] / docs / man / upscli_list_start.txt
blobe041934e4333b7e843d3b376fbd2604b3ecd5769
1 UPSCLI_LIST_START(3)
2 ====================
4 NAME
5 ----
7 upscli_list_start - begin multi-item retrieval from a UPS
9 SYNOPSIS
10 --------
12  #include <upsclient.h>
13  int upscli_list_start(UPSCONN_t *ups, int numq, const char **query)
15 DESCRIPTION
16 -----------
18 The *upscli_list_start()* function takes the pointer 'ups' to a
19 `UPSCONN_t` state structure, and the pointer 'query' to an array of
20 'numq' query elements.  It builds a properly-formatted request from
21 those elements and transmits it to linkman:upsd[8].
23 Upon success, the caller must call linkman:upscli_list_next[3] to retrieve
24 the elements of the list.  Failure to retrieve the list will most likely
25 result in the client getting out of sync with the server due to buffered
26 data.
28 USES
29 ----
31 This function implements the "LIST" command in the protocol.  As a
32 result, you can use it to request many different things from the server.
33 Some examples are:
35  - LIST UPS
36  - LIST VAR <ups>
37  - LIST RW <ups>
38  - LIST CMD <ups>
39  - LIST ENUM <ups> <var>
40  - LIST RANGE <ups> <var>
42 QUERY FORMATTING
43 ----------------
45 To see the list of variables on a UPS called 'su700', the protocol command
46 would be `LIST VAR su700`.  To start that list with this function, you
47 would populate query and numq as follows:
49         int numq;
50         const char *query[2];
52         query[0] = "VAR";
53         query[1] = "su700";
54         numq = 2;
56 All escaping of special characters and quoting of elements with spaces
57 are handled for you inside this function.
59 ERROR CHECKING
60 --------------
62 This function checks the response from linkman:upsd[8] against your query.
63 If it is not starting a list, or is starting the wrong type of list, it
64 will return an error code.
66 When this happens, linkman:upscli_upserror[3] will return
67 `UPSCLI_ERR_PROTOCOL`.
69 RETURN VALUE
70 ------------
71 The *upscli_list_start()* function returns 0 on success, or -1 if an
72 error occurs.
74 SEE ALSO
75 --------
77 linkman:upscli_fd[3], linkman:upscli_get[3],
78 linkman:upscli_readline[3], linkman:upscli_sendline[3],
79 linkman:upscli_ssl[3],
80 linkman:upscli_strerror[3], linkman:upscli_upserror[3]