version 1.57, 2006/04/26 02:55:13 |
version 1.58, 2006/04/26 21:55:22 |
|
|
int |
int |
rcsdiff_main(int argc, char **argv) |
rcsdiff_main(int argc, char **argv) |
{ |
{ |
int i, ch, status; |
int fd, i, ch, status; |
RCSNUM *rev1, *rev2; |
RCSNUM *rev1, *rev2; |
RCSFILE *file; |
RCSFILE *file; |
char fpath[MAXPATHLEN], *rev_str1, *rev_str2; |
char fpath[MAXPATHLEN], *rev_str1, *rev_str2; |
|
|
} |
} |
|
|
for (i = 0; i < argc; i++) { |
for (i = 0; i < argc; i++) { |
if (rcs_statfile(argv[i], fpath, sizeof(fpath), flags) < 0) |
fd = rcs_statfile(argv[i], fpath, sizeof(fpath), flags); |
|
if (fd < 0) |
continue; |
continue; |
|
|
if ((file = rcs_open(fpath, RCS_READ|RCS_PARSE_FULLY)) == NULL) |
if ((file = rcs_open(fpath, fd, |
|
RCS_READ|RCS_PARSE_FULLY)) == NULL) |
continue; |
continue; |
|
|
rcs_kwexp_set(file, kflag); |
rcs_kwexp_set(file, kflag); |
|
|
static int |
static int |
rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename) |
rcsdiff_file(RCSFILE *file, RCSNUM *rev, const char *filename) |
{ |
{ |
int ret; |
int ret, fd; |
time_t t; |
time_t t; |
|
struct stat st; |
char path1[MAXPATHLEN], path2[MAXPATHLEN]; |
char path1[MAXPATHLEN], path2[MAXPATHLEN]; |
BUF *b1, *b2; |
BUF *b1, *b2; |
char rbuf[64]; |
char rbuf[64]; |
struct tm *tb; |
struct tm *tb; |
struct stat st; |
|
struct timeval tv[2], tv2[2]; |
struct timeval tv[2], tv2[2]; |
|
|
memset(&tv, 0, sizeof(tv)); |
memset(&tv, 0, sizeof(tv)); |
|
|
diff_rev1 = rev; |
diff_rev1 = rev; |
diff_rev2 = NULL; |
diff_rev2 = NULL; |
|
|
if (stat(filename, &st) == -1) { |
if ((fd = open(filename, O_RDONLY)) == -1) { |
warn("%s", filename); |
warn("%s", filename); |
goto out; |
goto out; |
} |
} |
|
|
} |
} |
|
|
/* XXX - GNU uses GMT */ |
/* XXX - GNU uses GMT */ |
|
if (fstat(fd, &st) == -1) |
|
err(1, "%s", filename); |
|
|
tb = gmtime(&st.st_mtime); |
tb = gmtime(&st.st_mtime); |
t = mktime(tb); |
t = mktime(tb); |
|
|
|
|
ret = 0; |
ret = 0; |
|
|
out: |
out: |
|
if (fd != -1) |
|
(void)close(fd); |
if (b1 != NULL) |
if (b1 != NULL) |
rcs_buf_free(b1); |
rcs_buf_free(b1); |
if (b2 != NULL) |
if (b2 != NULL) |