changeset: 2170:0df93ace378a
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Wed Jun 27 12:57:55 2007 -0400
summary: Fix run_command. Fix crash on 64 bit archs.
diff -r 80267db05675 -r 0df93ace378a cmd/wmii/message.c
--- a/cmd/wmii/message.c Tue Jun 26 22:39:03 2007 -0400
+++ b/cmd/wmii/message.c Wed Jun 27 12:57:55 2007 -0400
@@ -347,13 +347,18 @@ message_root(void *p, Message *m) {
char *
read_root_ctl(void) {
- uint i = 0;
- i += snprintf(&buffer[i], (sizeof(buffer) - i), "view %s\n", screen->sel->name);
- i += snprintf(&buffer[i], (sizeof(buffer) - i), "focuscolors %s\n", def.focuscolor.colstr);
- i += snprintf(&buffer[i], (sizeof(buffer) - i), "normcolors %s\n", def.normcolor.colstr);
- i += snprintf(&buffer[i], (sizeof(buffer) - i), "font %s\n", def.font->name);
- i += snprintf(&buffer[i], (sizeof(buffer) - i), "grabmod %s\n", def.grabmod);
- i += snprintf(&buffer[i], (sizeof(buffer) - i), "border %d\n", def.border);
+ char *b, *e;
+
+ b = buffer;
+ e = b + sizeof(buffer);
+#define print(...) if(b < e) snprintf(b, e-b, __VA_ARGS__)
+ print("view %s\n", screen->sel->name);
+ print("focuscolors %s\n", def.focuscolor.colstr);
+ print("normcolors %s\n", def.normcolor.colstr);
+ print("font %s\n", def.font->name);
+ print("grabmod %s\n", def.grabmod);
+ print("border %d\n", def.border);
+#undef print
return buffer;
}
diff -r 80267db05675 -r 0df93ace378a cmd/wmii/utf.c
--- a/cmd/wmii/utf.c Tue Jun 26 22:39:03 2007 -0400
+++ b/cmd/wmii/utf.c Wed Jun 27 12:57:55 2007 -0400
@@ -324,7 +324,7 @@ toutf8n(char *str, int nstr) {
toutf8n(char *str, int nstr) {
static iconv_t cd;
char *buf, *pos;
- int nbuf, bsize;
+ size_t nbuf, bsize;
if(cd == nil)
cd = iconv_open("UTF-8", "");
diff -r 80267db05675 -r 0df93ace378a rc/rc.wmii.rc
--- a/rc/rc.wmii.rc Tue Jun 26 22:39:03 2007 -0400
+++ b/rc/rc.wmii.rc Wed Jun 27 12:57:55 2007 -0400
@@ -100,8 +100,11 @@ fn read_tags {
}
fn run_command {
+ @{
rfork ns
- path=$oldpath { eval exec $* }
+ path=$oldpath
+ eval exec $* &
+ }
}
fn Event-CreateTag { echo $WMII_NORMCOLORS `{viewtitle $*} | wmiir create /lbar/$"* }
Received on Wed Jun 27 2007 - 18:58:29 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:24 UTC