diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-04-29 04:42:48 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-04-29 04:42:48 +0000 |
commit | d6dd4390b461cf1494153c9bd5705fff78ae54c1 (patch) | |
tree | 556efe4190320bc4832a26c8683d25c30b3c65a1 /usr.bin | |
parent | 9d0d597c5fd4a1fd6d3c85fe177f7b36e39d5082 (diff) |
Remove dead code.
OK niallo@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/date.y | 50 | ||||
-rw-r--r-- | usr.bin/rcs/date.y | 50 |
2 files changed, 42 insertions, 58 deletions
diff --git a/usr.bin/cvs/date.y b/usr.bin/cvs/date.y index e087c939cc0..722df234635 100644 --- a/usr.bin/cvs/date.y +++ b/usr.bin/cvs/date.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: date.y,v 1.11 2006/01/02 08:11:56 xsa Exp $ */ +/* $OpenBSD: date.y,v 1.12 2006/04/29 04:42:46 ray Exp $ */ /* ** Originally written by Steven M. Bellovin <smb@research.att.com> while @@ -814,42 +814,34 @@ difftm(struct tm *a, struct tm *b) time_t cvs_date_parse(const char *p) { - struct tm *tm, gmt; + struct tm gmt, *gmt_ptr, *tm; struct timeb ftz, *now; time_t Start, tod, nowtime; - now = NULL; - yyInput = p; - if (now == NULL) { - struct tm *gmt_ptr; - - now = &ftz; - (void)time(&nowtime); - - gmt_ptr = gmtime(&nowtime); - if (gmt_ptr != NULL) { - /* Make a copy, in case localtime modifies *tm (I think - * that comment now applies to *gmt_ptr, but I am too - * lazy to dig into how gmtime and locatime allocate the - * structures they return pointers to). - */ - gmt = *gmt_ptr; - } - if (!(tm = localtime(&nowtime))) - return (-1); + now = &ftz; + (void)time(&nowtime); - if (gmt_ptr != NULL) - ftz.timezone = difftm(&gmt, tm) / 60; - - if (tm->tm_isdst) - ftz.timezone += 60; - } - else { - nowtime = now->time; + gmt_ptr = gmtime(&nowtime); + if (gmt_ptr != NULL) { + /* Make a copy, in case localtime modifies *tm (I think + * that comment now applies to *gmt_ptr, but I am too + * lazy to dig into how gmtime and locatime allocate the + * structures they return pointers to). + */ + gmt = *gmt_ptr; } + if (!(tm = localtime(&nowtime))) + return (-1); + + if (gmt_ptr != NULL) + ftz.timezone = difftm(&gmt, tm) / 60; + + if (tm->tm_isdst) + ftz.timezone += 60; + tm = localtime(&nowtime); yyYear = tm->tm_year + 1900; yyMonth = tm->tm_mon + 1; diff --git a/usr.bin/rcs/date.y b/usr.bin/rcs/date.y index 2f7f4a43ea7..5af444b656f 100644 --- a/usr.bin/rcs/date.y +++ b/usr.bin/rcs/date.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: date.y,v 1.1 2006/04/26 02:55:13 joris Exp $ */ +/* $OpenBSD: date.y,v 1.2 2006/04/29 04:42:47 ray Exp $ */ /* ** Originally written by Steven M. Bellovin <smb@research.att.com> while @@ -813,42 +813,34 @@ difftm(struct tm *a, struct tm *b) time_t rcs_date_parse(const char *p) { - struct tm *tm, gmt; + struct tm gmt, *gmt_ptr, *tm; struct timeb ftz, *now; time_t Start, tod, nowtime; - now = NULL; - yyInput = p; - if (now == NULL) { - struct tm *gmt_ptr; - - now = &ftz; - (void)time(&nowtime); - - gmt_ptr = gmtime(&nowtime); - if (gmt_ptr != NULL) { - /* Make a copy, in case localtime modifies *tm (I think - * that comment now applies to *gmt_ptr, but I am too - * lazy to dig into how gmtime and locatime allocate the - * structures they return pointers to). - */ - gmt = *gmt_ptr; - } - if (!(tm = localtime(&nowtime))) - return (-1); + now = &ftz; + (void)time(&nowtime); - if (gmt_ptr != NULL) - ftz.timezone = difftm(&gmt, tm) / 60; - - if (tm->tm_isdst) - ftz.timezone += 60; - } - else { - nowtime = now->time; + gmt_ptr = gmtime(&nowtime); + if (gmt_ptr != NULL) { + /* Make a copy, in case localtime modifies *tm (I think + * that comment now applies to *gmt_ptr, but I am too + * lazy to dig into how gmtime and locatime allocate the + * structures they return pointers to). + */ + gmt = *gmt_ptr; } + if (!(tm = localtime(&nowtime))) + return (-1); + + if (gmt_ptr != NULL) + ftz.timezone = difftm(&gmt, tm) / 60; + + if (tm->tm_isdst) + ftz.timezone += 60; + tm = localtime(&nowtime); yyYear = tm->tm_year + 1900; yyMonth = tm->tm_mon + 1; |