I'll sort the remaining fixes per subdirectory.  This fixes another for
loop, adds appropriate #ifdefs, provides a prototype for _DtsDbListDB()
and defines MAXINT to INT_MAX (BSD doesn't have values.h).
>From a894f50454343b091cc9a93fc49fc86e59d4de86 Mon Sep 17 00:00:00 2001
From: Pascal Stumpf <pascal.stu...@cubes.de>
Date: Thu, 9 Aug 2012 22:51:52 +0200
Subject: [PATCH] OpenBSD fixed for lib/DtSvc.

---
 cde/lib/DtSvc/DtCodelibs/filegen.C        |    3 ++-
 cde/lib/DtSvc/DtEncap/spc-termio.c        |    4 +++-
 cde/lib/DtSvc/DtUtil1/CmdMain.c           |    4 ++--
 cde/lib/DtSvc/DtUtil1/DbLoad.c            |    2 ++
 cde/lib/DtSvc/DtUtil1/Dts.c               |    5 ++++-
 cde/lib/DtSvc/DtUtil2/XlationSvc.c        |    4 ++--
 cde/lib/DtSvc/include/bms/sbstdinc.h      |    2 +-
 cde/lib/DtSvc/include/codelibs/dynarray.h |    4 ++--
 cde/lib/DtSvc/include/codelibs/privbuf.h  |    2 +-
 cde/lib/DtSvc/include/codelibs/stringx.h  |    6 +++---
 10 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/cde/lib/DtSvc/DtCodelibs/filegen.C 
b/cde/lib/DtSvc/DtCodelibs/filegen.C
index e29f1c3..ad8c8de 100644
--- a/cde/lib/DtSvc/DtCodelibs/filegen.C
+++ b/cde/lib/DtSvc/DtCodelibs/filegen.C
@@ -272,10 +272,11 @@ _SHXbuf::filegen()
     // Find the longest match if we are doing completion:
     if (completion)
     {
+       long i;
        // compare all entries to a copy of the first entry
        strcpy(filebuf, &bufptr[long(vec[0])]);
 
-       for (long i = 1; i < vec.size(); i++)
+       for (i = 1; i < vec.size(); i++)
        {
            register char *ref = filebuf;
            register char *ptr = &bufptr[long(vec[i])];
diff --git a/cde/lib/DtSvc/DtEncap/spc-termio.c 
b/cde/lib/DtSvc/DtEncap/spc-termio.c
index 033453a..89b7b4e 100644
--- a/cde/lib/DtSvc/DtEncap/spc-termio.c
+++ b/cde/lib/DtSvc/DtEncap/spc-termio.c
@@ -36,7 +36,7 @@
 #include <bms/stringbuf.h>
 
 #include <termios.h>
-#if !defined(linux)
+#if !defined(linux) && !defined(CSRG_BASED)
 #include <sys/termio.h>
 #endif
 #include <codelibs/stringx.h>
@@ -145,6 +145,7 @@ static struct modes_s Output_modes[] = {
     "OCRNL",   OCRNL,
     "ONOCR",   ONOCR,
     "ONLRET",  ONLRET,
+#if !defined(CSRG_BASED)
     "OFILL",   OFILL,
     "OFDEL",   OFDEL,
     "NLDLY",   NLDLY,
@@ -169,6 +170,7 @@ static struct modes_s Output_modes[] = {
     "FFDLY",   FFDLY,
     "FF0",     FF0,
     "FF1",     FF1,
+#endif
     END_OF_LIST, 0
 };
 
diff --git a/cde/lib/DtSvc/DtUtil1/CmdMain.c b/cde/lib/DtSvc/DtUtil1/CmdMain.c
index 00e64ec..d57a2f4 100644
--- a/cde/lib/DtSvc/DtUtil1/CmdMain.c
+++ b/cde/lib/DtSvc/DtUtil1/CmdMain.c
@@ -43,7 +43,7 @@
 #ifdef __apollo
 #include "/sys5/usr/include/sys/termio.h"
 #else
-#include <termio.h>
+#include <termios.h>
 #endif
 #include <errno.h>
 #include <unistd.h>
@@ -989,7 +989,7 @@ _DtCmdCommandInvokerExecute (
       if (commandPid == 0) 
       {
 
-#if defined(__hp_osf) || defined(__osf__)
+#if defined(__hp_osf) || defined(__osf__) || defined(CSRG_BASED)
          setsid() ;
 #else
          (void) setpgrp ();
diff --git a/cde/lib/DtSvc/DtUtil1/DbLoad.c b/cde/lib/DtSvc/DtUtil1/DbLoad.c
index 7f0e242..b0b753d 100644
--- a/cde/lib/DtSvc/DtUtil1/DbLoad.c
+++ b/cde/lib/DtSvc/DtUtil1/DbLoad.c
@@ -104,6 +104,8 @@ extern      void    _DtDtsSeqReset(void);
 extern int     _DtDtsNextDCSeq(void);
 extern int     _DtDtsNextDASeq(void);
 
+char **_DtsDbListDb(void);
+
 int      use_in_memory_db = False;
 
 static void
diff --git a/cde/lib/DtSvc/DtUtil1/Dts.c b/cde/lib/DtSvc/DtUtil1/Dts.c
index 4c61d8a..4b5956c 100644
--- a/cde/lib/DtSvc/DtUtil1/Dts.c
+++ b/cde/lib/DtSvc/DtUtil1/Dts.c
@@ -49,7 +49,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include <values.h>
 #include <sys/mman.h>
 #include <stdio.h>
 #include <fcntl.h>
@@ -59,6 +58,10 @@
  * On HP MAXINT is defined in both <values.h> and <sys/param.h>
  */
 #undef MAXINT
+#elif defined(CSRG_BASED)
+#define MAXINT INT_MAX
+#else
+#include <values.h>
 #endif
 #include <sys/param.h>
 #include <sys/errno.h>
diff --git a/cde/lib/DtSvc/DtUtil2/XlationSvc.c 
b/cde/lib/DtSvc/DtUtil2/XlationSvc.c
index 4d7dc3d..cbb6982 100644
--- a/cde/lib/DtSvc/DtUtil2/XlationSvc.c
+++ b/cde/lib/DtSvc/DtUtil2/XlationSvc.c
@@ -2197,7 +2197,7 @@ int _DtXlateGetXlateEnv(
    /* then look up version number of execution host */
    if (ret_AppExecEnvVersion) 
    {
-#if defined(sun) || defined(_AIX) || defined(USL) || defined(__uxp__) || 
defined(__osf__) || defined(linux)
+#if defined(sun) || defined(_AIX) || defined(USL) || defined(__uxp__) || 
defined(__osf__) || defined(linux) || defined(CSRG_BASED)
       char version[SYS_NMLN+SYS_NMLN+2];
 #else
       char version[UTSLEN+UTSLEN+2];
@@ -2250,7 +2250,7 @@ int _DtXlateGetXlateEnv(
 #error OSMAJORVERSION and/or OSMINORVERSION not defined
 #endif
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
       sprintf(buf,"%s%s%s", STR(OSMAJORVERSION), 
                      nl_langinfo('.'), STR(OSMINORVERSION));
 #else
diff --git a/cde/lib/DtSvc/include/bms/sbstdinc.h 
b/cde/lib/DtSvc/include/bms/sbstdinc.h
index 05711f1..ed5ae36 100644
--- a/cde/lib/DtSvc/include/bms/sbstdinc.h
+++ b/cde/lib/DtSvc/include/bms/sbstdinc.h
@@ -59,7 +59,7 @@
 /************************************************************************/
 
 /* Domain/OS BSD has bzero(), bcmp(), and bcopy() defined. */
-#if !defined(apollo) || !defined(__bsd)
+#if !(defined(apollo) && defined(__bsd)) && !defined(CSRG_BASED)
 
 #if defined(__STDC__)
 #if !defined(linux) && !defined(__osf__) && !defined(_XFUNCS_H_)
diff --git a/cde/lib/DtSvc/include/codelibs/dynarray.h 
b/cde/lib/DtSvc/include/codelibs/dynarray.h
index 8c2e88c..51f03cd 100644
--- a/cde/lib/DtSvc/include/codelibs/dynarray.h
+++ b/cde/lib/DtSvc/include/codelibs/dynarray.h
@@ -36,10 +36,10 @@
 #ifndef __DYNARRAY_H_
 #define __DYNARRAY_H_
 
-#if !defined(linux)
+#if !defined(linux) && !defined(CSRG_BASED)
 #include <generic.h>
 #endif
-#if defined(USL) || defined(__uxp__) || defined(__osf__) || defined(sun) || 
defined(linux)
+#if defined(USL) || defined(__uxp__) || defined(__osf__) || defined(sun) || 
defined(linux) || defined(CSRG_BASED)
 #define _DELETE_ARRAY(sz) delete[]
 #else
 #define _DELETE_ARRAY(sz) delete[(sz)]
diff --git a/cde/lib/DtSvc/include/codelibs/privbuf.h 
b/cde/lib/DtSvc/include/codelibs/privbuf.h
index e3a538b..23f7840 100644
--- a/cde/lib/DtSvc/include/codelibs/privbuf.h
+++ b/cde/lib/DtSvc/include/codelibs/privbuf.h
@@ -48,7 +48,7 @@ typedef void (*privbuf_func)(void *v);
 #include <stddef.h>
 #include <stdlib.h>
 
-#if defined(__osf__) || defined(sun) || defined(linux)
+#if defined(__osf__) || defined(sun) || defined(linux) || defined(CSRG_BASED)
 // The DEC C++ compiler rejects valid inline declarations, claiming
 // they have both internal and external linkage.
 #else
diff --git a/cde/lib/DtSvc/include/codelibs/stringx.h 
b/cde/lib/DtSvc/include/codelibs/stringx.h
index 6ccc6ce..0d878b6 100644
--- a/cde/lib/DtSvc/include/codelibs/stringx.h
+++ b/cde/lib/DtSvc/include/codelibs/stringx.h
@@ -75,7 +75,7 @@ extern "C"
 
 #ifdef __cplusplus
     char *strtokx(char *&ptr, const char *sep);
-# if !defined(__osf__) && !defined(linux)
+# if !defined(__osf__) && !defined(linux) && !defined(CSRG_BASED)
     char **strsep(const char *str, const char *sep,
        boolean whsp = TRUE, int *num = NULL);
 #  if !defined(__osf__)
@@ -85,7 +85,7 @@ extern "C"
 
 #else /* __STDC__ */
     char *strtokx(char **ptr, const char *sep);
-# if !defined(linux)
+# if !defined(linux) && !defined(CSRG_BASED)
     char **strsep(const char *str, const char *sep,
        boolean whsp, int *num);
 #endif
@@ -137,7 +137,7 @@ inline void  strfree(const char *s)
        { if (s != NULL) free((char *)s); }
 #else
 inline void  strfree(const char *s)
-#if defined(__hpux) || defined(__osf__)
+#if defined(__hpux) || defined(__osf__) || defined(CSRG_BASED)
        { if (s != NULL) free((void *)s); }
 #else
        { if (s != NULL) free((const void *)s); }
-- 
1.7.6

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to