wmii

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

unmask.c (398B)


      1 /* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
      2  * See LICENSE file for license details.
      3  */
      4 #include <fmt.h>
      5 #include "util.h"
      6 
      7 int
      8 unmask(Fmt *f, long mask, char **table, long sep) {
      9 	int i, nfmt;
     10 
     11 	nfmt = f->nfmt;
     12 	for(i=0; table[i]; i++)
     13 		if(*table[i] && (mask & (1<<i))) {
     14 			if(f->nfmt > nfmt)
     15 				fmtrune(f, sep);
     16 			if(fmtstrcpy(f, table[i]))
     17 				return -1;
     18 		}
     19 	return 0;
     20 }
     21