version 1.34, 2005/08/12 06:36:14 |
version 1.35, 2005/08/22 11:17:26 |
|
|
*/ |
*/ |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/stat.h> |
|
|
#include <errno.h> |
#include <errno.h> |
#include <fcntl.h> |
#include <fcntl.h> |
|
|
{ |
{ |
int existing, l, removed; |
int existing, l, removed; |
char buf[MAXPATHLEN], fpath[MAXPATHLEN]; |
char buf[MAXPATHLEN], fpath[MAXPATHLEN]; |
|
CVSENTRIES *entf; |
|
|
existing = removed = 0; |
existing = removed = 0; |
|
entf = (CVSENTRIES *)cf->cf_entry; |
|
|
if (cf->cf_type == DT_DIR) { |
if (cf->cf_type == DT_DIR) { |
if (verbosity > 1) |
if (verbosity > 1) |
|
|
cf->cf_name); |
cf->cf_name); |
return (0); |
return (0); |
} else if (cf->cf_cvstat == CVS_FST_ADDED) { |
} else if (cf->cf_cvstat == CVS_FST_ADDED) { |
|
if (cvs_ent_remove(entf, cf->cf_name) == -1) |
|
return (CVS_EX_FILE); |
|
|
/* XXX scratch it from CVS/Entries */ |
|
|
|
l = snprintf(buf, sizeof(buf), "%s/%s%s", |
l = snprintf(buf, sizeof(buf), "%s/%s%s", |
CVS_PATH_CVSDIR, cf->cf_name, CVS_DESCR_FILE_EXT); |
CVS_PATH_CVSDIR, cf->cf_name, CVS_DESCR_FILE_EXT); |
if (l == -1 || l >= (int)sizeof(buf)) { |
if (l == -1 || l >= (int)sizeof(buf)) { |
|
|
cvs_log(LP_ERRNO, "%s", buf); |
cvs_log(LP_ERRNO, "%s", buf); |
return (CVS_EX_DATA); |
return (CVS_EX_DATA); |
} |
} |
|
|
if (cvs_unlink(buf) == -1) |
if (cvs_unlink(buf) == -1) |
return (CVS_EX_FILE); |
return (CVS_EX_FILE); |
|
|
|
|
static int |
static int |
cvs_remove_file(const char *fpath) |
cvs_remove_file(const char *fpath) |
{ |
{ |
|
struct stat st; |
|
|
/* if -f option is used, physically remove the file */ |
/* if -f option is used, physically remove the file */ |
if (force_remove == 1) { |
if (force_remove == 1) { |
if(cvs_unlink(fpath) == -1) |
if(cvs_unlink(fpath) == -1) |
return (-1); |
return (-1); |
nuked++; |
nuked++; |
|
} else { |
|
if ((stat(fpath, &st) == -1) && (errno == ENOENT)) |
|
nuked++; |
} |
} |
|
|
return (0); |
return (0); |