version 1.70, 2007/01/12 23:32:01 |
version 1.71, 2007/01/12 23:56:11 |
|
|
void |
void |
cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, BUF *bp, int flags) |
cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, BUF *bp, int flags) |
{ |
{ |
BUF *nbp; |
|
int l, oflags, exists; |
int l, oflags, exists; |
time_t rcstime; |
time_t rcstime; |
CVSENTRIES *ent; |
CVSENTRIES *ent; |
struct timeval tv[2]; |
struct timeval tv[2]; |
char *p, *entry, rev[16], timebuf[64], tbuf[32], stickytag[32]; |
char *p, *entry, rev[16], timebuf[64], tbuf[32], stickytag[32]; |
|
|
nbp = NULL; |
|
|
|
rcsnum_tostr(rnum, rev, sizeof(rev)); |
rcsnum_tostr(rnum, rev, sizeof(rev)); |
|
|
cvs_log(LP_TRACE, "cvs_checkout_file(%s, %s, %d) -> %s", |
cvs_log(LP_TRACE, "cvs_checkout_file(%s, %s, %d) -> %s", |
cf->file_path, rev, flags, |
cf->file_path, rev, flags, |
(cvs_server_active) ? "to client" : "to disk"); |
(cvs_server_active) ? "to client" : "to disk"); |
|
|
if (bp != NULL) |
|
|
|
if (flags & CO_DUMP) { |
if (flags & CO_DUMP) { |
if (cvs_server_active) { |
if (cvs_server_active) { |
cvs_printf("dump file %s to client\n", cf->file_path); |
cvs_printf("dump file %s to client\n", cf->file_path); |
} else { |
} else { |
if (nbp == NULL) { |
rcs_rev_write_fd(cf->file_rcs, rnum, |
rcs_rev_write_fd(cf->file_rcs, rnum, |
STDOUT_FILENO, 1); |
STDOUT_FILENO, 1); |
|
} else { |
|
if (cvs_buf_write_fd(nbp, STDOUT_FILENO == -1)) |
|
fatal("cvs_checkout_file: %s", strerror(errno)); |
|
} |
|
} |
} |
|
|
return; |
return; |
|
|
if (cf->fd == -1) |
if (cf->fd == -1) |
fatal("cvs_checkout_file: open: %s", strerror(errno)); |
fatal("cvs_checkout_file: open: %s", strerror(errno)); |
|
|
if (nbp == NULL) { |
rcs_rev_write_fd(cf->file_rcs, rnum, cf->fd, 1); |
rcs_rev_write_fd(cf->file_rcs, rnum, cf->fd, 1); |
|
} else { |
|
if (cvs_buf_write_fd(nbp, STDOUT_FILENO == -1)) |
|
fatal("cvs_checkout_file: %s", strerror(errno)); |
|
} |
|
|
|
if (fchmod(cf->fd, 0644) == -1) |
if (fchmod(cf->fd, 0644) == -1) |
fatal("cvs_checkout_file: fchmod: %s", strerror(errno)); |
fatal("cvs_checkout_file: fchmod: %s", strerror(errno)); |
|
|
cvs_remote_output(entry); |
cvs_remote_output(entry); |
|
|
if (!(flags & CO_COMMIT)) { |
if (!(flags & CO_COMMIT)) { |
|
#if 0 |
cvs_remote_output("u=rw,g=rw,o=rw"); |
cvs_remote_output("u=rw,g=rw,o=rw"); |
|
|
/* XXX */ |
/* XXX */ |
|
|
if (cvs_buf_write_fd(nbp, STDOUT_FILENO) == -1) |
if (cvs_buf_write_fd(nbp, STDOUT_FILENO) == -1) |
fatal("cvs_checkout_file: failed to send file"); |
fatal("cvs_checkout_file: failed to send file"); |
cvs_buf_free(nbp); |
cvs_buf_free(nbp); |
|
#endif |
} |
} |
|
|
if (p != NULL) |
if (p != NULL) |