upscli_splitaddr(3)

upscli_splitaddr3

Split a listening address into its components

Usage

        #include <upsclient.h>
        int upscli_splitaddr(const char *buf, char **hostname,
                int *port)

Overview

The upscli_splitaddr() function takes a pointer to the listening address definition buf and returns the pointer to dynamically allocated memory in hostname. It also copies the port number into port.

Formatting

A listening address definition is specified according to this format:

<hostname>[:<port>]

Definitions without an explicit port value receive the default value of 3493.

Memory usage

You must free(3) the pointer hostname when you are done with it to avoid memory leaks.

Return value

The upscli_splitaddr() function returns 0 on success, or -1 if an error occurs.

Releases

10 releases since Debian 5.0 (Lenny); the text changed 6 times.

  1. 5.0–6.0
  2. 7
  3. 8
  4. 9–11
  5. 12
  6. 13
  7. Arch

From nut 2.8.5-2 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.