summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-misc/keynav/files/keynav-20091108_etc-config.patch')
-rw-r--r--x11-misc/keynav/files/keynav-20091108_etc-config.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/x11-misc/keynav/files/keynav-20091108_etc-config.patch b/x11-misc/keynav/files/keynav-20091108_etc-config.patch
new file mode 100644
index 0000000..c1a2af8
--- /dev/null
+++ b/x11-misc/keynav/files/keynav-20091108_etc-config.patch
@@ -0,0 +1,57 @@
+--- a/keynav-20091108/keynav.c 2009-11-08 16:03:15.000000000 -0500
++++ b/keynav-20091108/keynav.c 2009-11-26 10:31:41.813671575 -0500
+@@ -285,22 +285,11 @@
+ }
+ }
+
+-void parse_config() {
+- char *homedir;
+-
+- keybindings = malloc(keybindings_size * sizeof(struct keybinding));
+-
+- defaults();
+-
+- homedir = getenv("HOME");
+-
+- if (homedir != NULL) {
+- char *rcfile = NULL;
++void parse_config_file(const char* file) {
+ FILE *fp = NULL;
+ #define LINEBUF_SIZE 512
+ char line[LINEBUF_SIZE];
+- asprintf(&rcfile, "%s/.keynavrc", homedir);
+- fp = fopen(rcfile, "r");
++ fp = fopen(file, "r");
+ if (fp != NULL) {
+ /* fopen succeeded */
+ while (fgets(line, LINEBUF_SIZE, fp) != NULL) {
+@@ -308,11 +297,27 @@
+ *(line + strlen(line) - 1) = '\0';
+ parse_config_line(line);
+ }
+- free(rcfile);
++ fclose(fp);
+ return;
+ }
++}
++
++void parse_config() {
++ char *homedir;
++
++ keybindings = malloc(keybindings_size * sizeof(struct keybinding));
++
++ defaults();
++
++ parse_config_file("/etc/keynavrc");
++ homedir = getenv("HOME");
++
++ if (homedir != NULL) {
++ char *rcfile = NULL;
++ asprintf(&rcfile, "%s/.keynavrc", homedir);
++ parse_config_file(rcfile);
++ free(rcfile);
+ }
+- fprintf(stderr, "No ~/.keynavrc found.\n");
+ }
+
+ void defaults() {