version 1.136, 2006/04/05 01:38:55 |
version 1.137, 2006/04/14 02:45:35 |
|
|
} |
} |
|
|
cfp->cf_repo = xstrdup(repo); |
cfp->cf_repo = xstrdup(repo); |
if (((mkdir(path, mode) == -1) && (errno != EEXIST)) || |
if ((mkdir(path, mode) == -1 && errno != EEXIST) || |
(cvs_mkadmin(path, cfp->cf_root->cr_str, cfp->cf_repo, |
cvs_mkadmin(path, cfp->cf_root->cr_str, cfp->cf_repo, |
NULL, NULL, 0) < 0)) { |
NULL, NULL, 0) < 0) { |
cvs_file_free(cfp); |
cvs_file_free(cfp); |
return (NULL); |
return (NULL); |
} |
} |
|
|
if (cb == NULL) |
if (cb == NULL) |
callit = 0; |
callit = 0; |
|
|
if ((cvs_cmdop == CVS_OP_SERVER) && (type != DT_DIR)) |
if (cvs_cmdop == CVS_OP_SERVER && type != DT_DIR) |
callit = 0; |
callit = 0; |
|
|
if ((root->cr_method == CVS_METHOD_LOCAL) && (type != DT_DIR)) |
if (root->cr_method == CVS_METHOD_LOCAL && type != DT_DIR) |
callit = 0; |
callit = 0; |
|
|
if (!(base->cf_flags & CVS_FILE_ONDISK)) |
if (!(base->cf_flags & CVS_FILE_ONDISK)) |
|
|
* If we have a normal file, pass it as well. |
* If we have a normal file, pass it as well. |
*/ |
*/ |
if (type != DT_DIR) { |
if (type != DT_DIR) { |
if ((cb != NULL) && ((cvs_error = cb(cf, arg)) != CVS_EX_OK)) |
if (cb != NULL && (cvs_error = cb(cf, arg)) != CVS_EX_OK) |
goto fail; |
goto fail; |
} else { |
} else { |
/* |
/* |
|
|
|
|
/* special case */ |
/* special case */ |
if (*pp == '.') { |
if (*pp == '.') { |
if ((*(pp + 1) == '.') && (*(pp + 2) == '\0')) { |
if (*(pp + 1) == '.' && *(pp + 2) == '\0') { |
/* request to go back to parent */ |
/* request to go back to parent */ |
if (cf->cf_parent == NULL) { |
if (cf->cf_parent == NULL) { |
cvs_log(LP_NOTICE, |
cvs_log(LP_NOTICE, |
|
|
return (-1); |
return (-1); |
} |
} |
|
|
if ((stat(pbuf, &st) == 0) && S_ISDIR(st.st_mode)) { |
if (stat(pbuf, &st) == 0 && S_ISDIR(st.st_mode)) { |
if (cvs_readrepo(fpath, pbuf, sizeof(pbuf)) == 0) |
if (cvs_readrepo(fpath, pbuf, sizeof(pbuf)) == 0) |
cf->cf_repo = xstrdup(pbuf); |
cf->cf_repo = xstrdup(pbuf); |
} else { |
} else { |
|
|
struct cvs_flist dirs; |
struct cvs_flist dirs; |
int nfiles, ndirs; |
int nfiles, ndirs; |
|
|
if ((flags & CF_KNOWN) && (cf->cf_cvstat == CVS_FST_UNKNOWN)) |
if ((flags & CF_KNOWN) && cf->cf_cvstat == CVS_FST_UNKNOWN) |
return (0); |
return (0); |
|
|
/* |
/* |
|
|
continue; |
continue; |
} |
} |
|
|
if ((de->d_type != DT_DIR) && (flags & CF_NOFILES)) |
if (de->d_type != DT_DIR && (flags & CF_NOFILES)) |
continue; |
continue; |
|
|
cfp = cvs_file_lget(pbuf, flags, cf, entf, ent); |
cfp = cvs_file_lget(pbuf, flags, cf, entf, ent); |
|
|
* A file is linked to the parent <cf>, a directory |
* A file is linked to the parent <cf>, a directory |
* is added to the dirs SIMPLEQ list for later use. |
* is added to the dirs SIMPLEQ list for later use. |
*/ |
*/ |
if ((cfp->cf_type != DT_DIR) && !freecf) { |
if (cfp->cf_type != DT_DIR && !freecf) { |
SIMPLEQ_INSERT_TAIL(&(cf->cf_files), cfp, cf_list); |
SIMPLEQ_INSERT_TAIL(&(cf->cf_files), cfp, cf_list); |
nfiles++; |
nfiles++; |
} else if (cfp->cf_type == DT_DIR) { |
} else if (cfp->cf_type == DT_DIR) { |
|
|
/* |
/* |
* If we don't want to keep it, free it |
* If we don't want to keep it, free it |
*/ |
*/ |
if ((cfp->cf_type != DT_DIR) && freecf) |
if (cfp->cf_type != DT_DIR && freecf) |
cvs_file_free(cfp); |
cvs_file_free(cfp); |
} |
} |
|
|
|
|
* |
* |
* (Follows the same procedure as above ... can we merge them?) |
* (Follows the same procedure as above ... can we merge them?) |
*/ |
*/ |
while ((entf != NULL) && ((ent = cvs_ent_next(entf)) != NULL)) { |
while (entf != NULL && (ent = cvs_ent_next(entf)) != NULL) { |
if (ent->processed == 1) |
if (ent->processed == 1) |
continue; |
continue; |
if (!(flags & CF_RECURSE) && (ent->ce_type == CVS_ENT_DIR)) |
if (!(flags & CF_RECURSE) && ent->ce_type == CVS_ENT_DIR) |
continue; |
continue; |
if ((flags & CF_NOFILES) && (ent->ce_type != CVS_ENT_DIR)) |
if ((flags & CF_NOFILES) && ent->ce_type != CVS_ENT_DIR) |
continue; |
continue; |
|
|
len = cvs_path_cat(fpath, ent->ce_name, pbuf, sizeof(pbuf)); |
len = cvs_path_cat(fpath, ent->ce_name, pbuf, sizeof(pbuf)); |
|
|
goto done; |
goto done; |
} |
} |
|
|
if ((cfp->cf_type != DT_DIR) && !freecf) { |
if (cfp->cf_type != DT_DIR && !freecf) { |
SIMPLEQ_INSERT_TAIL(&(cf->cf_files), cfp, cf_list); |
SIMPLEQ_INSERT_TAIL(&(cf->cf_files), cfp, cf_list); |
nfiles++; |
nfiles++; |
} else if (cfp->cf_type == DT_DIR) { |
} else if (cfp->cf_type == DT_DIR) { |
|
|
goto done; |
goto done; |
} |
} |
|
|
if ((cfp->cf_type != DT_DIR) && freecf) |
if (cfp->cf_type != DT_DIR && freecf) |
cvs_file_free(cfp); |
cvs_file_free(cfp); |
} |
} |
|
|
|
|
} |
} |
|
|
if ((cfp->cf_flags & CVS_FILE_ONDISK) && |
if ((cfp->cf_flags & CVS_FILE_ONDISK) && |
(cvs_file_getdir(cfp, flags, cb, arg, freecf) < 0)) |
cvs_file_getdir(cfp, flags, cb, arg, freecf) < 0) |
goto done; |
goto done; |
|
|
if (freecf) |
if (freecf) |
|
|
ret = 0; |
ret = 0; |
cfp = NULL; |
cfp = NULL; |
done: |
done: |
if ((cfp != NULL) && freecf) |
if (cfp != NULL && freecf) |
cvs_file_free(cfp); |
cvs_file_free(cfp); |
|
|
while (!SIMPLEQ_EMPTY(&dirs)) { |
while (!SIMPLEQ_EMPTY(&dirs)) { |
|
|
if (ret == 0) |
if (ret == 0) |
type = IFTODT(st.st_mode); |
type = IFTODT(st.st_mode); |
|
|
if ((flags & CF_REPO) && (type != DT_DIR)) { |
if ((flags & CF_REPO) && type != DT_DIR) { |
if ((c = strrchr(path, ',')) == NULL) |
if ((c = strrchr(path, ',')) == NULL) |
return (NULL); |
return (NULL); |
*c = '\0'; |
*c = '\0'; |
|
|
cfp->cf_parent = parent; |
cfp->cf_parent = parent; |
cfp->cf_entry = pent; |
cfp->cf_entry = pent; |
|
|
if ((cfp->cf_type == DT_DIR) && (cfp->cf_parent == NULL)) |
if (cfp->cf_type == DT_DIR && cfp->cf_parent == NULL) |
cfp->cf_flags |= CVS_DIRF_BASE; |
cfp->cf_flags |= CVS_DIRF_BASE; |
|
|
if (ret == 0) { |
if (ret == 0) { |
|
|
xfree(c); |
xfree(c); |
} |
} |
|
|
if ((cfp->cf_repo != NULL) && (cfp->cf_type == DT_DIR) && |
if (cfp->cf_repo != NULL && cfp->cf_type == DT_DIR && |
!strcmp(cfp->cf_repo, path)) |
!strcmp(cfp->cf_repo, path)) |
cfp->cf_cvstat = CVS_FST_UPTODATE; |
cfp->cf_cvstat = CVS_FST_UPTODATE; |
|
|