if (namelen >= sizeof(locname)) namelen = sizeof(locname) - 1;
treescan(pname, ino, todo)	char *pname;	ino_t ino;	long (*todo) __P((char *, ino_t, int));{	register struct inotab *itp;	register struct direct *dp;	int namelen;	long bpt;	char locname[MAXPATHLEN + 1];	itp = inotablookup(ino);	if (itp == NULL) {		/*		 * Pname is name of a simple file or an unchanged directory.		 */		(void)(*todo)(pname, ino, LEAF);		return;	}	/*	 * Pname is a dumped directory name.	 */	if ((*todo)(pname, ino, NODE) == FAIL)		return;	/*	 * begin search through the directory	 * skipping over "." and ".."	 */	namelen = snprintf(locname, sizeof(locname), "%s/", pname);	rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt);	dp = rst_readdir(dirp); /* "." */	if (dp != NULL && strcmp(dp->d_name, ".") == 0)		dp = rst_readdir(dirp); /* ".." */	else		fprintf(stderr, "Warning: `.' missing from directory %s\n",			pname);	if (dp != NULL && strcmp(dp->d_name, "..") == 0)		dp = rst_readdir(dirp); /* first real entry */	else		fprintf(stderr, "Warning: `..' missing from directory %s\n",			pname);	bpt = rst_telldir(dirp);	/*	 * a zero inode signals end of directory	 */	while (dp != NULL) {		locname[namelen] = '\0';		if (namelen + dp->d_namlen >= sizeof(locname)) {			fprintf(stderr, "%s%s: name exceeds %d char\n",				locname, dp->d_name, sizeof(locname) - 1);		} else {			(void)strncat(locname, dp->d_name, (int)dp->d_namlen);			treescan(locname, dp->d_ino, todo);			rst_seekdir(dirp, bpt, itp->t_seekpt);		}		dp = rst_readdir(dirp);		bpt = rst_telldir(dirp);	}}