diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-03-17 13:40:42 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-03-17 13:40:42 +0000 |
commit | 5049529f75b103346e11fa8b0dbd531d6992989c (patch) | |
tree | 4086718620b2951f31ed2933dce40695618f4575 /usr.bin | |
parent | 5ebc1b8cd4ac1770d6a9909fa3632d0299144620 (diff) |
- Lint says cvs_hacktime() is not used in rcs, so move it into !RCSPROG.
ok xsa@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/util.c | 60 | ||||
-rw-r--r-- | usr.bin/cvs/util.h | 4 |
2 files changed, 32 insertions, 32 deletions
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index 05abcf7b39c..ae96c805efd 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.71 2006/03/17 08:51:45 xsa Exp $ */ +/* $OpenBSD: util.c,v 1.72 2006/03/17 13:40:41 niallo Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> @@ -904,6 +904,35 @@ cvs_parse_tagfile(char **tagp, char **datep, int *nbp) (void)fclose(fp); } +/* + * 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) + return (0); + + 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)) + return (0); + + return (cvs_date_parse(tbuf)); +} + #endif /* !RCSPROG */ /* @@ -993,35 +1022,6 @@ cvs_patchfile(const char *data, const char *patch, } /* - * 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) - return (0); - - 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)) - return (0); - - return (cvs_date_parse(tbuf)); -} - -/* * cvs_yesno() * * Read from standart input for `y' or `Y' character. diff --git a/usr.bin/cvs/util.h b/usr.bin/cvs/util.h index 89d5aebe6c1..2260cdb8809 100644 --- a/usr.bin/cvs/util.h +++ b/usr.bin/cvs/util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: util.h,v 1.2 2006/03/17 08:51:45 xsa Exp $ */ +/* $OpenBSD: util.h,v 1.3 2006/03/17 13:40:41 niallo Exp $ */ /* * Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -50,10 +50,10 @@ void cvs_freeargv(char **, int); void cvs_write_tagfile(char *, char *, int); void cvs_parse_tagfile(char **, char **, int *); size_t cvs_path_cat(const char *, const char *, char *, size_t); +time_t cvs_hack_time(time_t, int); #endif /* !RCSPROG */ -time_t cvs_hack_time(time_t, int); struct cvs_line { char *l_line; |