wmii

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

stokenize.c (379B)


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