1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
'\" t
.\" Title: upscli_splitaddr
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 08/08/2025
.\" Manual: NUT Manual
.\" Source: Network UPS Tools 2.8.4
.\" Language: English
.\"
.TH "UPSCLI_SPLITADDR" "3" "08/08/2025" "Network UPS Tools 2\&.8\&.4" "NUT Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
upscli_splitaddr \- Split a listening address into its components
.SH "SYNOPSIS"
.sp
.nf
#include <upsclient\&.h>
int upscli_splitaddr(const char *buf, char **hostname,
int *port)
.fi
.SH "DESCRIPTION"
.sp
The \fBupscli_splitaddr()\fR function takes a pointer to the listening address definition \fIbuf\fR and returns the pointer to dynamically allocated memory in \fIhostname\fR\&. It also copies the port number into \fIport\fR\&.
.SH "FORMATTING"
.sp
A listening address definition is specified according to this format:
.sp
.if n \{\
.RS 4
.\}
.nf
<hostname>[:<port>]
.fi
.if n \{\
.RE
.\}
.sp
Definitions without an explicit port value receive the default value of \fI3493\fR\&.
.SH "MEMORY USAGE"
.sp
You must \fBfree\fR(3) the pointer \fIhostname\fR when you are done with it to avoid memory leaks\&.
.SH "RETURN VALUE"
.sp
The \fBupscli_splitaddr()\fR function returns \fI0\fR on success, or \fI\-1\fR if an error occurs\&.
.SH "SEE ALSO"
.sp
\fBupscli_fd\fR(3), \fBupscli_get\fR(3), \fBupscli_readline\fR(3), \fBupscli_sendline\fR(3), \fBupscli_splitname\fR(3), \fBupscli_ssl\fR(3), \fBupscli_strerror\fR(3), \fBupscli_upserror\fR(3)
|