wmii

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

tokenize.c (338B)


      1 /* Written by Kris Maglione <maglione.k at Gmail> */
      2 /* Public domain */
      3 #include "util.h"
      4 
      5 uint
      6 tokenize(char *res[], uint reslen, char *str, char delim) {
      7 	char *s;
      8 	uint i;
      9 
     10 	i = 0;
     11 	s = str;
     12 	while(i < reslen && *s) {
     13 		while(*s == delim)
     14 			*(s++) = '\0';
     15 		if(*s)
     16 			res[i++] = s;
     17 		while(*s && *s != delim)
     18 			s++;
     19 	}
     20 	return i;
     21 }