From 8f5f33b271e4eb6f22e19c980693375a628842b8 Mon Sep 17 00:00:00 2001 From: Calvin Date: Tue, 11 Feb 2014 17:08:13 -0500 Subject: no more & --- hotkey.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'hotkey.c') diff --git a/hotkey.c b/hotkey.c index d00062d..e9ee615 100644 --- a/hotkey.c +++ b/hotkey.c @@ -22,8 +22,9 @@ struct Key * parse_key(char *shortcut, char *command) { fprintf(stderr, "could not allocate keys\n"); exit(EXIT_FAILURE); } - key->command = command; - key->mod = 0; + key->command = strndup(command, strlen(command) + 2); + key->command[strlen(command)] = ' '; + key->command[strlen(command) + 1] = '&'; size_t i = 0; @@ -113,6 +114,8 @@ struct Key **load_hotkeys(FILE *fh, size_t *key_len) { res = sscanf(line, "%ms %m[^\n]+", &shortcut, &command); if(res == 2) { key = parse_key(shortcut, command); + if(key == NULL) + error = 1; } else { error = 1; -- cgit v1.2.3