version 1.11, 2005/04/12 14:58:40 |
version 1.12, 2005/04/16 20:05:05 |
|
|
int |
int |
cvs_import_file(CVSFILE *cfp, void *arg) |
cvs_import_file(CVSFILE *cfp, void *arg) |
{ |
{ |
int ret; |
int ret, l; |
struct cvsroot *root; |
struct cvsroot *root; |
char fpath[MAXPATHLEN], repodir[MAXPATHLEN]; |
char fpath[MAXPATHLEN], repodir[MAXPATHLEN]; |
char repo[MAXPATHLEN]; |
char repo[MAXPATHLEN]; |
|
|
root = CVS_DIR_ROOT(cfp); |
root = CVS_DIR_ROOT(cfp); |
snprintf(repo, sizeof(repo), "%s/%s", root->cr_dir, module); |
l = snprintf(repo, sizeof(repo), "%s/%s", root->cr_dir, module); |
|
if (l == -1 || l >= (int)sizeof(repo)) { |
|
errno = ENAMETOOLONG; |
|
cvs_log(LP_ERRNO, "%s", repo); |
|
return (-1); |
|
} |
|
|
cvs_file_getpath(cfp, fpath, sizeof(fpath)); |
cvs_file_getpath(cfp, fpath, sizeof(fpath)); |
printf("Importing %s\n", fpath); |
printf("Importing %s\n", fpath); |
|
|
if (cfp->cf_type == DT_DIR) { |
if (cfp->cf_type == DT_DIR) { |
if (!strcmp(CVS_FILE_NAME(cfp), ".")) |
if (!strcmp(CVS_FILE_NAME(cfp), ".")) |
strlcpy(repodir, repo, sizeof(repodir)); |
strlcpy(repodir, repo, sizeof(repodir)); |
else |
else { |
snprintf(repodir, sizeof(repodir), "%s/%s", repo, fpath); |
l = snprintf(repodir, sizeof(repodir), "%s/%s", |
|
repo, fpath); |
|
if (l == -1 || l >= (int)sizeof(repodir)) { |
|
errno = ENAMETOOLONG; |
|
cvs_log(LP_ERRNO, "%s", repodir); |
|
return (-1); |
|
} |
|
} |
if (root->cr_method != CVS_METHOD_LOCAL) { |
if (root->cr_method != CVS_METHOD_LOCAL) { |
ret = cvs_sendreq(root, CVS_REQ_DIRECTORY, fpath); |
ret = cvs_sendreq(root, CVS_REQ_DIRECTORY, fpath); |
if (ret == 0) |
if (ret == 0) |