FreeBSD/sbin/restore/dirs.c
/*
 * Lookup a pathname which is always assumed to start from the ROOTINO.
 */
Lookup a pathname which is always assumed to start from the ROOTINO.
Lookup a pathname which is always assumed to start from the ROOTINO .
struct direct *
pathsearch(const char *pathname)
{
	ino_t ino;
	struct direct *dp;
	char *path, *name, buffer[MAXPATHLEN];
	strcpy(buffer, pathname);
	path = buffer;
	ino = ROOTINO;
	while (*path == '/')
		path++;
	dp = NULL;
	while ((name = strsep(&path, "/")) != NULL && *name != '\0') {
		if ((dp = searchdir(ino, name)) == NULL)
			return (NULL);
		ino = dp->d_ino;
	}
	return (dp);
}
struct direct * pathsearch ( const char * pathname ) { ino_t ino ; struct direct * dp ; char * path , * name , buffer [ MAXPATHLEN ] ; strcpy ( buffer , pathname ) ; path = buffer ; ino = ROOTINO ; while ( * path == ' ' ) path ++ ; dp = NULL ; while ( ( name = strsep ( & path , " " ) ) != NULL && * name != ' \0 ' ) { if ( ( dp = searchdir ( ino , name ) ) == NULL ) return ( NULL ) ; ino = dp -> d_ino ; } return ( dp ) ; }
Lookup a pathname which is always assumed to start from the ROOTINO.
Lookup a pathname which is always assumed to start from the ROOTINO .