aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin <calvin@bastille>2014-02-11 17:08:13 -0500
committerCalvin <calvin@bastille>2014-02-11 17:08:13 -0500
commit8f5f33b271e4eb6f22e19c980693375a628842b8 (patch)
tree4372a3fb90a0c2827626ae8090c462a8ceec68f0
parent03b558185d8e7d574fb1abfe8c979260335747e7 (diff)
no more &
-rw-r--r--example_rc6
-rw-r--r--hotkey.c7
2 files changed, 8 insertions, 5 deletions
diff --git a/example_rc b/example_rc
index d60c895..2ea9cdf 100644
--- a/example_rc
+++ b/example_rc
@@ -1,3 +1,3 @@
-control+p dmenu_run &
-control+mod1+g xterm -e mocp &
-mod1+g xterm &
+control+p dmenu_run
+control+mod1+g xterm -e mocp
+mod1+g xterm
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;