openbsd-ports/x11/i3/patches/patch-src_config_c
landry 620da9e954 Import (really, this time) i3 3.c, from MAINTAINER Baptiste Daroussin,
with tweaks by me.

i3 is an improved dynamic, tiling window manager.

note: It is still young, so some debug options are still enable by
default, and it's a bit verbose.

ok ajacoutot@
2009-09-02 19:26:17 +00:00

34 lines
1.9 KiB
Plaintext

$OpenBSD: patch-src_config_c,v 1.1.1.1 2009/09/02 19:26:17 landry Exp $
--- src/config.c.orig Wed Aug 19 14:39:09 2009
+++ src/config.c Mon Aug 31 20:30:32 2009
@@ -226,8 +226,8 @@ void load_configuration(xcb_connection_t *conn, const
/* We first check for ~/.i3/config, then for /etc/i3/config */
char *globbed = glob_path("~/.i3/config");
if ((handle = fopen(globbed, "r")) == NULL)
- if ((handle = fopen("/etc/i3/config", "r")) == NULL)
- die("Neither \"%s\" nor /etc/i3/config could be opened\n", globbed);
+ if ((handle = fopen("${SYSCONFDIR}/i3/config", "r")) == NULL)
+ die("Neither \"%s\" nor ${SYSCONFDIR}/i3/config could be opened\n", globbed);
free(globbed);
}
char key[512], value[512], buffer[1026];
@@ -312,7 +312,17 @@ void load_configuration(xcb_connection_t *conn, const
rest++;
if (*rest != ' ')
die("Invalid binding (keysym)\n");
- new->symbol = strndup(sym, (rest - sym));
+#if defined(__OpenBSD__)
+ size_t len = strlen(sym);
+ if( len > (rest - sym))
+ len = (rest - sym);
+ new->symbol = malloc(len + 1);
+ memcpy(new->symbol,sym,len+1);
+ new->symbol[len]='\0';
+#else
+ new->symbol = strndup(sym, (rest - sym));
+#endif
+
}
rest++;
LOG("keycode = %d, symbol = %s, modifiers = %d, command = *%s*\n", new->keycode, new->symbol, modifiers, rest);