From c6eb59caf6faeab4391c0d2191bfe86e1da1068e Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Fri, 6 Sep 1996 00:22:41 +0000 Subject: [PATCH] getdate.y: Declare a private copy of struct timeb to be used internally in this file. The problem is that Sun's C compiler doesn't deal gracefully with the pragmas for the declared structure which causes coredumps. Gcc of course works. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9037 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/cli/ChangeLog | 7 +++++++ src/kadmin/cli/getdate.y | 18 +++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/kadmin/cli/ChangeLog b/src/kadmin/cli/ChangeLog index e994c2c3a..b45d36ce8 100644 --- a/src/kadmin/cli/ChangeLog +++ b/src/kadmin/cli/ChangeLog @@ -1,3 +1,10 @@ +Thu Sep 5 20:15:12 1996 Ezra Peisach (epeisach@mit.edu) + + * getdate.y: Declare a private copy of struct timeb (no-one uses + the extra return structure in our tree). This works around + a bug with Sun's cc cimpiler, and pragma incompatibility + in its header files. + Tue Sep 3 22:10:49 1996 Theodore Y. Ts'o * Makefile.in (install): Fixed typo: ($PROG) -> $(PROG) diff --git a/src/kadmin/cli/getdate.y b/src/kadmin/cli/getdate.y index 459043017..70c748652 100644 --- a/src/kadmin/cli/getdate.y +++ b/src/kadmin/cli/getdate.y @@ -84,22 +84,17 @@ void *alloca (); #undef timezone /* needed for sgi */ #endif -#if defined(HAVE_SYS_TIMEB_H) -#include -#else /* -** We use the obsolete `struct timeb' as part of our interface! +** We use the obsolete `struct my_timeb' as part of our interface! ** Since the system doesn't have it, we define it here; ** our callers must do likewise. */ -struct timeb { +struct my_timeb { time_t time; /* Seconds since the epoch */ unsigned short millitm; /* Field not used */ short timezone; /* Minutes west of GMT */ short dstflag; /* Field not used */ }; -#endif /* defined(HAVE_SYS_TIMEB_H) */ - #endif /* defined(vms) */ #if defined (STDC_HEADERS) || defined (USG) @@ -927,17 +922,18 @@ difftm(a, b) time_t get_date(p, now) char *p; - struct timeb *now; + struct my_timeb *now; { struct tm *tm, gmt; - struct timeb ftz; + struct my_timeb ftz; time_t Start; time_t tod; yyInput = p; if (now == NULL) { now = &ftz; - (void)time(&ftz.time); + + ftz.time = time((time_t *) 0); if (! (tm = gmtime (&ftz.time))) return -1; @@ -1006,7 +1002,7 @@ main(ac, 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, (struct my_timeb *)NULL); if (d == -1) (void)printf("Bad format - couldn't convert.\n"); else -- 2.26.2