summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/checkout.c12
-rw-r--r--usr.bin/cvs/client.c6
-rw-r--r--usr.bin/cvs/diff.c3
-rw-r--r--usr.bin/cvs/entries.c11
-rw-r--r--usr.bin/cvs/file.c6
-rw-r--r--usr.bin/cvs/rcs.c4
-rw-r--r--usr.bin/cvs/remote.c6
-rw-r--r--usr.bin/cvs/server.c4
-rw-r--r--usr.bin/cvs/util.c31
-rw-r--r--usr.bin/cvs/util.h3
10 files changed, 25 insertions, 61 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index d652b5ea136..d6f7257e902 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.83 2007/01/25 23:22:32 joris Exp $ */
+/* $OpenBSD: checkout.c,v 1.84 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -242,12 +242,10 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags)
if (fchmod(cf->fd, 0644) == -1)
fatal("cvs_checkout_file: fchmod: %s", strerror(errno));
- if (exists == 0) {
+ if (exists == 0 && cf->file_ent == NULL)
rcstime = rcs_rev_getdate(cf->file_rcs, rnum);
- rcstime = cvs_hack_time(rcstime, 0);
- } else {
+ else
time(&rcstime);
- }
tv[0].tv_sec = rcstime;
tv[0].tv_usec = 0;
@@ -259,9 +257,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, int co_flags)
time(&rcstime);
}
- rcstime = cvs_hack_time(rcstime, 1);
-
- ctime_r(&rcstime, tbuf);
+ asctime_r(gmtime(&rcstime), tbuf);
if (tbuf[strlen(tbuf) - 1] == '\n')
tbuf[strlen(tbuf) - 1] = '\0';
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index e9411fcef50..01ae9a8a434 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.51 2007/01/26 10:42:06 otto Exp $ */
+/* $OpenBSD: client.c,v 1.52 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -646,8 +646,7 @@ cvs_client_updated(char *data)
fmode &= ~mask;
time(&now);
- now = cvs_hack_time(now, 0);
- ctime_r(&now, timebuf);
+ asctime_r(gmtime(&now), timebuf);
if (timebuf[strlen(timebuf) - 1] == '\n')
timebuf[strlen(timebuf) - 1] = '\0';
@@ -672,7 +671,6 @@ cvs_client_updated(char *data)
cvs_remote_receive_file(fd, flen);
- now = cvs_hack_time(now, 0);
tv[0].tv_sec = now;
tv[0].tv_usec = 0;
tv[1] = tv[0];
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index ba3774d724c..3b09f599cf6 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.115 2007/01/20 01:07:51 niallo Exp $ */
+/* $OpenBSD: diff.c,v 1.116 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -238,7 +238,6 @@ cvs_diff_local(struct cvs_file *cf)
if ((b1 = cvs_buf_load_fd(cf->fd, BUF_AUTOEXT)) == NULL)
fatal("failed to load %s", cf->file_path);
- st.st_mtime = cvs_hack_time(st.st_mtime, 1);
tv2[0].tv_sec = st.st_mtime;
tv2[0].tv_usec = 0;
tv2[1] = tv2[0];
diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c
index b0a2f557045..3118f5e2490 100644
--- a/usr.bin/cvs/entries.c
+++ b/usr.bin/cvs/entries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: entries.c,v 1.69 2007/01/25 18:56:33 otto Exp $ */
+/* $OpenBSD: entries.c,v 1.70 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -111,6 +111,7 @@ struct cvs_ent *
cvs_ent_parse(const char *entry)
{
int i;
+ struct tm t;
struct cvs_ent *ent;
char *fields[CVS_ENTRIES_NFIELDS], *buf, *sp, *dp;
@@ -159,8 +160,12 @@ cvs_ent_parse(const char *entry)
strncmp(fields[3], "Initial ", 8) == 0 ||
strncmp(fields[3], "Result of merge", 15) == 0)
ent->ce_mtime = CVS_DATE_DMSEC;
- else
- ent->ce_mtime = cvs_date_parse(fields[3]);
+ else {
+ strptime(fields[3], "%a %b %d %T %Y", &t);
+ t.tm_isdst = 0;
+ t.tm_gmtoff = 0;
+ ent->ce_mtime = mktime(&t);
+ }
}
ent->ce_conflict = fields[3];
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 5972af45e0a..cfd04ce6997 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.176 2007/01/25 18:56:33 otto Exp $ */
+/* $OpenBSD: file.c,v 1.177 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -562,7 +562,6 @@ void
cvs_file_classify(struct cvs_file *cf, const char *tag, int loud)
{
size_t len;
- time_t mtime;
struct stat st;
BUF *b1, *b2;
int rflags, l, ismodified, rcsdead, verbose;
@@ -678,8 +677,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag, int loud)
if (fstat(cf->fd, &st) == -1)
fatal("cvs_file_classify: %s", strerror(errno));
- mtime = cvs_hack_time(st.st_mtime, 1);
- if (mtime != cf->file_ent->ce_mtime)
+ if (st.st_mtime != cf->file_ent->ce_mtime)
ismodified = 1;
}
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 926bc28e380..2de6a08c313 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.203 2007/01/25 19:32:56 otto Exp $ */
+/* $OpenBSD: rcs.c,v 1.204 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -2540,7 +2540,7 @@ rcs_rev_getdate(RCSFILE *rfp, RCSNUM *rev)
if ((rdp = rcs_findrev(rfp, rev)) == NULL)
return (-1);
- return (mktime(&rdp->rd_date));
+ return (timegm(&rdp->rd_date));
}
/*
diff --git a/usr.bin/cvs/remote.c b/usr.bin/cvs/remote.c
index d8dd0333bd2..e03a8d55afb 100644
--- a/usr.bin/cvs/remote.c
+++ b/usr.bin/cvs/remote.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.c,v 1.11 2007/01/26 08:35:23 otto Exp $ */
+/* $OpenBSD: remote.c,v 1.12 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -202,7 +202,6 @@ cvs_remote_send_file(const char *path)
void
cvs_remote_classify_file(struct cvs_file *cf)
{
- time_t mtime;
struct stat st;
CVSENTRIES *entlist;
@@ -230,8 +229,7 @@ cvs_remote_classify_file(struct cvs_file *cf)
fatal("cvs_remote_classify_file(%s): %s", cf->file_path,
strerror(errno));
- mtime = cvs_hack_time(st.st_mtime, 1);
- if (mtime != cf->file_ent->ce_mtime)
+ if (st.st_mtime != cf->file_ent->ce_mtime)
cf->file_status = FILE_MODIFIED;
else
cf->file_status = FILE_UPTODATE;
diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c
index 42a3cfdf51a..5102103b41b 100644
--- a/usr.bin/cvs/server.c
+++ b/usr.bin/cvs/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.51 2007/01/25 18:56:33 otto Exp $ */
+/* $OpenBSD: server.c,v 1.52 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -413,7 +413,7 @@ cvs_server_unchanged(char *data)
fatal("received Unchanged request for non-existing file");
cvs_ent_close(entlist, ENT_NOSYNC);
- tv[0].tv_sec = cvs_hack_time(ent->ce_mtime, 0);
+ tv[0].tv_sec = ent->ce_mtime;
tv[0].tv_usec = 0;
tv[1] = tv[0];
if (futimes(fd, tv) == -1)
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index 267066a5308..9896d6ff955 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.102 2007/01/25 18:35:30 niallo Exp $ */
+/* $OpenBSD: util.c,v 1.103 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -575,35 +575,6 @@ cvs_path_cat(const char *base, const char *end, char *dst, size_t dlen)
return (len);
}
-/*
- * a hack to mimic and thus match gnu cvs behaviour.
- */
-time_t
-cvs_hack_time(time_t oldtime, int togmt)
-{
- int l;
- struct tm *t;
- char tbuf[32];
-
- if (togmt == 1) {
- t = gmtime(&oldtime);
- if (t == NULL)
- fatal("gmtime failed");
-
- return (mktime(t));
- }
-
- t = localtime(&oldtime);
-
- l = snprintf(tbuf, sizeof(tbuf), "%d/%d/%d GMT %d:%d:%d",
- t->tm_mon + 1, t->tm_mday, t->tm_year + 1900, t->tm_hour,
- t->tm_min, t->tm_sec);
- if (l == -1 || l >= (int)sizeof(tbuf))
- fatal("cvs_hack_time: overflow");
-
- return (cvs_date_parse(tbuf));
-}
-
void
cvs_get_repository_path(const char *dir, char *dst, size_t len)
{
diff --git a/usr.bin/cvs/util.h b/usr.bin/cvs/util.h
index b5f5be34554..cadf3ac0ddc 100644
--- a/usr.bin/cvs/util.h
+++ b/usr.bin/cvs/util.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.h,v 1.14 2007/01/25 18:35:30 niallo Exp $ */
+/* $OpenBSD: util.h,v 1.15 2007/01/26 11:19:44 joris Exp $ */
/*
* Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -45,7 +45,6 @@ int cvs_rmdir(const char *);
char **cvs_makeargv(const char *, int *);
void cvs_freeargv(char **, int);
size_t cvs_path_cat(const char *, const char *, char *, size_t);
-time_t cvs_hack_time(time_t, int);
u_int cvs_revision_select(RCSFILE *, char *);
struct cvs_line {