summaryrefslogtreecommitdiffstats
path: root/usr.bin/find
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-02-09 21:24:41 +0000
committered <ed@FreeBSD.org>2010-02-09 21:24:41 +0000
commitd09bdfe2c5a42387a5c6136cbcc9fa601924d7f2 (patch)
treef13aeb7b2ac72b2f30879d9c0193133835e34d27 /usr.bin/find
parentad83c697927372c901c6bf9b119d735e0df4fbcc (diff)
downloadFreeBSD-src-d09bdfe2c5a42387a5c6136cbcc9fa601924d7f2.zip
FreeBSD-src-d09bdfe2c5a42387a5c6136cbcc9fa601924d7f2.tar.gz
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.
Diffstat (limited to 'usr.bin/find')
-rw-r--r--usr.bin/find/extern.h3
-rw-r--r--usr.bin/find/function.c3
-rw-r--r--usr.bin/find/getdate.y67
3 files changed, 31 insertions, 42 deletions
diff --git a/usr.bin/find/extern.h b/usr.bin/find/extern.h
index 716c1f5..cc6143c 100644
--- a/usr.bin/find/extern.h
+++ b/usr.bin/find/extern.h
@@ -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 **);
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 5d8ad3d..51d5153 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$");
#include <sys/acl.h>
#include <sys/wait.h>
#include <sys/mount.h>
-#include <sys/timeb.h>
#include <dirent.h>
#include <err.h>
@@ -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 {
diff --git a/usr.bin/find/getdate.y b/usr.bin/find/getdate.y
index de7750c..81a9c47 100644
--- a/usr.bin/find/getdate.y
+++ b/usr.bin/find/getdate.y
@@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$");
#else /* defined(vms) */
# include <sys/types.h>
# include <sys/time.h>
-# include <sys/timeb.h>
#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;
- }
+ 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 (! (tm = localtime (&nowtime)))
+ return -1;
- 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->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
OpenPOWER on IntegriCloud