wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

changeprop_textlist.c (488B)


      1 /* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
      2  * See LICENSE file for license details.
      3  */
      4 #include <string.h>
      5 #include "../x11.h"
      6 
      7 void
      8 changeprop_textlist(Window *w, const char *prop, const char *type, char *data[]) {
      9 	char **p, *s, *t;
     10 	int len, n;
     11 
     12 	len = 0;
     13 	for(p=data; *p; p++)
     14 		len += strlen(*p) + 1;
     15 	s = emalloc(len);
     16 	t = s;
     17 	for(p=data; *p; p++) {
     18 		n = strlen(*p) + 1;
     19 		memcpy(t, *p, n);
     20 		t += n;
     21 	}
     22 	changeprop_char(w, prop, type, s, len - 1);
     23 	free(s);
     24 }