summaryrefslogtreecommitdiffstats
path: root/tdecore
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-05 16:00:42 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-05 16:00:42 -0500
commit03518d6339ad40346fdcf7ab4b66d8eb307a36a8 (patch)
tree55f88ec42581d6d1484db0da8c7ae749d6cc5799 /tdecore
parent7cd4adc908abf8c5e3b391c4a88f0514ba8468c4 (diff)
parent3f5a4b419f7907ba61c6f63458e0413cccb74760 (diff)
downloadtdelibs-03518d6339ad40346fdcf7ab4b66d8eb307a36a8.tar.gz
tdelibs-03518d6339ad40346fdcf7ab4b66d8eb307a36a8.zip
Merge branch 'master' of https://scm.trinitydesktop.org/scm/git/tdelibs
Diffstat (limited to 'tdecore')
-rw-r--r--tdecore/CMakeLists.txt2
-rw-r--r--tdecore/kpty.cpp14
-rw-r--r--tdecore/network/kresolver.cpp121
-rw-r--r--tdecore/network/kresolver_p.h2
-rw-r--r--tdecore/tdeapplication.cpp2
5 files changed, 122 insertions, 19 deletions
diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt
index 5133be82e..508ca855b 100644
--- a/tdecore/CMakeLists.txt
+++ b/tdecore/CMakeLists.txt
@@ -131,7 +131,7 @@ tde_add_library( ${target} SHARED AUTOMOC
EMBED tdecorenetwork-static tdehw-static
LINK ltdlc-static ${KDESVGICONS} DCOP-shared tdefx-shared ${ZLIB_LIBRARIES}
${LIBIDN_LIBRARIES} ${XCOMPOSITE_LIBRARIES} ICE SM ${GAMIN_LIBRARIES}
- ${LIBBFD_LIBRARIES}
+ ${LIBBFD_LIBRARIES} util
DEPENDENCIES dcopidl dcopidl2cpp
DESTINATION ${LIB_INSTALL_DIR}
)
diff --git a/tdecore/kpty.cpp b/tdecore/kpty.cpp
index a94204241..7f27f02f8 100644
--- a/tdecore/kpty.cpp
+++ b/tdecore/kpty.cpp
@@ -305,6 +305,17 @@ bool KPty::open()
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 @@ bool KPty::open()
kdWarning(175) << "KPty::open(): " << "Can't open a pseudo teletype" << endl;
return false;
+#endif
gotpty:
return _attachPty(d->masterFd);
@@ -568,8 +580,10 @@ int KPty::slaveFd() const
// 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
}
diff --git a/tdecore/network/kresolver.cpp b/tdecore/network/kresolver.cpp
index b9ac605c0..6ec0c5aba 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 @@ TQStrList KResolver::protocolName(int protonum)
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 @@ TQStrList KResolver::protocolName(int protonum)
break;
}
while (pe == 0L);
+# endif
#endif
// Do common processing
@@ -648,7 +664,9 @@ TQStrList KResolver::protocolName(int protonum)
}
#ifdef HAVE_GETPROTOBYNAME_R
+# ifndef USE_OPENBSD
delete [] buf;
+# endif
#endif
return lst;
@@ -663,17 +681,28 @@ TQStrList KResolver::protocolName(const char *protoname)
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 @@ TQStrList KResolver::protocolName(const char *protoname)
break;
}
while (pe == 0L);
+# endif
#endif
// Do common processing
@@ -695,7 +725,9 @@ TQStrList KResolver::protocolName(const char *protoname)
}
#ifdef HAVE_GETPROTOBYNAME_R
+# ifndef USE_OPENBSD
delete [] buf;
+# endif
#endif
return lst;
@@ -710,17 +742,28 @@ int KResolver::protocolNumber(const char *protoname)
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 @@ int KResolver::protocolNumber(const char *protoname)
break;
}
while (pe == 0L);
+# endif
#endif
// Do common processing
@@ -738,7 +782,9 @@ int KResolver::protocolNumber(const char *protoname)
protonum = pe->p_proto;
#ifdef HAVE_GETPROTOBYNAME_R
+# ifndef USE_OPENBSD
delete [] buf;
+# endif
#endif
return protonum;
@@ -753,17 +799,27 @@ int KResolver::servicePort(const char *servname, const char *protoname)
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 @@ int KResolver::servicePort(const char *servname, const char *protoname)
break;
}
while (se == 0L);
+# endif
#endif
// Do common processing
@@ -781,7 +838,9 @@ int KResolver::servicePort(const char *servname, const char *protoname)
servport = ntohs(se->s_port);
#ifdef HAVE_GETSERVBYNAME_R
+# ifndef USE_OPENBSD
delete [] buf;
+# endif
#endif
return servport;
@@ -796,17 +855,27 @@ TQStrList KResolver::serviceName(const char* servname, const char *protoname)
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;
@@ -816,6 +885,7 @@ TQStrList KResolver::serviceName(const char* servname, const char *protoname)
break;
}
while (se == 0L);
+# endif
#endif
// Do common processing
@@ -828,7 +898,9 @@ TQStrList KResolver::serviceName(const char* servname, const char *protoname)
}
#ifdef HAVE_GETSERVBYNAME_R
+# ifndef USE_OPENBSD
delete [] buf;
+# endif
#endif
return lst;
@@ -843,17 +915,27 @@ TQStrList KResolver::serviceName(int port, const char *protoname)
se = getservbyport(port, 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 (getservbyport_r(port, 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 getservbyport_r which returns struct *servent or NULL
+# ifdef USE_SOLARIS // Solaris uses a 5 argument getservbyport_r which returns struct *servent or NULL
if ((se = getservbyport_r(port, protoname, &servbuf, buf, buflen)) && (errno == ERANGE))
-# else
+# else
if (getservbyport_r(port, protoname, &servbuf, buf, buflen, &se) == ERANGE)
-# endif
+# endif
{
se = 0L;
buflen += 1024;
@@ -863,6 +945,7 @@ TQStrList KResolver::serviceName(int port, const char *protoname)
break;
}
while (se == 0L);
+# endif
#endif
// Do common processing
@@ -875,7 +958,9 @@ TQStrList KResolver::serviceName(int port, const char *protoname)
}
#ifdef HAVE_GETSERVBYPORT_R
+# ifndef USE_OPENBSD
delete [] buf;
+# endif
#endif
return lst;
diff --git a/tdecore/network/kresolver_p.h b/tdecore/network/kresolver_p.h
index 7f74c6fe6..9cc139458 100644
--- a/tdecore/network/kresolver_p.h
+++ b/tdecore/network/kresolver_p.h
@@ -48,6 +48,7 @@ extern TQMutex getXXbyYYmutex;
#endif
/* some systems have the functions, but don't declare them */
+#ifndef __OpenBSD__
#if defined(HAVE_GETSERVBYNAME_R) && !HAVE_DECL_GETSERVBYNAME_R
extern "C" {
struct servent;
@@ -69,6 +70,7 @@ extern "C" {
struct protoent** result);
}
#endif
+#endif
/* decide whether res_init is thread-safe or not */
#if defined(__GLIBC__)
diff --git a/tdecore/tdeapplication.cpp b/tdecore/tdeapplication.cpp
index 450e522c1..c92479490 100644
--- a/tdecore/tdeapplication.cpp
+++ b/tdecore/tdeapplication.cpp
@@ -177,7 +177,9 @@ typedef void* IceIOErrorHandler;
#if defined Q_WS_X11
#include <sys/ioctl.h>
+#ifdef __linux__
#include <linux/vt.h>
+#endif
extern "C" {
extern int getfd(const char *fnam);
}