version 1.255, 2009/03/24 18:33:25 |
version 1.256, 2009/03/25 21:50:33 |
|
|
struct ignore_head dir_ign_pats; |
struct ignore_head dir_ign_pats; |
struct ignore_head checkout_ign_pats; |
struct ignore_head checkout_ign_pats; |
|
|
|
RB_GENERATE(cvs_flisthead, cvs_filelist, flist, cvs_filelist_cmp); |
|
|
void |
void |
cvs_file_init(void) |
cvs_file_init(void) |
{ |
{ |
|
|
int i; |
int i; |
struct cvs_flisthead fl; |
struct cvs_flisthead fl; |
|
|
TAILQ_INIT(&fl); |
RB_INIT(&fl); |
|
|
for (i = 0; i < argc; i++) |
for (i = 0; i < argc; i++) |
cvs_file_get(argv[i], FILE_USER_SUPPLIED, &fl); |
cvs_file_get(argv[i], FILE_USER_SUPPLIED, &fl); |
|
|
} |
} |
|
|
struct cvs_filelist * |
struct cvs_filelist * |
cvs_file_get(const char *name, int flags, struct cvs_flisthead *fl) |
cvs_file_get(char *name, int flags, struct cvs_flisthead *fl) |
{ |
{ |
const char *p; |
char *p; |
struct cvs_filelist *l; |
struct cvs_filelist *l, find; |
|
|
for (p = name; p[0] == '.' && p[1] == '/';) |
for (p = name; p[0] == '.' && p[1] == '/';) |
p += 2; |
p += 2; |
|
|
TAILQ_FOREACH(l, fl, flist) |
find.file_path = p; |
if (!strcmp(l->file_path, p)) |
l = RB_FIND(cvs_flisthead, fl, &find); |
return (l); |
if (l != NULL) |
|
return (l); |
|
|
l = (struct cvs_filelist *)xmalloc(sizeof(*l)); |
l = (struct cvs_filelist *)xmalloc(sizeof(*l)); |
l->file_path = xstrdup(p); |
l->file_path = xstrdup(p); |
l->flags = flags; |
l->flags = flags; |
|
|
TAILQ_INSERT_TAIL(fl, l, flist); |
RB_INSERT(cvs_flisthead, fl, l); |
return (l); |
return (l); |
} |
} |
|
|
|
|
struct cvs_filelist *l, *nxt; |
struct cvs_filelist *l, *nxt; |
char *d, *f, repo[MAXPATHLEN], fpath[MAXPATHLEN]; |
char *d, *f, repo[MAXPATHLEN], fpath[MAXPATHLEN]; |
|
|
for (l = TAILQ_FIRST(fl); l != NULL; l = nxt) { |
for (l = RB_MIN(cvs_flisthead, fl); l != NULL; l = nxt) { |
if (cvs_quit) |
if (cvs_quit) |
fatal("received signal %d", sig_received); |
fatal("received signal %d", sig_received); |
|
|
|
|
cvs_file_free(cf); |
cvs_file_free(cf); |
|
|
next: |
next: |
nxt = TAILQ_NEXT(l, flist); |
nxt = RB_NEXT(cvs_flisthead, fl, l); |
} |
} |
} |
} |
|
|
|
|
* locally available directories or try to create them. |
* locally available directories or try to create them. |
*/ |
*/ |
if (!(cmdp->cmd_flags & CVS_USE_WDIR)) { |
if (!(cmdp->cmd_flags & CVS_USE_WDIR)) { |
TAILQ_INIT(&fl); |
RB_INIT(&fl); |
TAILQ_INIT(&dl); |
RB_INIT(&dl); |
goto walkrepo; |
goto walkrepo; |
} |
} |
|
|
|
|
bufsize = st.st_blksize; |
bufsize = st.st_blksize; |
|
|
buf = xmalloc(bufsize); |
buf = xmalloc(bufsize); |
TAILQ_INIT(&fl); |
RB_INIT(&fl); |
TAILQ_INIT(&dl); |
RB_INIT(&dl); |
|
|
while ((nbytes = getdirentries(cf->fd, buf, bufsize, &base)) > 0) { |
while ((nbytes = getdirentries(cf->fd, buf, bufsize, &base)) > 0) { |
ebuf = buf + nbytes; |
ebuf = buf + nbytes; |
|
|
void |
void |
cvs_file_freelist(struct cvs_flisthead *fl) |
cvs_file_freelist(struct cvs_flisthead *fl) |
{ |
{ |
struct cvs_filelist *f; |
struct cvs_filelist *f, *nxt; |
|
|
while ((f = TAILQ_FIRST(fl)) != NULL) { |
for (f = RB_MIN(cvs_flisthead, fl); f != NULL; f = nxt) { |
TAILQ_REMOVE(fl, f, flist); |
nxt = RB_NEXT(cvs_flisthead, fl, f); |
|
RB_REMOVE(cvs_flisthead, fl, f); |
xfree(f->file_path); |
xfree(f->file_path); |
xfree(f); |
xfree(f); |
} |
} |
|
|
(void)close(src); |
(void)close(src); |
|
|
return (ret); |
return (ret); |
|
} |
|
|
|
int |
|
cvs_filelist_cmp(struct cvs_filelist *f1, struct cvs_filelist *f2) |
|
{ |
|
return (strcmp(f1->file_path, f2->file_path)); |
} |
} |