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

NAME

6       upscli_splitname - split a UPS definition into its components
7

SYNOPSIS

9       #include <upsclient.h>
10
11       int upscli_splitname(const char *buf, char **upsname,
12                                      char **hostname, int *port)
13

DESCRIPTION

15       The upscli_splitname() function takes a pointer to the raw UPS
16       definition buf and returns pointers to dynamically allocated memory in
17       upsname and hostname. It also copies the port number into port.
18

FORMATTING

20       A UPS definition is specified according to this format:
21
22           <upsname>[@<hostname>[:<port>]]
23
24       When the UPS name is not given, this function will print an error to
25       stderr and return -1 without changing anything.
26
27       Definitions without an explicit port value receive the default value of
28       3493. The default hostname is "localhost".
29

MEMORY USAGE

31       You must free(3) the pointers to upsname and hostname when you are done
32       with them to avoid memory leaks.
33

RETURN VALUE

35       The upscli_splitname() function returns 0 on success, or -1 if an error
36       occurs.
37

SEE ALSO

39       upscli_fd(3), upscli_get(3), upscli_readline(3), upscli_sendline(3),
40       upscli_splitaddr(3), upscli_ssl(3), upscli_strerror(3),
41       upscli_upserror(3)
42
43
44
45Network UPS Tools 2.8.0           04/26/2022               UPSCLI_SPLITNAME(3)
Impressum