summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-misc/keynav/files/keynav-20091231.01_etc-config.patch')
-rw-r--r--x11-misc/keynav/files/keynav-20091231.01_etc-config.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/x11-misc/keynav/files/keynav-20091231.01_etc-config.patch b/x11-misc/keynav/files/keynav-20091231.01_etc-config.patch
new file mode 100644
index 0000000..00a32eb
--- /dev/null
+++ b/x11-misc/keynav/files/keynav-20091231.01_etc-config.patch
@@ -0,0 +1,70 @@
+From 50fb30000ecd172e1748fab9bad7762df4ea2cf0 Mon Sep 17 00:00:00 2001
+From: Russell Harmon <russ@eatnumber1.com>
+Date: Thu, 31 Dec 2009 11:44:16 -0500
+Subject: [PATCH 1/3] Support using a config file located in /etc
+
+---
+ keynav.c | 33 ++++++++++++++++++---------------
+ 1 files changed, 18 insertions(+), 15 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index d872805..76fd307 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -306,6 +306,22 @@ void addbinding(int keycode, int mods, char *commands) {
+ }
+ }
+
++void parse_config_file(const char* file) {
++ FILE *fp = NULL;
++#define LINEBUF_SIZE 512
++ char line[LINEBUF_SIZE];
++ fp = fopen(file, "r");
++ if (fp != NULL) {
++ /* fopen succeeded */
++ while (fgets(line, LINEBUF_SIZE, fp) != NULL) {
++ /* Kill the newline */
++ *(line + strlen(line) - 1) = '\0';
++ parse_config_line(line);
++ }
++ fclose(fp);
++ }
++}
++
+ void parse_config() {
+ char *homedir;
+
+@@ -313,28 +329,15 @@ void parse_config() {
+
+ defaults();
+
++ parse_config_file("/etc/keynavrc");
+ homedir = getenv("HOME");
+
+ if (homedir != NULL) {
+ char *rcfile = NULL;
+- FILE *fp = NULL;
+-#define LINEBUF_SIZE 512
+- char line[LINEBUF_SIZE];
+ asprintf(&rcfile, "%s/.keynavrc", homedir);
+- fp = fopen(rcfile, "r");
+- if (fp != NULL) {
+- /* fopen succeeded */
+- while (fgets(line, LINEBUF_SIZE, fp) != NULL) {
+- /* Kill the newline */
+- *(line + strlen(line) - 1) = '\0';
+- parse_config_line(line);
+- }
+- free(rcfile);
+- return;
+- }
++ parse_config_file(rcfile);
+ free(rcfile);
+ }
+- fprintf(stderr, "No ~/.keynavrc found.\n");
+ }
+
+ void defaults() {
+--
+1.6.4.4
+