converted die to a macro
This commit is contained in:
parent
db923d7ae0
commit
3d84ee6726
7
hkd.c
7
hkd.c
@ -35,6 +35,7 @@
|
|||||||
#define yellow(str) (ANSI_COLOR_YELLOW str ANSI_COLOR_RESET)
|
#define yellow(str) (ANSI_COLOR_YELLOW str ANSI_COLOR_RESET)
|
||||||
#define red(str) (ANSI_COLOR_RED str ANSI_COLOR_RESET)
|
#define red(str) (ANSI_COLOR_RED str ANSI_COLOR_RESET)
|
||||||
#define test_bit(yalv, abs_b) ((((char *)abs_b)[yalv/8] & (1<<yalv%8)) > 0)
|
#define test_bit(yalv, abs_b) ((((char *)abs_b)[yalv/8] & (1<<yalv%8)) > 0)
|
||||||
|
#define die(str) {perror(red(str)); exit(errno);}
|
||||||
|
|
||||||
struct key_buffer {
|
struct key_buffer {
|
||||||
unsigned short *buf;
|
unsigned short *buf;
|
||||||
@ -234,12 +235,6 @@ void int_handler (int signum)
|
|||||||
term = 1;
|
term = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void die (const char *msg, int err)
|
|
||||||
{
|
|
||||||
fprintf(stderr, red("%s: %s"), msg != NULL ? msg : "error", err ? strerror(err): "exiting");
|
|
||||||
exit(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
void exec_command (char *path)
|
void exec_command (char *path)
|
||||||
{
|
{
|
||||||
char *argv[] = {path, NULL};
|
char *argv[] = {path, NULL};
|
||||||
|
Loading…
Reference in New Issue
Block a user