* rename files, render_file -> file_main, render_node -> node_main, mandelbrot -> render_mandelbrot
* make the error message stuff in common a /lot/ neater (a single function and a set of macros)
* clean up rest of code to use those new macros
committer: Tero Marttila <terom@fixme.fi>
/*
* error handling
*/
void _generic_err (const char *func, int perr, int do_exit, const char *fmt, ...);
// various kinds of ways to handle an error, 2**3 of them, *g*
#define error(...) _generic_err(NULL, 0, 0, __VA_ARGS__)
#define err_exit(...) _generic_err(NULL, 0, 1, __VA_ARGS__)
#define perr(...) _generic_err(NULL, 1, 0, __VA_ARGS__)
#define perr_exit(...) _generic_err(NULL, 1, 1, __VA_ARGS__)
#define err_func(func, ...) _generic_err(func, 0, 0, __VA_ARGS__)
#define err_func_exit(func, ...) _generic_err(func, 0, 1, __VA_ARGS__)
#define perr_func(func, ...) _generic_err(func, 1, 0, __VA_ARGS__)
#define perr_func_exit(func, ...) _generic_err(func, 1, 1, __VA_ARGS__)
// error(func + colon + msg, ...) + goto error
#define ERROR(...) do { err_func(__func__, __VA_ARGS__); goto error; } while (0)
#define PERROR(...) do { perr_func(__func__, __VA_ARGS__); goto error; } while (0)
#define FATAL(...) err_func_exit(__func__, __VA_ARGS__)
#define PFATAL(...) perr_func_exit(__func__, __VA_ARGS__)
#define WARNING(...) err_func(__func__, __VA_ARGS__)
#define PWARNING(...) perr_func(__func__, __VA_ARGS__)
/*
* 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);