util: rename eprint() to fatal()

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-19 09:45:08 +02:00
parent 5773f5eddb
commit 0fdc03faa4
4 changed files with 13 additions and 13 deletions

View File

@ -97,7 +97,7 @@ scan(void)
/* Get the tree of the children windows of the current root window */
if(!(wins = xcb_query_tree_children(tree_r)))
eprint("E: cannot get tree children");
fatal("E: cannot get tree children");
tree_c_len = xcb_query_tree_children_length(tree_r);
attr_wins = p_new(xcb_get_window_attributes_cookie_t, tree_c_len);
@ -207,7 +207,7 @@ xerrorstart(void * data __attribute__ ((unused)),
xcb_connection_t * c __attribute__ ((unused)),
xcb_generic_error_t * error __attribute__ ((unused)))
{
eprint("another window manager is already running");
fatal("another window manager is already running");
}
/** Function to exit on some signals.
@ -338,7 +338,7 @@ main(int argc, char **argv)
if(a_strlen(optarg))
confpath = a_strdup(optarg);
else
eprint("-c option requires a file name");
fatal("-c option requires a file name");
break;
}
@ -361,7 +361,7 @@ main(int argc, char **argv)
/* X stuff */
globalconf.connection = xcb_connect(NULL, &globalconf.default_screen);
if(xcb_connection_has_error(globalconf.connection))
eprint("cannot open display");
fatal("cannot open display");
/* Get the file descriptor corresponding to the X connection */
xfd = xcb_get_file_descriptor(globalconf.connection);
@ -440,7 +440,7 @@ main(int argc, char **argv)
warn("failed to load/parse configuration file %s", confpath);
warn("falling back to: %s", default_confpath);
if(!luaA_parserc(default_confpath))
eprint("failed to load any configuration file");
fatal("failed to load any configuration file");
}
/* do this only for real screen */

View File

@ -28,10 +28,10 @@
#include "util.h"
/** Print error and exit with EXIT_FAILURE code
/** Print error and exit with EXIT_FAILURE code.
*/
void
_eprint(int line, const char *fct, const char *fmt, ...)
_fatal(int line, const char *fct, const char *fmt, ...)
{
va_list ap;
@ -43,7 +43,7 @@ _eprint(int line, const char *fct, const char *fmt, ...)
exit(EXIT_FAILURE);
}
/** Print error message on stderr
/** Print error message on stderr.
*/
void
_warn(int line, const char *fct, const char *fmt, ...)

View File

@ -285,10 +285,10 @@ a_strtobool(const char *s)
return false;
}
#define eprint(string, ...) _eprint(__LINE__, \
__FUNCTION__, \
string, ## __VA_ARGS__)
void _eprint(int, const char *, const char *, ...)
#define fatal(string, ...) _fatal(__LINE__, \
__FUNCTION__, \
string, ## __VA_ARGS__)
void _fatal(int, const char *, const char *, ...)
__attribute__ ((noreturn)) __attribute__ ((format(printf, 3, 4)));
#define warn(string, ...) _warn(__LINE__, \

View File

@ -170,7 +170,7 @@ static inline xcb_screen_t *
xutil_screen_get(xcb_connection_t *c, int screen)
{
if(xcb_connection_has_error(c))
eprint("X connection invalid");
fatal("X connection invalid");
return xcb_aux_get_screen(c, screen);
}