/*
* error handling
*/
// perror + exit
void die (const char *msg);
// fprintf + newline
void error (const char *fmt, ...);
// fprintf + strerror + newline
void perr (const char *fmt, ...);
// fprintf + strerror + newline + exit
void perr_exit (const char *fmt, ...);
// fprintf + newline + exit
void err_exit (const char *fmt, ...);
/*
* Parse a host:port string.
*
* Valid formats:
* host
* host:port
* [host]
* [host]:port
*
* The contents of the given hostport string *will* be modified.
*
* The value of *port will be set to NULL if no port was given.
*
* Returns 0 and sets *host if succesfull, nonzero otherwise.
*
*/
int parse_hostport (char *hostport, char **host, char **port);