From 3d84ee67267d8e8e70ee2d7bdfb3ff9e0ea15814 Mon Sep 17 00:00:00 2001 From: alema Date: Tue, 12 May 2020 15:14:14 +0000 Subject: [PATCH] converted die to a macro --- hkd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hkd.c b/hkd.c index ec9a82e..e47e06c 100644 --- a/hkd.c +++ b/hkd.c @@ -35,6 +35,7 @@ #define yellow(str) (ANSI_COLOR_YELLOW 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< 0) +#define die(str) {perror(red(str)); exit(errno);} struct key_buffer { unsigned short *buf; @@ -234,12 +235,6 @@ void int_handler (int signum) 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) { char *argv[] = {path, NULL};