summaryrefslogtreecommitdiffstats
path: root/usr.bin/find
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/find')
-rw-r--r--usr.bin/find/Makefile2
-rw-r--r--usr.bin/find/extern.h3
-rw-r--r--usr.bin/find/function.c7
-rw-r--r--usr.bin/find/getdate.y67
4 files changed, 34 insertions, 45 deletions
diff --git a/usr.bin/find/Makefile b/usr.bin/find/Makefile
index b20dc03..0c7bb70 100644
--- a/usr.bin/find/Makefile
+++ b/usr.bin/find/Makefile
@@ -4,8 +4,6 @@
PROG= find
SRCS= find.c function.c ls.c main.c misc.c operator.c option.c \
getdate.y
-WARNS?=6
-CFLAGS+= -DHAVE_SYS_TIMEB_H -I${.CURDIR}
YFLAGS=
.include <bsd.prog.mk>
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 c11d24f..1714627 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>
@@ -770,7 +769,7 @@ done: *argvp = argv + 1;
/* Finish any pending -exec ... {} + functions. */
void
-finish_execplus()
+finish_execplus(void)
{
PLAN *p;
@@ -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 {
@@ -1165,6 +1164,8 @@ c_newer(OPTION *option, char ***argvp)
new->t_data = sb.st_ctime;
else if (option->flags & F_TIME2_A)
new->t_data = sb.st_atime;
+ else if (option->flags & F_TIME2_B)
+ new->t_data = sb.st_birthtime;
else
new->t_data = sb.st_mtime;
}
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