printf("cvsroot = %s\n", cdp->cd_root->cr_str);
cvs_file_getdir(CVSFILE *cf, int flags){	int ret, fd;	long base;	void *dp, *ep;	char fbuf[2048], pbuf[MAXPATHLEN];	struct dirent *ent;	CVSFILE *cfp;	struct cvs_dir *cdp;	struct cvs_flist dirs;	TAILQ_INIT(&dirs);	cdp = cf->cf_ddat;	if (cvs_readrepo(cf->cf_path, pbuf, sizeof(pbuf)) == 0) {		cdp->cd_repo = strdup(pbuf);		if (cdp->cd_repo == NULL) {			free(cdp);			return (-1);		}	}	cdp->cd_root = cvsroot_get(cf->cf_path);	printf("cvsroot = %s\n", cdp->cd_root->cr_str);	if (cdp->cd_root == NULL) {		cvs_file_freedir(cdp);		return (-1);	}	if (flags & CF_MKADMIN)		cvs_mkadmin(cf, 0755);	cdp->cd_ent = cvs_ent_open(cf->cf_path, O_RDONLY);	fd = open(cf->cf_path, O_RDONLY);	if (fd == -1) {		cvs_log(LP_ERRNO, "failed to open `%s'", cf->cf_path);		cvs_file_freedir(cdp);		return (-1);	}	do {		ret = getdirentries(fd, fbuf, sizeof(fbuf), &base);		if (ret == -1) {			cvs_log(LP_ERRNO, "failed to get directory entries");			(void)close(fd);			cvs_file_freedir(cdp);			return (-1);		}		dp = fbuf;		ep = fbuf + (size_t)ret;		while (dp < ep) {			ent = (struct dirent *)dp;			dp += ent->d_reclen;			if ((flags & CF_IGNORE) && cvs_file_chkign(ent->d_name))				continue;			snprintf(pbuf, sizeof(pbuf), "%s/%s",			    cf->cf_path, ent->d_name);			cfp = cvs_file_lget(pbuf, flags, cf);			if (cfp != NULL) {				cfp->cf_parent = cf;				if (cfp->cf_type == DT_DIR) 					TAILQ_INSERT_HEAD(&dirs, cfp, cf_list);				else					TAILQ_INSERT_HEAD(&(cdp->cd_files), cfp,					    cf_list);			}		}	} while (ret > 0);	/* we can now close our Entries file */	if (cdp->cd_ent != NULL) {		cvs_ent_close(cdp->cd_ent);		cdp->cd_ent = NULL;	}	if (flags & CF_SORT) {		cvs_file_sort(&(cdp->cd_files));		cvs_file_sort(&dirs);	}	TAILQ_FOREACH(cfp, &dirs, cf_list)		TAILQ_INSERT_TAIL(&(cdp->cd_files), cfp, cf_list);	(void)close(fd);	cf->cf_ddat = cdp;	return (0);}