1570af302Sopenharmony_ci#define _GNU_SOURCE
2570af302Sopenharmony_ci#include <string.h>
3570af302Sopenharmony_ci
4570af302Sopenharmony_cichar *strsep(char **str, const char *sep)
5570af302Sopenharmony_ci{
6570af302Sopenharmony_ci	char *s = *str, *end;
7570af302Sopenharmony_ci	if (!s) return NULL;
8570af302Sopenharmony_ci	end = s + strcspn(s, sep);
9570af302Sopenharmony_ci	if (*end) *end++ = 0;
10570af302Sopenharmony_ci	else end = 0;
11570af302Sopenharmony_ci	*str = end;
12570af302Sopenharmony_ci	return s;
13570af302Sopenharmony_ci}
14