⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 strtok.c

📁 harvest是一个下载html网页得机器人
💻 C
字号:
/* * Get next token from string s (NULL on 2nd, 3rd, etc. calls), * where tokens are nonempty strings separated by runs of * chars from delim.  Writes NULs into s to end tokens.  delim need not * remain constant from call to call. * * Copyright (c) Henry Spencer. * Written by Henry Spencer. * * This software is not subject to any license of the American Telephone * and Telegraph Company or of the Regents of the University of California. * * Permission is granted to anyone to use this software for any purpose on * any computer system, and to alter it and redistribute it freely, subject * to the following restrictions: * * 1. The author is not responsible for the consequences of use of this *    software, no matter how awful, even if they arise from flaws in it. * * 2. The origin of this software must not be misrepresented, either by *    explicit claim or by omission.  Since few users ever read sources, *    credits must appear in the documentation. * * 3. Altered versions must be plainly marked as such, and must not be *    misrepresented as being the original software.  Since few users *    ever read sources, credits must appear in the documentation. * * 4. This notice may not be removed or altered. */#define	NULL	0#define CONSTstatic char *scanpoint = NULL;char *				/* NULL if no token left */     strtok(s, delim)     char *s;     register CONST char *delim;{	register char *scan;	char *tok;	register CONST char *dscan;	if (s == NULL && scanpoint == NULL)		return (NULL);	if (s != NULL)		scan = s;	else		scan = scanpoint;	/*	 * Scan leading delimiters.	 */	for (; *scan != '\0'; scan++) {		for (dscan = delim; *dscan != '\0'; dscan++)			if (*scan == *dscan)				break;		if (*dscan == '\0')			break;	}	if (*scan == '\0') {		scanpoint = NULL;		return (NULL);	}	tok = scan;	/*	 * Scan token.	 */	for (; *scan != '\0'; scan++) {		for (dscan = delim; *dscan != '\0';)	/* ++ moved down. */			if (*scan == *dscan++) {				scanpoint = scan + 1;				*scan = '\0';				return (tok);			}	}	/*	 * Reached end of string.	 */	scanpoint = NULL;	return (tok);}

⌨️ 快捷键说明

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