From owner-svn-src-all@FreeBSD.ORG Tue Feb 9 21:24:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E9861065679; Tue, 9 Feb 2010 21:24:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D60C8FC1A; Tue, 9 Feb 2010 21:24:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o19LOglX085744; Tue, 9 Feb 2010 21:24:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o19LOgnb085740; Tue, 9 Feb 2010 21:24:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201002092124.o19LOgnb085740@svn.freebsd.org> From: Ed Schouten Date: Tue, 9 Feb 2010 21:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203723 - head/usr.bin/find X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Feb 2010 21:24:42 -0000 Author: ed Date: Tue Feb 9 21:24:41 2010 New Revision: 203723 URL: http://svn.freebsd.org/changeset/base/203723 Log: Don't let find(1) depend on struct timeb. This structure is deprecated and only used by ftime(2), which is part of libcompat. The second argument of get_date() is unused, which means we can just remove it entirely. Modified: head/usr.bin/find/extern.h head/usr.bin/find/function.c head/usr.bin/find/getdate.y Modified: head/usr.bin/find/extern.h ============================================================================== --- head/usr.bin/find/extern.h Tue Feb 9 21:01:18 2010 (r203722) +++ head/usr.bin/find/extern.h Tue Feb 9 21:24:41 2010 (r203723) @@ -43,8 +43,7 @@ PLAN *find_formplan(char **); PLAN *not_squish(PLAN *); PLAN *or_squish(PLAN *); PLAN *paren_squish(PLAN *); -struct timeb; -time_t get_date(char *, struct timeb *); +time_t get_date(char *); struct stat; void printlong(char *, char *, struct stat *); int queryuser(char **); Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Tue Feb 9 21:01:18 2010 (r203722) +++ head/usr.bin/find/function.c Tue Feb 9 21:24:41 2010 (r203723) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -1155,7 +1154,7 @@ c_newer(OPTION *option, char ***argvp) new = palloc(option); /* compare against what */ if (option->flags & F_TIME2_T) { - new->t_data = get_date(fn_or_tspec, (struct timeb *) 0); + new->t_data = get_date(fn_or_tspec); if (new->t_data == (time_t) -1) errx(1, "Can't parse date/time: %s", fn_or_tspec); } else { Modified: head/usr.bin/find/getdate.y ============================================================================== --- head/usr.bin/find/getdate.y Tue Feb 9 21:01:18 2010 (r203722) +++ head/usr.bin/find/getdate.y Tue Feb 9 21:24:41 2010 (r203723) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #else /* defined(vms) */ # include # include -# include #endif /* !defined(vms) */ #if defined (__STDC__) || defined (USG) @@ -69,7 +68,7 @@ static int yyparse(void); static int yylex(void); static int yyerror(const char *); -time_t get_date(char *, struct timeb *); +time_t get_date(char *); #define EPOCH 1970 #define HOUR(x) ((time_t)(x) * 60) @@ -849,58 +848,50 @@ difftm (struct tm *a, struct tm *b) } time_t -get_date(char *p, struct timeb *now) +get_date(char *p) { - struct tm *tm, gmt; - struct timeb ftz; + struct tm *tm, *gmt_ptr, gmt; + int tzoff; time_t Start; time_t tod; time_t nowtime; bzero (&gmt, sizeof(struct tm)); yyInput = p; - if (now == NULL) { - struct tm *gmt_ptr; - now = &ftz; - (void)time (&nowtime); + (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; + 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 (gmt_ptr != NULL) - ftz.timezone = difftm (&gmt, tm) / 60; - else - /* We are on a system like VMS, where the system clock is - in local time and the system has no concept of timezones. - Hopefully we can fake this out (for the case in which the - user specifies no timezone) by just saying the timezone - is zero. */ - ftz.timezone = 0; + if (! (tm = localtime (&nowtime))) + return -1; - if(tm->tm_isdst) - ftz.timezone += 60; - } + if (gmt_ptr != NULL) + tzoff = difftm (&gmt, tm) / 60; else - { - nowtime = now->time; - } + /* We are on a system like VMS, where the system clock is + in local time and the system has no concept of timezones. + Hopefully we can fake this out (for the case in which the + user specifies no timezone) by just saying the timezone + is zero. */ + tzoff = 0; + + if(tm->tm_isdst) + tzoff += 60; tm = localtime(&nowtime); yyYear = tm->tm_year + 1900; yyMonth = tm->tm_mon + 1; yyDay = tm->tm_mday; - yyTimezone = now->timezone; + yyTimezone = tzoff; yyDSTmode = DSTmaybe; yyHour = 0; yyMinutes = 0; @@ -956,7 +947,7 @@ main(int ac, char *av[]) (void)printf("Enter date, or blank line to exit.\n\t> "); (void)fflush(stdout); while (gets(buff) && buff[0]) { - d = get_date(buff, (struct timeb *)NULL); + d = get_date(buff); if (d == -1) (void)printf("Bad format - couldn't convert.\n"); else