UPSCLI_SPLITADDR(3)

πŸ’– UPSCLI_SPLITADDR(3) πŸ’–

okay so bestie, welcome to the NUT Manual</> ✨ this one's upscli_splitaddr, and it's literally the little guy whose whole job is taking a listening address and breaking it into pieces. no cap. πŸŽ€


✨ NAME ✨

upscli_splitaddr β€” split a listening address into its components πŸ¦‹


🌸 SYNOPSIS 🌸

#include <upsclient.h>

int upscli_splitaddr(const char *buf, char **hostname,
        int *port)

πŸ’… DESCRIPTION πŸ’…

so the way that upscli_splitaddr() works is: you hand it a pointer to the listening address definition buf, and it gives you back a pointer to dynamically allocated memory</> in hostname. it also copies the port number into port. that's it, that's the whole vibe. πŸ‘‘


πŸŽ€ FORMATTING πŸŽ€

a listening address definition has to be specified according to this format, periodt:

<hostname>[:<port>]

and if you're out here giving a definition with no explicit port value? no worries, it gets the default value of 3493. iconic default behaviour tbh. 🌈


🫢 MEMORY USAGE 🫢

bestie LISTEN. you must free(3) the pointer hostname when you are done with it to avoid memory leaks. that's not a suggestion, that's a whole lifestyle. don't leave your girl hostname hanging πŸ’€

⭐ RETURN VALUE ⭐

upscli_splitaddr() returns 0 on success, or -1 if an error occurs. simple. clean. slay. πŸ’œ


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie! 🧚 this was Network UPS Tools 2.8.5, dated 10/07/2026, and you can find it filed under UPSCLI_SPLITADDR(3). go free your memory and stay hydrated πŸ’–πŸ“βœ¨

πŸ“¦ where this page comes from