FreeBSD/libexec/rtld-elf/rtld.c
/*
 * Iterate over a search path, translate each element, and invoke the
 * callback on the result.
 */
Iterate over a search path, translate each element, and invoke the
callback on the result.
Iterate over a search path translate each element and invoke the callback on the result .
static void *
path_enumerate(const char *path, path_enum_proc callback, void *arg)
{
    const char *trans;
    if (path == NULL)
	return (NULL);
    path += strspn(path, ":;");
    while (*path != '\0') {
	size_t len;
	char  *res;
	len = strcspn(path, ":;");
	trans = lm_findn(NULL, path, len);
	if (trans)
	    res = callback(trans, strlen(trans), arg);
	else
	    res = callback(path, len, arg);
	if (res != NULL)
	    return (res);
	path += len;
	path += strspn(path, ":;");
    }
    return (NULL);
}
static void * path_enumerate ( const char * path , path_enum_proc callback , void * arg ) { const char * trans ; if ( path == NULL ) return ( NULL ) ; path += strspn ( path , " " ) ; while ( * path != ' \0 ' ) { size_t len ; char * res ; len = strcspn ( path , " " ) ; trans = lm_findn ( NULL , path , len ) ; if ( trans ) res = callback ( trans , strlen ( trans ) , arg ) ; else res = callback ( path , len , arg ) ; if ( res != NULL ) return ( res ) ; path += len ; path += strspn ( path , " " ) ; } return ( NULL ) ; }
Iterate over a search path, translate each element, and invoke the
 callback on the result.
Iterate over a search path translate each element and invoke the callback on the result .