aboutsummaryrefslogtreecommitdiff
path: root/src/string/strsep.c
blob: c5e853d91f53bd1c619f4d4b420496b1b7bccb74 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#define _GNU_SOURCE
#include <string.h>

char *strsep(char **str, const char *sep)
{
	char *s = *str, *end;
	if (!s) return NULL;
	end = s + strcspn(s, sep);
	if (*end) *end++ = 0;
	else end = 0;
	*str = end;
	return s;
}


#ifdef TEST
int
main(void) {
	return 0;
}
#endif