diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-07-28 01:49:15 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-07-28 01:49:15 +0000 |
commit | 0d231e9dc86a73c191df1c313a1320a436f77aaf (patch) | |
tree | be2fc3294e4fe624dc3d7256f41259726e0649d7 /usr.bin | |
parent | f30d319a6830acc9a2d7fbf960d306f749fdeb1e (diff) |
Fix the timestamp parsing for Mod-time. Months are now being detected
correctly and there is no assumption about Daylight Savings Time
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/proto.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/usr.bin/cvs/proto.c b/usr.bin/cvs/proto.c index 1d68ca21ffa..b8eebb5f6db 100644 --- a/usr.bin/cvs/proto.c +++ b/usr.bin/cvs/proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proto.c,v 1.8 2004/07/27 16:16:19 jfb Exp $ */ +/* $OpenBSD: proto.c,v 1.9 2004/07/28 01:49:14 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -91,24 +91,12 @@ static int cvs_resp_modxpand (int, char *); static const char *cvs_months[] = { - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "June", - "July", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - - struct cvs_req { int req_id; char req_str[32]; @@ -651,10 +639,16 @@ cvs_resp_statdir(int type, char *line) static int cvs_resp_sticky(int type, char *line) { + size_t len; char rpath[MAXPATHLEN]; struct stat st; CVSFILE *cf; + /* remove trailing slash */ + len = strlen(line); + if ((len > 0) && (line[len - 1] == '/')) + line[--len] = '\0'; + /* get the remote path */ cvs_client_getln(rpath, sizeof(rpath)); @@ -763,13 +757,14 @@ cvs_resp_modtime(int type, char *line) struct tm cvs_tm; memset(&cvs_tm, 0, sizeof(cvs_tm)); - sscanf(line, "%d %8s %d %2d:%2d:%2d %5s", &cvs_tm.tm_mday, mon, + sscanf(line, "%d %3s %d %2d:%2d:%2d %5s", &cvs_tm.tm_mday, mon, &cvs_tm.tm_year, &cvs_tm.tm_hour, &cvs_tm.tm_min, &cvs_tm.tm_sec, gmt); cvs_tm.tm_year -= 1900; + cvs_tm.tm_isdst = -1; if (*gmt == '-') { - sscanf("%c%2s%2s", &sign, hr, min); + sscanf(gmt, "%c%2s%2s", &sign, hr, min); cvs_tm.tm_gmtoff = strtol(hr, &ep, 10); if ((cvs_tm.tm_gmtoff == LONG_MIN) || (cvs_tm.tm_gmtoff == LONG_MAX) || |