This is my third patch. It fixes some problems so that OpenBSD
builds again.
It should also solve the tickets 62, 63, 70 and 72.

Best Regards, Ulrich


--
Ulrich Wilkens
Email: m...@uwilkens.de

>From c111beb3fa8c39790175e6069fbb17c555d2f34d Mon Sep 17 00:00:00 2001
From: Ulrich Wilkens <m...@uwilkens.de>
Date: Fri, 1 Jun 2018 03:29:42 +0200
Subject: [PATCH] Fixes for OpenBSD

---
 .../IntegTools/post_install/openbsd/Imakefile      | 24 +++++-----------------
 cde/config/cf/OpenBSD.cf                           | 20 +++++++++++++-----
 cde/include/EUSCompat.h                            |  2 +-
 cde/programs/dtappbuilder/src/abmf/proj_c_file.c   |  5 +++--
 cde/programs/dthelp/parser/canon1/build/out.c      |  2 +-
 cde/programs/dthelp/parser/canon1/parser/end.c     |  2 ++
 .../dtksh/ksh93/src/cmd/ksh93/feature/poll         |  2 +-
 .../dtksh/ksh93/src/cmd/ksh93/features/poll        |  2 +-
 cde/programs/dtlogin/sysauth.c                     |  7 +++++++
 cde/programs/dtmail/include/DtMail/DtMail.hh       |  4 ++--
 cde/programs/dtsession/SmLock.c                    |  5 +++++
 11 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/cde/admin/IntegTools/post_install/openbsd/Imakefile b/cde/admin/IntegTools/post_install/openbsd/Imakefile
index 1f365bc..f1b7663 100644
--- a/cde/admin/IntegTools/post_install/openbsd/Imakefile
+++ b/cde/admin/IntegTools/post_install/openbsd/Imakefile
@@ -27,25 +27,11 @@ BUILD_UDB_LIST = $(SHELL) ../build_udb_list
 
 all::
 
-configMin:: $(DATABASE_DIR)/CDE-MIN.udb
-	$(UDBTOANY) -toLst -ReleaseStream $(PLATFORM) \
-            $(DATABASE_DIR)/CDE-MIN.udb > CDE-MIN.lst
-	$(BUILD_UDB_LIST) CDE-MIN ../../../..
-
-configTT:: $(DATABASE_DIR)/CDE-TT.udb
-	$(UDBTOANY) -toLst -ReleaseStream $(PLATFORM) \
-            $(DATABASE_DIR)/CDE-TT.udb > CDE-TT.lst
-	$(BUILD_UDB_LIST) CDE-TT ../../../..
-
-configRun:: $(DATABASE_DIR)/CDE-RUN.udb
-	$(UDBTOANY) -toLst -ReleaseStream $(PLATFORM) \
-            $(DATABASE_DIR)/CDE-RUN.udb > CDE-RUN.lst
-	$(BUILD_UDB_LIST) CDE-RUN ../../../..
-
-configShlibs:: $(DATABASE_DIR)/CDE-SHLIBS.udb
-	$(UDBTOANY) -toLst -ReleaseStream $(PLATFORM) \
-            $(DATABASE_DIR)/CDE-SHLIBS.udb > CDE-SHLIBS.lst
-	$(BUILD_UDB_LIST) CDE-SHLIBS ../../../..
+DoUDB_SCRIPT4(configMin,CDE-MIN,$(UDBTOANY),$(BUILD_UDB_LIST))
+DoUDB_SCRIPT4(configTT,CDE-TT,$(UDBTOANY),$(BUILD_UDB_LIST))
+DoUDB_SCRIPT4(configRun,CDE-RUN,$(UDBTOANY),$(BUILD_UDB_LIST))
+DoUDB_SCRIPT4(configShlibs,CDE-SHLIBS,$(UDBTOANY),$(BUILD_UDB_LIST))
+
 
 LOCAL_CPP_DEFINES = -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
                     -DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP) \
diff --git a/cde/config/cf/OpenBSD.cf b/cde/config/cf/OpenBSD.cf
index 51de431..d2b1718 100644
--- a/cde/config/cf/OpenBSD.cf
+++ b/cde/config/cf/OpenBSD.cf
@@ -172,13 +172,23 @@ XCOMM operating system:  OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe
 #define CppCmd          	/usr/libexec/cpp -traditional
 #endif
 #define StandardCppOptions	-traditional
-#define StandardCppDefines	/**/
 #define PreProcessCmd   	CppCmd
 #define PreIncDir		DefaultGccIncludeDir
 
-#ifndef CcCmd
-#define CcCmd 			cc
+#if OSMajorVersion > 6 || (OSMajorVersion == 6 && OSMinorVersion >= 2)
+#define CcCmd			cc
+#define CplusplusCmd		c++
+#define CppArgs			-Wno-invalid-pp-token
+#else
+#define CcCmd			gcc
+#define CplusplusCmd		g++
+#define CppArgs			/**/
+#endif
+
+#ifndef StandardCppDefines
+#define StandardCppDefines	-traditional CppArgs
 #endif
+
 #ifndef AsCmd
 #define AsCmd			cc -c -x assembler
 #endif
@@ -914,8 +924,8 @@ install:: fonts.alias							@@\
  */
 
 #ifdef HasGcc2ForCplusplus
-CXXDEPENDINCLUDE != echo | `CcCmd -print-prog-name=cc1plus` -v 2>&1 | \
-		    sed -n 's/ \(.*[cg]++.*\)/-I\1/p'; rm -f gccdump.s
+CXXDEPENDINCLUDE != CcCmd -v -x c++ /dev/null -fsyntax-only \
+		    2>&1 | sed -n 's/^ \(\/.*[cg]++.*\)/-I\1/p'
 #define CplusplusDependIncludes $(CXXDEPENDINCLUDE)
 #endif
 
diff --git a/cde/include/EUSCompat.h b/cde/include/EUSCompat.h
index 469fc0a..44e4b9c 100644
--- a/cde/include/EUSCompat.h
+++ b/cde/include/EUSCompat.h
@@ -114,7 +114,7 @@ typedef enum {B_FALSE, B_TRUE} boolean_t;
 typedef enum {B_FALSE, B_TRUE} boolean_t;
 #define MAXNAMELEN      	256
 
-#if !defined(__FreeBSD__)
+#if !defined(CSRG_BASED)
 #define iconv_t			int
 #define iconv_open(a, b) 	((iconv_t) -1)
 #define iconv(a, b, c, d, e)	((size_t) 0)
diff --git a/cde/programs/dtappbuilder/src/abmf/proj_c_file.c b/cde/programs/dtappbuilder/src/abmf/proj_c_file.c
index 2482feb..86b6ecc 100644
--- a/cde/programs/dtappbuilder/src/abmf/proj_c_file.c
+++ b/cde/programs/dtappbuilder/src/abmf/proj_c_file.c
@@ -103,6 +103,7 @@ static int	write_map_window(
  */
 static char        *Includes[] =
 {
+    "<stdint.h>",
     "<unistd.h>",
     "<stdlib.h>",
     "<stdio.h>",
@@ -542,7 +543,7 @@ write_main(GenCodeInfo genCodeInfo, ABObj project)
     /*
      * Local variables
      */
-    abio_puts(codeFile, "Widget\t\ttoplevel = 0;\n");
+    abio_puts(codeFile, "Widget\t\ttoplevel = (Widget)NULL;\n");
     abio_puts(codeFile, "Display\t\t*display = (Display*)NULL;\n");
     abio_puts(codeFile, "XtAppContext\tapp = (XtAppContext)NULL;\n");
     abio_puts(codeFile, "String\t\t*fallback_resources = (String*)NULL;\n");
@@ -673,7 +674,7 @@ write_main(GenCodeInfo genCodeInfo, ABObj project)
     {
 	abmfP_write_c_comment(genCodeInfo, FALSE,
 		"Set up the application's root window.");
-        abio_printf(codeFile, "%s = toplevel;\n",
+        abio_printf(codeFile, "%s = toplevel;\n\n",
 	    abmfP_get_c_name_global(main_window));
 
 	if (obj_get_icon(main_window) != NULL)
diff --git a/cde/programs/dthelp/parser/canon1/build/out.c b/cde/programs/dthelp/parser/canon1/build/out.c
index 3124100..83f418d 100644
--- a/cde/programs/dthelp/parser/canon1/build/out.c
+++ b/cde/programs/dthelp/parser/canon1/build/out.c
@@ -483,7 +483,7 @@ char *partype(n)
 void srefout(M_NOPAR)
   {
     LOGICAL first = TRUE ;
-    int *mapbysref ;
+    int *mapbysref = NULL ;
     SREFSTRUCT *srefp ;
     SREFDATA *data ;
     int count = 0 ;
diff --git a/cde/programs/dthelp/parser/canon1/parser/end.c b/cde/programs/dthelp/parser/canon1/parser/end.c
index db23d27..9ad62c7 100644
--- a/cde/programs/dthelp/parser/canon1/parser/end.c
+++ b/cde/programs/dthelp/parser/canon1/parser/end.c
@@ -29,6 +29,8 @@ This product and information is proprietary of Tandem Computers Incorporated.
 
 /* End.c executes end-code specified in the interface. */
 
+#include <stdint.h>
+
 #include "userinc.h"
 #include "globdec.h"
 
diff --git a/cde/programs/dtksh/ksh93/src/cmd/ksh93/feature/poll b/cde/programs/dtksh/ksh93/src/cmd/ksh93/feature/poll
index 779283c..db17139 100644
--- a/cde/programs/dtksh/ksh93/src/cmd/ksh93/feature/poll
+++ b/cde/programs/dtksh/ksh93/src/cmd/ksh93/feature/poll
@@ -1,6 +1,6 @@
 hdr,sys	poll,socket,netinet/in
 lib	select,poll,socket
-typ	fd_set sys/socket.h
+typ	fd_set sys/socket.h sys/select.h
 cat{
 	#pragma prototyped
 	#ifdef _lib_poll
diff --git a/cde/programs/dtksh/ksh93/src/cmd/ksh93/features/poll b/cde/programs/dtksh/ksh93/src/cmd/ksh93/features/poll
index 779283c..db17139 100644
--- a/cde/programs/dtksh/ksh93/src/cmd/ksh93/features/poll
+++ b/cde/programs/dtksh/ksh93/src/cmd/ksh93/features/poll
@@ -1,6 +1,6 @@
 hdr,sys	poll,socket,netinet/in
 lib	select,poll,socket
-typ	fd_set sys/socket.h
+typ	fd_set sys/socket.h sys/select.h
 cat{
 	#pragma prototyped
 	#ifdef _lib_poll
diff --git a/cde/programs/dtlogin/sysauth.c b/cde/programs/dtlogin/sysauth.c
index 0e60d50..449dcd9 100644
--- a/cde/programs/dtlogin/sysauth.c
+++ b/cde/programs/dtlogin/sysauth.c
@@ -1956,6 +1956,13 @@ Authenticate( struct display *d, char *name, char *passwd, char **msg )
     }
 #endif
 
+#if defined(__OpenBSD__) && OSMAJORVERSION > 5
+    /*
+     * Use the OpenBSD getpwnam_shadow function to get the crypt()ed password
+     */
+     p = getpwnam_shadow(name);
+#endif
+
     if (!p || strlen(name) == 0 ||
         strcmp (crypt (passwd, p->pw_passwd), p->pw_passwd)) {
 
diff --git a/cde/programs/dtmail/include/DtMail/DtMail.hh b/cde/programs/dtmail/include/DtMail/DtMail.hh
index c4ffe90..7c9e407 100644
--- a/cde/programs/dtmail/include/DtMail/DtMail.hh
+++ b/cde/programs/dtmail/include/DtMail/DtMail.hh
@@ -48,7 +48,7 @@
 
 #include <stdio.h>
 #include <stdarg.h>
-#if defined(sun) || defined(__FreeBSD__)
+#if defined(sun) || defined(CSRG_BASED)
 #include <iconv.h>
 #endif
 #include <sys/stat.h>
@@ -931,7 +931,7 @@ friend class Session;
 			DTMailError_t minor_code);
 };
 
-#if defined(sun) || defined(__FreeBSD__)
+#if defined(sun) || defined(CSRG_BASED)
 template <typename T>
 size_t iconv (iconv_t i, const T inbuf, size_t* inleft,
 	       char** outbuf, size_t* outleft)
diff --git a/cde/programs/dtsession/SmLock.c b/cde/programs/dtsession/SmLock.c
index 711ad35..20d9c66 100644
--- a/cde/programs/dtsession/SmLock.c
+++ b/cde/programs/dtsession/SmLock.c
@@ -1799,7 +1799,12 @@ localAuthenticate(
    /*
     * Get password entry for 'name' or 'uid'.
     */
+#if defined(__OpenBSD__) && OSMAJORVERSION > 5
+    if ((pwent = (name == NULL ?
+            getpwuid_shadow(uid) : getpwnam_shadow(name))) == NULL)
+#else
     if ((pwent = (name == NULL ? getpwuid(uid) : getpwnam(name))) == NULL)
+#endif
     {
      /*
       * Can't get entry.
-- 
1.7.11.5

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to