mirror of
https://github.com/0intro/wmii
synced 2024-11-22 13:52:17 +03:00
22 lines
338 B
C
22 lines
338 B
C
/* Written by Kris Maglione <maglione.k at Gmail> */
|
|
/* Public domain */
|
|
#include "util.h"
|
|
|
|
uint
|
|
tokenize(char *res[], uint reslen, char *str, char delim) {
|
|
char *s;
|
|
uint i;
|
|
|
|
i = 0;
|
|
s = str;
|
|
while(i < reslen && *s) {
|
|
while(*s == delim)
|
|
*(s++) = '\0';
|
|
if(*s)
|
|
res[i++] = s;
|
|
while(*s && *s != delim)
|
|
s++;
|
|
}
|
|
return i;
|
|
}
|