'\" t .\" Title: upscli_splitaddr .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 06/21/2026 .\" Manual: NUT Manual .\" Source: Network UPS Tools 2.8.5 .\" Language: English .\" .TH "UPSCLI_SPLITADDR" "3" "06/21/2026" "Network UPS Tools 2\&.8\&.5" "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 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 [:] .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)