X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=gui.c;h=64fab61b7859e5192a3d1583a693622be8977087;hp=5b44819c05afc074fadca3a5a7d5c1ece9fe8b8f;hb=2b46607651851bdf22fe989796fda95cf7b11d1a;hpb=57b7c4c20305a1b64e7a2141a90cfdc96956d1fc diff --git a/gui.c b/gui.c index 5b44819c..64fab61b 100644 --- a/gui.c +++ b/gui.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998-2009 Andre Noll + * Copyright (C) 1998-2010 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -730,6 +730,8 @@ static int read_audiod_pipe(int fd) ret = for_each_stat_item(buf, loaded, update_item); if (ret < 0) return ret; + if (ret > 0 && ret < loaded) + memmove(buf, buf + loaded - ret, ret); loaded = ret; return 1; } @@ -1348,31 +1350,30 @@ static void handle_command(int c) /* first check user's key bindings */ for (i = 0; i < conf.key_map_given; ++i) { - char tmp[MAXLINE], *handler, *arg; + char *tmp, *handler, *arg; - strcpy(tmp, conf.key_map_arg[i]); - if (!split_key_map(tmp, &handler, &arg)) + tmp = para_strdup(conf.key_map_arg[i]); + if (!split_key_map(tmp, &handler, &arg)) { + free(tmp); return; - if (!strcmp(tmp, km_keyname(c))) { - if (*handler == 'd') { - display_cmd(arg); - return; - } - if (*handler == 'x') { - external_cmd(arg); - return; - } - if (*handler == 'p') { - client_cmd_cmdline(arg); - return; - } - if (*handler == 'i') { - int num = find_cmd_byname(arg); - if (num >= 0) - command_list[num].handler(); - return; - } } + if (strcmp(tmp, km_keyname(c))) { + free(tmp); + continue; + } + if (*handler == 'd') + display_cmd(arg); + else if (*handler == 'x') + external_cmd(arg); + else if (*handler == 'p') + client_cmd_cmdline(arg); + else if (*handler == 'i') { + int num = find_cmd_byname(arg); + if (num >= 0) + command_list[num].handler(); + } + free(tmp); + return; } /* not found, check internal key bindings */ for (i = 0; command_list[i].handler; i++) {