strtok.c

来自「newos is new operation system」· C语言 代码 · 共 30 行

C
30
字号
/* ** Copyright 2001, Travis Geiselbrecht. All rights reserved.** Distributed under the terms of the NewOS License.*/#include <string.h>#include <sys/types.h>static char *___strtok = NULL;char *strtok(char *s, char const *ct){	char *sbegin, *send;	sbegin  = s ? s : ___strtok;	if (!sbegin) {		return NULL;	}	sbegin += strspn(sbegin,ct);	if (*sbegin == '\0') {		___strtok = NULL;		return( NULL );	}	send = strpbrk( sbegin, ct);	if (send && *send != '\0')		*send++ = '\0';	___strtok = send;	return (sbegin);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?