nut-debian/man/upscli_splitname.3
2010-03-26 00:20:59 +01:00

37 lines
1.3 KiB
Groff

.TH UPSCLI_SPLITNAME 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)"
.SH NAME
upscli_splitname \- split a UPS definition into its components
.SH SYNOPSIS
.nf
.B #include <upsclient.h>
.sp
.BI "int upscli_splitname(const char *buf, char **upsname, "
.BI " char **hostname, int *port)"
.fi
.SH DESCRIPTION
The \fBupscli_splitname()\fP function takes a pointer to the raw UPS
definition \fIbuf\fP and returns pointers to dynamically allocated
memory in \fIupsname\fP and \fIhostname\fP. It also copies the port
number into \fIport\fP.
.SH FORMATTING
A UPS definition is specified according to this format:
.PP
<upsname>[@<hostname>[:<port>]]
.PP
When the UPS name is not given, this function will print an error to
stderr and return \-1 without changing anything.
.PP
Definitions without an explicit port value receive the default value of
3493. The default hostname is "localhost".
.SH "MEMORY USAGE"
You must \fBfree\fP(3) the pointers to \fIupsname\fP and \fIhostname\fP
when you are done with them to avoid memory leaks.
.SH "RETURN VALUE"
The \fBupscli_splitname()\fP function returns 0 on success, or \-1 if an
error occurs.
.SH "SEE ALSO"
.BR upscli_fd "(3), "upscli_get "(3), "
.BR upscli_readline "(3), "upscli_sendline "(3), "
.BR upscli_splitaddr "(3), "upscli_ssl "(3), "
.BR upscli_strerror "(3), "upscli_upserror "(3) "