Added code for nonstandard function strsep()
Signed-off-by: Dan Fandrich <dan@coneharvesters.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
		
				
					committed by
					
						
						Denys Vlasenko
					
				
			
			
				
	
			
			
			
						parent
						
							fdd7b566ec
						
					
				
				
					commit
					0635ddd8f7
				
			@@ -107,3 +107,30 @@ char* FAST_FUNC strcasestr(const char *s, const char *pattern)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_STRSEP
 | 
			
		||||
/* Copyright (C) 2004 Free Software Foundation, Inc. */
 | 
			
		||||
char* FAST_FUNC strsep(char **stringp, const char *delim)
 | 
			
		||||
{
 | 
			
		||||
	char *start = *stringp;
 | 
			
		||||
	char *ptr;
 | 
			
		||||
 | 
			
		||||
	if (!start)
 | 
			
		||||
		return NULL;
 | 
			
		||||
 | 
			
		||||
	if (!*delim)
 | 
			
		||||
		ptr = start + strlen(start);
 | 
			
		||||
	else {
 | 
			
		||||
		ptr = strpbrk(start, delim);
 | 
			
		||||
		if (!ptr) {
 | 
			
		||||
			*stringp = NULL;
 | 
			
		||||
			return start;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	*ptr = '\0';
 | 
			
		||||
	*stringp = ptr + 1;
 | 
			
		||||
 | 
			
		||||
	return start;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user