version 1.27, 2006/03/24 05:14:48 |
version 1.28, 2006/03/24 15:57:29 |
|
|
#include "rcsprog.h" |
#include "rcsprog.h" |
#include "diff.h" |
#include "diff.h" |
|
|
static int rcsclean_file(char *, RCSNUM *); |
static void rcsclean_file(char *, RCSNUM *); |
|
|
static int nflag = 0; |
static int nflag = 0; |
static int kflag = RCS_KWEXP_ERR; |
static int kflag = RCS_KWEXP_ERR; |
static int uflag = 0; |
static int uflag = 0; |
|
|
" [-rrev] [-u[rev]] [-xsuffixes] [-ztz] [file] ...\n"); |
" [-rrev] [-u[rev]] [-xsuffixes] [-ztz] [file] ...\n"); |
} |
} |
|
|
static int |
static void |
rcsclean_file(char *fname, RCSNUM *rev) |
rcsclean_file(char *fname, RCSNUM *rev) |
{ |
{ |
int match; |
int match; |
|
|
match = 1; |
match = 1; |
|
|
if (stat(fname, &st) == -1) |
if (stat(fname, &st) == -1) |
return (-1); |
return; |
|
|
if (rcs_statfile(fname, fpath, sizeof(fpath)) < 0) |
if (rcs_statfile(fname, fpath, sizeof(fpath)) < 0) |
return (-1); |
return; |
|
|
if ((file = rcs_open(fpath, RCS_RDWR)) == NULL) |
if ((file = rcs_open(fpath, RCS_RDWR)) == NULL) |
return (-1); |
return; |
|
|
if (flags & PRESERVETIME) |
if (flags & PRESERVETIME) |
rcs_mtime = rcs_get_mtime(file->rf_path); |
rcs_mtime = rcs_get_mtime(file->rf_path); |
|
|
if ((b1 = rcs_getrev(file, frev)) == NULL) { |
if ((b1 = rcs_getrev(file, frev)) == NULL) { |
cvs_log(LP_ERR, "failed to get needed revision"); |
cvs_log(LP_ERR, "failed to get needed revision"); |
rcs_close(file); |
rcs_close(file); |
return (-1); |
return; |
} |
} |
|
|
if ((b2 = cvs_buf_load(fname, BUF_AUTOEXT)) == NULL) { |
if ((b2 = cvs_buf_load(fname, BUF_AUTOEXT)) == NULL) { |
cvs_log(LP_ERRNO, "failed to load '%s'", fname); |
cvs_log(LP_ERRNO, "failed to load '%s'", fname); |
rcs_close(file); |
rcs_close(file); |
return (-1); |
return; |
} |
} |
|
|
cvs_buf_putc(b1, '\0'); |
cvs_buf_putc(b1, '\0'); |
|
|
|
|
if (flags & PRESERVETIME) |
if (flags & PRESERVETIME) |
rcs_set_mtime(fpath, rcs_mtime); |
rcs_set_mtime(fpath, rcs_mtime); |
|
|
return (0); |
|
} |
} |