Beispiel #1
0
char *word_dup(const char *s)
{
	const char *start = s;
	while(iswordpart(*s))
		s++;
	return ustrdup2(start, s);
}
Beispiel #2
0
char *word_find(char *line, char *word)
{
	const int wordlen = strlen(word);
	char *pos = line;

	while((pos = word_strstr(pos, word))){
		char *fin;
		if(pos > line && iswordpart(pos[-1])){
			pos++;
			continue;
		}
		fin = pos + wordlen;
		if(iswordpart(*fin)){
			pos++;
			continue;
		}
		return pos;
	}
	return NULL;
}
Beispiel #3
0
char *word_find_any(char *s)
{
	for(; *s; s++){
		switch(*s){
			case '"':
			case '\'':
				s = str_quotefin2(s + 1, *s);
				if(!s)
					return NULL;
				break;
		}
		if(iswordpart(*s))
			return s;
	}
	return NULL;
}
Beispiel #4
0
char *word_end(char *s)
{
	for(; iswordpart(*s); s++);
	return s;
}