From ffaff1f68d6b8cda37980bfe50a452d5d62c3d30 Mon Sep 17 00:00:00 2001 From: koekeishiya Date: Sat, 23 Sep 2017 22:48:42 +0200 Subject: code cleanup --- src/hotkey.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/hotkey.c') diff --git a/src/hotkey.c b/src/hotkey.c index 168d24b..5e0190e 100644 --- a/src/hotkey.c +++ b/src/hotkey.c @@ -8,26 +8,6 @@ #define internal static #define local_persist static -internal bool -fork_and_exec(char *command) -{ - local_persist char arg[] = "-c"; - local_persist char *shell = NULL; - if(!shell) { - char *env_shell = getenv("SHELL"); - shell = env_shell ? env_shell : "/bin/bash"; - } - - int cpid = fork(); - if(cpid == 0) { - char *exec[] = { shell, arg, command, NULL}; - int status_code = execvp(exec[0], exec); - exit(status_code); - } - - return true; -} - #define LRMOD_ALT 0 #define LRMOD_CMD 6 #define LRMOD_CTRL 9 @@ -85,6 +65,26 @@ unsigned long hash_hotkey(struct hotkey *a) return a->key; } +internal bool +fork_and_exec(char *command) +{ + local_persist char arg[] = "-c"; + local_persist char *shell = NULL; + if(!shell) { + char *env_shell = getenv("SHELL"); + shell = env_shell ? env_shell : "/bin/bash"; + } + + int cpid = fork(); + if(cpid == 0) { + char *exec[] = { shell, arg, command, NULL}; + int status_code = execvp(exec[0], exec); + exit(status_code); + } + + return true; +} + bool find_and_exec_hotkey(struct hotkey *eventkey, struct table *hotkey_map) { bool result = false; -- cgit v1.2.3