Fix run_command. Fix crash on 64 bit archs.

This commit is contained in:
Kris Maglione 2007-06-27 12:57:55 -04:00
parent 511731482b
commit 8f766a75af
3 changed files with 17 additions and 9 deletions

View File

@ -347,13 +347,18 @@ message_root(void *p, Message *m) {
char * char *
read_root_ctl(void) { read_root_ctl(void) {
uint i = 0; char *b, *e;
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); b = buffer;
i += snprintf(&buffer[i], (sizeof(buffer) - i), "normcolors %s\n", def.normcolor.colstr); e = b + sizeof(buffer);
i += snprintf(&buffer[i], (sizeof(buffer) - i), "font %s\n", def.font->name); #define print(...) if(b < e) snprintf(b, e-b, __VA_ARGS__)
i += snprintf(&buffer[i], (sizeof(buffer) - i), "grabmod %s\n", def.grabmod); print("view %s\n", screen->sel->name);
i += snprintf(&buffer[i], (sizeof(buffer) - i), "border %d\n", def.border); 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; return buffer;
} }

View File

@ -324,7 +324,7 @@ char*
toutf8n(char *str, int nstr) { toutf8n(char *str, int nstr) {
static iconv_t cd; static iconv_t cd;
char *buf, *pos; char *buf, *pos;
int nbuf, bsize; size_t nbuf, bsize;
if(cd == nil) if(cd == nil)
cd = iconv_open("UTF-8", ""); cd = iconv_open("UTF-8", "");

View File

@ -100,8 +100,11 @@ fn read_tags {
} }
fn run_command { fn run_command {
@{
rfork ns rfork ns
path=$oldpath { eval exec $* } path=$oldpath
eval exec $* &
}
} }
fn Event-CreateTag { echo $WMII_NORMCOLORS `{viewtitle $*} | wmiir create /lbar/$"* } fn Event-CreateTag { echo $WMII_NORMCOLORS `{viewtitle $*} | wmiir create /lbar/$"* }