1
0
mirror of https://github.com/peterantypas/maiana.git synced 2025-06-08 10:40:19 -07:00
2022-12-11 21:32:49 -08:00

18 lines
304 B
C

#include "utils.h"
#include <string.h>
int tokenize(char *msg, const char *sep, char **index, int max_tokens)
{
char *token;
int indexpos = 0;
while ( (token=strsep(&msg, sep)) )
{
if ( indexpos < max_tokens )
index[indexpos++] = token;
else
break;
}
return indexpos;
}