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.
This commit is contained in:
Ed Schouten 2010-02-09 21:24:41 +00:00
parent 13d034bf5d
commit 65bcaaeca7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=203723
3 changed files with 32 additions and 43 deletions

View File

@ -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 **);

View File

@ -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 {

View File

@ -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;
}
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;
}
else
gmt_ptr = gmtime (&nowtime);
if (gmt_ptr != NULL)
{
nowtime = now->time;
/* 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 (gmt_ptr != NULL)
tzoff = 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. */
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