Branch: master

e61585ed 2014-10-05 09:28:01 François Andriot
Add support for openbsd pty in kpty
M tdecore/kpty.cpp
diff --git a/tdecore/kpty.cpp b/tdecore/kpty.cpp
index a942042..7f27f02 100644
--- a/tdecore/kpty.cpp
+++ b/tdecore/kpty.cpp
@@ -305,6 +305,17 @@
   if (d->masterFd >= 0)
     return true;
 
+#if defined(__OpenBSD__)
+  char cpty[16];
+
+  if (openpty(&d->masterFd, &d->slaveFd, cpty, NULL, &d->winSize) == 0) {
+    d->ttyName = cpty;
+  } else {
+    kdWarning(175) << "Can't open slave pseudo teletype" << endl;
+    return false;
+  }
+#else
+
   TQCString ptyName;
 
   // Find a master pty that we can open ////////////////////////////////
@@ -379,6 +390,7 @@
 
   kdWarning(175) << "KPty::open(): " << "Can't open a pseudo teletype" << endl;
   return false;
+#endif
 
  gotpty:
   return  _attachPty(d->masterFd);
@@ -568,8 +580,10 @@
 // private
 bool KPty::chownpty(bool grant)
 {
+#if !defined(__OpenBSD__)
   TDEProcess proc;
   proc << locate("exe", BASE_CHOWN) << (grant?"--grant":"--revoke") << TQString::number(d->masterFd);
   return proc.start(TDEProcess::Block) && proc.normalExit() && !proc.exitStatus();
+#endif
 }
 
439f3ba7 2014-10-05 09:31:25 François Andriot
Add support for openbsd in kresolver
M tdecore/network/kresolver.cpp
M tdecore/network/kresolver_p.h
diff --git a/tdecore/network/kresolver.cpp b/tdecore/network/kresolver.cpp
index b9ac605..6ec0c5a 100644
--- a/tdecore/network/kresolver.cpp
+++ b/tdecore/network/kresolver.cpp
@@ -66,6 +66,10 @@
 TQMutex getXXbyYYmutex;
 #endif
 
+#ifdef __OpenBSD__
+#define USE_OPENBSD 1
+#endif
+
 using namespace KNetwork;
 using namespace KNetwork::Internal;
 
@@ -616,17 +620,28 @@
   pe = getprotobynumber(protonum);
 
 #else
+# ifdef USE_OPENBSD // OpenBSD uses an HP/IBM/DEC API
+  struct protoent protobuf;
+  struct protoent_data pdata;
+  ::memset(&pdata, 0, sizeof pdata);
+
+  if (getprotobynumber_r(protonum, &protobuf, &pdata) == 0)
+    pe = &protobuf;
+  else
+    pe = 0;
+
+# else
   size_t buflen = 1024;
   struct protoent protobuf;
   char *buf;
   do
     {
       buf = new char[buflen];
-# ifdef USE_SOLARIS // Solaris uses a 4 argument getprotobynumber_r which returns struct *protoent or NULL
+#  ifdef USE_SOLARIS // Solaris uses a 4 argument getprotobynumber_r which returns struct *protoent or NULL
       if ((pe = getprotobynumber_r(protonum, &protobuf, buf, buflen)) && (errno == ERANGE))
-# else
+#  else
       if (getprotobynumber_r(protonum, &protobuf, buf, buflen, &pe) == ERANGE)
-# endif
+#  endif
 	{
           pe = 0L;
 	  buflen += 1024;
@@ -636,6 +651,7 @@
 	break;
     }
   while (pe == 0L);
+# endif
 #endif
 
   // Do common processing
@@ -648,7 +664,9 @@
     }
 
 #ifdef HAVE_GETPROTOBYNAME_R
+# ifndef USE_OPENBSD
   delete [] buf;
+# endif
 #endif
 
   return lst;
@@ -663,17 +681,28 @@
   pe = getprotobyname(protoname);
 
 #else
+# ifdef USE_OPENBSD // OpenBSD uses an HP/IBM/DEC API
+  struct protoent protobuf;
+  struct protoent_data pdata;
+  ::memset(&pdata, 0, sizeof pdata);
+
+  if (getprotobyname_r(protoname, &protobuf, &pdata) == 0)
+    pe = &protobuf;
+  else
+    pe = 0;
+
+# else
   size_t buflen = 1024;
   struct protoent protobuf;
   char *buf;
   do
     {
       buf = new char[buflen];
-# ifdef USE_SOLARIS // Solaris uses a 4 argument getprotobyname_r which returns struct *protoent or NULL
+#  ifdef USE_SOLARIS // Solaris uses a 4 argument getprotobyname_r which returns struct *protoent or NULL
       if ((pe = getprotobyname_r(protoname, &protobuf, buf, buflen)) && (errno == ERANGE))
-# else
+#  else
       if (getprotobyname_r(protoname, &protobuf, buf, buflen, &pe) == ERANGE)
-# endif
+#  endif
 	{
           pe = 0L;
 	  buflen += 1024;
@@ -683,6 +712,7 @@
 	break;
     }
   while (pe == 0L);
+# endif
 #endif
 
   // Do common processing
@@ -695,7 +725,9 @@
     }
 
 #ifdef HAVE_GETPROTOBYNAME_R
+# ifndef USE_OPENBSD
   delete [] buf;
+# endif
 #endif
 
   return lst;
@@ -710,17 +742,28 @@
   pe = getprotobyname(protoname);
 
 #else
+# ifdef USE_OPENBSD // OpenBSD uses an HP/IBM/DEC API
+  struct protoent protobuf;
+  struct protoent_data pdata;
+  ::memset(&pdata, 0, sizeof pdata);
+
+  if (getprotobyname_r(protoname, &protobuf, &pdata) == 0)
+    pe = &protobuf;
+  else
+    pe = 0;
+
+# else
   size_t buflen = 1024;
   struct protoent protobuf;
   char *buf;
   do
     {
       buf = new char[buflen];
-# ifdef USE_SOLARIS // Solaris uses a 4 argument getprotobyname_r which returns struct *protoent or NULL
+#  ifdef USE_SOLARIS // Solaris uses a 4 argument getprotobyname_r which returns struct *protoent or NULL
       if ((pe = getprotobyname_r(protoname, &protobuf, buf, buflen)) && (errno == ERANGE))
-# else
+#  else
       if (getprotobyname_r(protoname, &protobuf, buf, buflen, &pe) == ERANGE)
-# endif
+#  endif
 	{
           pe = 0L;
 	  buflen += 1024;
@@ -730,6 +773,7 @@
 	break;
     }
   while (pe == 0L);
+# endif
 #endif
 
   // Do common processing
@@ -738,7 +782,9 @@
     protonum = pe->p_proto;
 
 #ifdef HAVE_GETPROTOBYNAME_R
+# ifndef USE_OPENBSD
   delete [] buf;
+# endif
 #endif
 
   return protonum;
@@ -753,17 +799,27 @@
   se = getservbyname(servname, protoname);
 
 #else
+# ifdef USE_OPENBSD // OpenBSD uses an HP/IBM/DEC API
+  struct servent servbuf;
+  struct servent_data sdata;
+  ::memset(&sdata, 0, sizeof sdata);
+  if (getservbyname_r(servname, protoname, &servbuf, &sdata) == 0)
+    se = &servbuf;
+  else
+    se = 0;
+
+# else
   size_t buflen = 1024;
   struct servent servbuf;
   char *buf;
   do
     {
       buf = new char[buflen];
-# ifdef USE_SOLARIS // Solaris uses a 5 argument getservbyname_r which returns struct *servent or NULL
+#  ifdef USE_SOLARIS // Solaris uses a 5 argument getservbyname_r which returns struct *servent or NULL
       if ((se = getservbyname_r(servname, protoname, &servbuf, buf, buflen)) && (errno == ERANGE))
-# else
+#  else
       if (getservbyname_r(servname, protoname, &servbuf, buf, buflen, &se) == ERANGE)
-# endif
+#  endif
 	{
           se = 0L;
 	  buflen += 1024;
@@ -773,6 +829,7 @@
 	break;
     }
   while (se == 0L);
+# endif
 #endif
 
   // Do common processing
@@ -781,7 +838,9 @@
     servport = ntohs(se->s_port);
 
 #ifdef HAVE_GETSERVBYNAME_R
+# ifndef USE_OPENBSD
 ** Diff limit reached (max: 250 lines) **
8f3cf10d 2014-10-05 09:33:10 François Andriot
Fix FTBFS because Linux specific include in tdeapplication.cpp
M tdecore/tdeapplication.cpp
 ** Diff limit reached (max: 250 lines) **
b588c6e6 2014-10-05 09:34:34 François Andriot
Add 'tdesu' to tdeioslave_file mount/umount command on openbsd
M tdeioslave/file/file.cc
 ** Diff limit reached (max: 250 lines) **
9c7a8637 2014-10-05 09:37:12 François Andriot
Fix FTBFS because undefined __progname in tdeio_connection
M tdeio/tdeio/connection.cpp
 ** Diff limit reached (max: 250 lines) **
78a66b11 2014-10-05 09:38:00 François Andriot
Disable environment-based completion in kurlcompletion on openbsd
M tdeio/tdeio/kurlcompletion.cpp
 ** Diff limit reached (max: 250 lines) **
754647ba 2014-10-05 09:39:58 François Andriot
Fix cupsd process detection
M tdeprint/cups/cupsdconf2/cupsddialog.cpp
 ** Diff limit reached (max: 250 lines) **
69e7a5c4 2014-10-05 09:40:33 François Andriot
Fix cups default directories on openbsd
M tdeprint/cups/kmcupsmanager.cpp
 ** Diff limit reached (max: 250 lines) **
cca50763 2014-10-05 09:41:48 François Andriot
Fix default spell checker on openbsd
M tdeui/ksconfig.cpp
 ** Diff limit reached (max: 250 lines) **