version 1.1, 2004/12/21 18:15:55 |
version 1.2, 2005/01/31 16:49:28 |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include <errno.h> |
#include <errno.h> |
|
#include <fcntl.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
#include <libgen.h> |
#include <sysexits.h> |
#include <sysexits.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
|
|
cvs_remove_file(CVSFILE *cf, void *arg) |
cvs_remove_file(CVSFILE *cf, void *arg) |
{ |
{ |
int ret; |
int ret; |
|
char fpath[MAXPATHLEN]; |
struct cvsroot *root; |
struct cvsroot *root; |
|
CVSENTRIES *entfile; |
|
struct cvs_ent *ent; |
|
|
ret = 0; |
ret = 0; |
|
ent = NULL; |
root = CVS_DIR_ROOT(cf); |
root = CVS_DIR_ROOT(cf); |
|
|
if (cf->cf_type == DT_DIR) { |
if (cf->cf_type == DT_DIR) { |
|
|
return (ret); |
return (ret); |
} |
} |
|
|
|
cvs_file_getpath(cf, fpath, sizeof(fpath)); |
|
|
|
entfile = cvs_ent_open(dirname(fpath), O_RDWR); |
|
if (entfile == NULL) { |
|
cvs_log(LP_ERR, "failed to remove `%s'", fpath); |
|
return (-1); |
|
} |
|
|
|
ent = cvs_ent_get(entfile, CVS_FILE_NAME(cf)); |
|
|
if (root->cr_method != CVS_METHOD_LOCAL) { |
if (root->cr_method != CVS_METHOD_LOCAL) { |
ret = cvs_sendreq(root, CVS_REQ_REMOVE, CVS_FILE_NAME(cf)); |
if (ent != NULL) |
|
ret = cvs_sendentry(root, ent); |
} else { |
} else { |
cvs_log(LP_INFO, "scheduling file `%s' for removal", |
cvs_log(LP_INFO, "scheduling file `%s' for removal", |
CVS_FILE_NAME(cf)); |
CVS_FILE_NAME(cf)); |
cvs_log(LP_INFO, "use `%s commit' to remove this file permanently", |
cvs_log(LP_INFO, |
|
"use `%s commit' to remove this file permanently", |
__progname); |
__progname); |
} |
} |
|
|
|
cvs_ent_close(entfile); |
|
|
return (ret); |
return (ret); |
} |
} |