From 61261c85310fa4d597f6ffeea3d293f39b755efc Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 20 Nov 2006 20:33:02 +0000 Subject: [PATCH] rename getdate to parsedate to avoid conflict with posix function --- lib/libutil/Makefile | 10 +++++----- lib/libutil/{getdate.3 => parsedate.3} | 18 +++++++++--------- lib/libutil/{getdate.y => parsedate.y} | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) rename lib/libutil/{getdate.3 => parsedate.3} (95%) rename lib/libutil/{getdate.y => parsedate.y} (98%) diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile index 1cb66962abf8..4a838596a355 100644 --- a/lib/libutil/Makefile +++ b/lib/libutil/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.52 2006/11/17 22:10:23 christos Exp $ +# $NetBSD: Makefile,v 1.53 2006/11/20 20:33:02 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes @@ -8,21 +8,21 @@ USE_SHLIBDIR= yes WARNS=3 LIB= util CPPFLAGS+=-DLIBC_SCCS -SRCS= efun.c getbootfile.c getdate.y getlabelsector.c getmaxpartitions.c \ +SRCS= efun.c getbootfile.c getlabelsector.c getmaxpartitions.c \ getmntopts.c getrawpartition.c \ disklabel_dkcksum.c disklabel_scan.c \ if_media.c \ login.c loginx.c login_cap.c login_tty.c logout.c logoutx.c \ - logwtmp.c logwtmpx.c opendisk.c \ + logwtmp.c logwtmpx.c opendisk.c parsedate.y \ passwd.c pw_scan.c pw_policy.c pidfile.c pidlock.c pty.c \ secure_path.c snprintb.c sockaddr_snprintf.c ttyaction.c ttymsg.c -MAN= efun.3 getbootfile.3 getdate.3 getlabelsector.3 getmaxpartitions.3 \ +MAN= efun.3 getbootfile.3 getlabelsector.3 getmaxpartitions.3 \ getmntopts.3 \ getrawpartition.3 \ login.3 login_cap.3 loginx.3 \ disklabel_dkcksum.3 disklabel_scan.3 \ - opendisk.3 openpty.3 pidfile.3 pidlock.3 \ + opendisk.3 openpty.3 parsedate.3 pidfile.3 pidlock.3 \ pw_getconf.3 pw_init.3 pw_lock.3 pw_policy.3 secure_path.3 \ snprintb.3 sockaddr_snprintf.3 ttyaction.3 \ ttymsg.3 util.3 diff --git a/lib/libutil/getdate.3 b/lib/libutil/parsedate.3 similarity index 95% rename from lib/libutil/getdate.3 rename to lib/libutil/parsedate.3 index bd8b20b62b15..dbef8617a35e 100644 --- a/lib/libutil/getdate.3 +++ b/lib/libutil/parsedate.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: getdate.3,v 1.1 2006/11/17 22:10:23 christos Exp $ +.\" $NetBSD: parsedate.3,v 1.1 2006/11/20 20:33:02 christos Exp $ .\" .\" Copyright (c) 2006 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -35,20 +35,20 @@ .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd November 17, 2006 -.Dt getdate 3 +.Dt parsedate 3 .Os .Sh NAME -.Nm getdate +.Nm parsedate .Nd date parsing function .Sh LIBRARY .Lb libutil .Sh SYNOPSIS .In util.h .Ft time_t -.Fn getdate "const char *datestr" "const time_t *time" "const int *tzoff" +.Fn parsedate "const char *datestr" "const time_t *time" "const int *tzoff" .Sh DESCRIPTION The -.Nm getdate +.Nm parsedate function parses a datetime from .Ar datestr described in english relative to an optional @@ -236,7 +236,7 @@ Relative items are also supported: .It +2 years .El .Sh RETURN VALUES -.Fn getdate +.Fn parsedate returns the number of seconds passed since the Epoch, or .Dv -1 if the date could not be parsed properly. @@ -244,14 +244,14 @@ if the date could not be parsed properly. .Xr date 1 , .Xr eeprom 8 . .Sh HISTORY -The parser used -.Fn getdate +The parser used in +.Fn parsedate was originally written by Steven M. Bellovin while at the University of North Carolina at Chapel Hill. Later tweaked by a couple of people on Usenet. Completely overhauled by Rich $alz and Jim Berets in August, 1990. .Pp The -.Fn getdate +.Fn parsedate function first appeared in .Nx 4.0 . diff --git a/lib/libutil/getdate.y b/lib/libutil/parsedate.y similarity index 98% rename from lib/libutil/getdate.y rename to lib/libutil/parsedate.y index e994db18bfcc..71c4b81c1dc0 100644 --- a/lib/libutil/getdate.y +++ b/lib/libutil/parsedate.y @@ -18,7 +18,7 @@ #include #include -/* NOTES on rebuilding getdate.c (particularly for inclusion in CVS +/* NOTES on rebuilding parsedate.c (particularly for inclusion in CVS releases): We don't want to mess with all the portability hassles of alloca. @@ -28,12 +28,12 @@ is to use byacc instead of bison, which should generate a portable parser. I played with adding "#define alloca dont_use_alloca", to give an error if the parser generator uses alloca (and thus detect - unportable getdate.c's), but that seems to cause as many problems + unportable parsedate.c's), but that seems to cause as many problems as it solves. */ -#define yyparse getdate_yyparse -#define yylex getdate_yylex -#define yyerror getdate_yyerror +#define yyparse parsedate_yyparse +#define yylex parsedate_yylex +#define yyerror parsedate_yyerror #define EPOCH 1970 #define HOUR(x) ((time_t)(x) * 60) @@ -859,7 +859,7 @@ difftm (struct tm *a, struct tm *b) } time_t -getdate(const char *p, const time_t *now, const int *zone) +parsedate(const char *p, const time_t *now, const int *zone) { struct tm gmt, local, *gmt_ptr, *tm; time_t nowt; @@ -954,7 +954,7 @@ main(ac, av) (void)printf("Enter date, or blank line to exit.\n\t> "); (void)fflush(stdout); while (gets(buff) && buff[0]) { - d = getdate(buff, NULL, NULL); + d = parsedate(buff, NULL, NULL); if (d == -1) (void)printf("Bad format - couldn't convert.\n"); else