1UPSCLI_SPLITNAME(3)         Network UPS Tools (NUT)        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 defini‐
16       tion 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.  To avoid  this  behav‐
26       ior,  check the UPS definition for the presence of a '@' before calling
27       this function.
28
29       Definitions without an explicit port value receive the default value of
30       3493.
31

MEMORY USAGE

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

RETURN VALUE

37       The upscli_readline() function returns 0 on success, or -1 if an  error
38       occurs.
39

SEE ALSO

41       upscli_fd(3),  upscli_get(3),  upscli_readline(3),  upscli_sendline(3),
42       upscli_splitname(3), upscli_ssl(3),  upscli_strerror(3),  upscli_upser‐
43       ror(3)
44
45
46
47                                Tue Jul 29 2003            UPSCLI_SPLITNAME(3)
Impressum