util: rename eprint() to fatal()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
5773f5eddb
commit
0fdc03faa4
10
awesome.c
10
awesome.c
|
@ -97,7 +97,7 @@ scan(void)
|
||||||
|
|
||||||
/* Get the tree of the children windows of the current root window */
|
/* Get the tree of the children windows of the current root window */
|
||||||
if(!(wins = xcb_query_tree_children(tree_r)))
|
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);
|
tree_c_len = xcb_query_tree_children_length(tree_r);
|
||||||
attr_wins = p_new(xcb_get_window_attributes_cookie_t, tree_c_len);
|
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_connection_t * c __attribute__ ((unused)),
|
||||||
xcb_generic_error_t * error __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.
|
/** Function to exit on some signals.
|
||||||
|
@ -338,7 +338,7 @@ main(int argc, char **argv)
|
||||||
if(a_strlen(optarg))
|
if(a_strlen(optarg))
|
||||||
confpath = a_strdup(optarg);
|
confpath = a_strdup(optarg);
|
||||||
else
|
else
|
||||||
eprint("-c option requires a file name");
|
fatal("-c option requires a file name");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ main(int argc, char **argv)
|
||||||
/* X stuff */
|
/* X stuff */
|
||||||
globalconf.connection = xcb_connect(NULL, &globalconf.default_screen);
|
globalconf.connection = xcb_connect(NULL, &globalconf.default_screen);
|
||||||
if(xcb_connection_has_error(globalconf.connection))
|
if(xcb_connection_has_error(globalconf.connection))
|
||||||
eprint("cannot open display");
|
fatal("cannot open display");
|
||||||
|
|
||||||
/* Get the file descriptor corresponding to the X connection */
|
/* Get the file descriptor corresponding to the X connection */
|
||||||
xfd = xcb_get_file_descriptor(globalconf.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("failed to load/parse configuration file %s", confpath);
|
||||||
warn("falling back to: %s", default_confpath);
|
warn("falling back to: %s", default_confpath);
|
||||||
if(!luaA_parserc(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 */
|
/* do this only for real screen */
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/** Print error and exit with EXIT_FAILURE code
|
/** Print error and exit with EXIT_FAILURE code.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_eprint(int line, const char *fct, const char *fmt, ...)
|
_fatal(int line, const char *fct, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ _eprint(int line, const char *fct, const char *fmt, ...)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print error message on stderr
|
/** Print error message on stderr.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_warn(int line, const char *fct, const char *fmt, ...)
|
_warn(int line, const char *fct, const char *fmt, ...)
|
||||||
|
|
|
@ -285,10 +285,10 @@ a_strtobool(const char *s)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define eprint(string, ...) _eprint(__LINE__, \
|
#define fatal(string, ...) _fatal(__LINE__, \
|
||||||
__FUNCTION__, \
|
__FUNCTION__, \
|
||||||
string, ## __VA_ARGS__)
|
string, ## __VA_ARGS__)
|
||||||
void _eprint(int, const char *, const char *, ...)
|
void _fatal(int, const char *, const char *, ...)
|
||||||
__attribute__ ((noreturn)) __attribute__ ((format(printf, 3, 4)));
|
__attribute__ ((noreturn)) __attribute__ ((format(printf, 3, 4)));
|
||||||
|
|
||||||
#define warn(string, ...) _warn(__LINE__, \
|
#define warn(string, ...) _warn(__LINE__, \
|
||||||
|
|
|
@ -170,7 +170,7 @@ static inline xcb_screen_t *
|
||||||
xutil_screen_get(xcb_connection_t *c, int screen)
|
xutil_screen_get(xcb_connection_t *c, int screen)
|
||||||
{
|
{
|
||||||
if(xcb_connection_has_error(c))
|
if(xcb_connection_has_error(c))
|
||||||
eprint("X connection invalid");
|
fatal("X connection invalid");
|
||||||
|
|
||||||
return xcb_aux_get_screen(c, screen);
|
return xcb_aux_get_screen(c, screen);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue