Fix dtcm build on OpenBSD-current.
authorPascal Stumpf <Pascal.Stumpf@cubes.de>
Fri, 21 Feb 2014 17:02:36 +0000 (18:02 +0100)
committerJon Trulson <jon@radscan.com>
Sun, 23 Feb 2014 02:09:37 +0000 (19:09 -0700)
libcompat and header files will be gone in the upcoming 5.5 release, so we
cannot use the ftime(3) interface there.  Fall back to the SVR4 version of the
code, but use the tm_gmtoff field of struct tm to get the timezone.
Unfortunately, that is not portable (because I really really would like to
remove that old and crummy struct timeb from the public API).

cde/programs/dtcm/dtcm/Imakefile
cde/programs/dtcm/libDtCmP/getdate.h
cde/programs/dtcm/libDtCmP/getdate.y

index e889c16a40fb544fcbb83a4dcd6f77227ba3ba1b..971a9bbe08f4842878f4075a180c542fd221093c 100644 (file)
@@ -32,7 +32,7 @@ EXTRA_LIBRARIES       = -lrpcsvc -lPW -ldiag
 EXTRA_LIBRARIES        = -lrpcsvc -lV3
 #endif
 
-#if defined(BSDArchitecture)
+#if defined(BSDArchitecture) && !defined(OpenBSDArchitecture)
 EXTRA_LIBRARIES = -lcompat
 #endif
 
index fbab931b8d31dc46f826bb0e222d64ae9d3d68a9..214750bb31d4eccf80e1d59b39e401fc7e2c1db3 100644 (file)
@@ -52,7 +52,7 @@
 #ifndef _GETDATE_H
 #define _GETDATE_H
 
-#ifdef USG
+#if defined(USG) || defined(__OpenBSD__)
 struct timeb
 {
         time_t  time;
index e3238220297fe9660c1d4a46e16996565640c5f4..907e2c0727016587c9ae0da4d52643c5862aca93 100644 (file)
@@ -528,11 +528,15 @@ time_t cm_getdate(char *p, struct timeb *now)
        lptr = p;
        if (now == ((struct timeb *) NULL)) {
                now = &ftz;
-#ifdef SVR4
+#if defined(SVR4) || defined(__OpenBSD__)
                tod = time(0);
                lt = localtime(&tod);
                now->time = lt->tm_sec;
+#ifdef __OpenBSD__
+               now->timezone = lt->tm_gmtoff / 60;
+#else
                now->timezone = timezone/60;
+#endif
 #else
                ftime(&ftz);
 #endif /* SVR4 */