Timothy Pearson 10 years ago
commit 03518d6339

@ -181,6 +181,12 @@ check_include_file( "mntent.h" HAVE_MNTENT_H )
check_include_file( "ndir.h" HAVE_NDIR_H )
check_include_file( "netinet/in.h" HAVE_NETINET_IN_H )
check_include_file( "net/if.h" HAVE_NET_IF_H )
if( NOT HAVE_NET_IF_H )
find_path( NET_IF_PATH "net/if.h" )
if( NET_IF_PATH )
set( HAVE_NET_IF_H "1" )
endif( )
endif( )
check_include_file( "paths.h" HAVE_PATHS_H )
check_include_file( "pty.h" HAVE_PTY_H )
check_include_file( "stdint.h" HAVE_STDINT_H )
@ -197,6 +203,12 @@ check_include_file( "sys/mman.h" HAVE_SYS_MMAN_H )
check_include_file( "sys/mntent.h" HAVE_SYS_MNTENT_H )
check_include_file( "sys/mnttab.h" HAVE_SYS_MNTTAB_H )
check_include_file( "sys/mount.h" HAVE_SYS_MOUNT_H )
if( NOT HAVE_SYS_MOUNT_H )
find_path( SYS_MOUNT_PATH "sys/mount.h" )
if( SYS_MOUNT_PATH )
set( HAVE_SYS_MOUNT_H "1" )
endif( )
endif( )
check_include_file( "sys/ndir.h" HAVE_SYS_NDIR_H )
check_include_file( "sys/param.h" HAVE_SYS_PARAM_H )
check_include_file( "sys/prctl.h" HAVE_SYS_PRCTL_H )
@ -206,6 +218,12 @@ check_include_file( "sys/stat.h" HAVE_SYS_STAT_H )
check_include_file( "sys/stropts.h" HAVE_SYS_STROPTS_H )
check_include_file( "sys/types.h" HAVE_SYS_TYPES_H )
check_include_file( "sys/ucred.h" HAVE_SYS_UCRED_H )
if( NOT HAVE_SYS_UCRED_H )
find_path( SYS_UCRED_PATH "sys/ucred.h" )
if( SYS_UCRED_PATH )
set( HAVE_SYS_UCRED_H "1" )
endif( )
endif( )
check_include_file( "sys/xattr.h" HAVE_SYS_XATTR_H )
check_include_file( "termios.h" HAVE_TERMIOS_H )
check_include_file( "termio.h" HAVE_TERMIO_H )
@ -263,7 +281,7 @@ check_function_exists( mkstemps HAVE_MKSTEMPS )
check_symbol_exists( mkstemps "stdlib.h" HAVE_MKSTEMPS_PROTO )
check_function_exists( initgroups HAVE_INITGROUPS )
check_symbol_exists( initgroups "grp.h" HAVE_INITGROUPS_PROTO )
check_symbol_exists( initgroups "grp.h;unistd.h" HAVE_INITGROUPS_PROTO )
check_function_exists( strlcat HAVE_STRLCAT )
check_symbol_exists( strlcat "string.h" HAVE_STRLCAT_PROTO )
@ -305,6 +323,9 @@ if (HAVE_ALLOCA_H )
else (HAVE_ALLOCA_H )
check_symbol_exists( alloca "stdlib.h" HAVE_ALLOCA )
endif (HAVE_ALLOCA_H )
if( ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
set( HAVE_ALLOCA 1 )
endif( )
check_function_exists( getmntinfo HAVE_GETMNTINFO )
check_function_exists( getnameinfo HAVE_GETNAMEINFO )
@ -475,10 +496,15 @@ set( kde_socklen_t socklen_t )
##### check for libdl ###########################
find_library( HAVE_LIBDL dl )
if( NOT HAVE_LIBDL-NOTFOUND )
set( DL_LIBRARIES dl )
endif( NOT HAVE_LIBDL-NOTFOUND )
set( DL_LIBRARIES dl )
check_library_exists( ${DL_LIBRARIES} dlopen /lib HAVE_LIBDL )
if( NOT HAVE_LIBDL )
unset( DL_LIBRARIES )
check_function_exists( dlopen HAVE_DLOPEN )
if( HAVE_DLOPEN )
set( HAVE_LIBDL 1 )
endif( HAVE_DLOPEN )
endif( NOT HAVE_LIBDL )
##### check for utempter ########################

@ -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}
)

@ -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
}

@ -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;

@ -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__)

@ -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);
}

@ -43,7 +43,11 @@
#include <kdebug.h>
#include <tqsocketnotifier.h>
#if defined(__OpenBSD__)
#define __progname getprogname()
#else
extern char *__progname;
#endif
using namespace TDEIO;

@ -778,10 +778,15 @@ bool KURLCompletion::userCompletion(const MyURL &url, TQString *match)
// Environment variables
//
#if !defined(__OpenBSD__)
extern char **environ; // Array of environment variables
#endif
bool KURLCompletion::envCompletion(const MyURL &url, TQString *match)
{
#if defined(__OpenBSD__)
return false;
#else
if ( url.file().at(0) != '$' )
return false;
@ -816,6 +821,7 @@ bool KURLCompletion::envCompletion(const MyURL &url, TQString *match)
*match = finished();
return true;
#endif
}
//////////////////////////////////////////////////

@ -1455,6 +1455,9 @@ void FileProtocol::mount( bool _ro, const char *_fstype, const TQString& _dev, c
dev.data()
point.data()
tmp );
#elif defined(__OpenBSD__)
buffer.sprintf( "%s %s %s -t %s %s %s 2>%s", "tdesu", mountProg.latin1(), readonly.data(),
fstype.data(), dev.data(), point.data(), tmp );
#else
buffer.sprintf( "%s %s -t %s %s %s 2>%s", mountProg.latin1(), readonly.data(),
fstype.data(), dev.data(), point.data(), tmp );
@ -1614,7 +1617,11 @@ void FileProtocol::unmount( const TQString& _point )
error( TDEIO::ERR_COULD_NOT_UNMOUNT, i18n("Could not find program \"umount\""));
return;
}
#ifdef __OpenBSD__
buffer.sprintf( "%s %s %s 2>%s", "tdesu", umountProg.latin1(), TQFile::encodeName(TDEProcess::quote(_point)).data(), tmp );
#else
buffer.sprintf( "%s %s 2>%s", umountProg.latin1(), TQFile::encodeName(TDEProcess::quote(_point)).data(), tmp );
#endif
system( buffer.data() );
#endif /* HAVE_VOLMGT */

@ -44,6 +44,7 @@
#include <tdeio/passdlg.h>
#include <kguiitem.h>
#include <kprocess.h>
#include <tqprocess.h>
#include <stdlib.h>
#include <signal.h>
@ -70,6 +71,18 @@ extern "C"
int getServerPid()
{
#if defined(__OpenBSD__)
TQProcess *proc = new TQProcess();
proc->addArgument("pgrep");
proc->addArgument("cupsd");
proc->start();
while (proc->isRunning()); //Wait for process to exit
TQString pidString = proc->readLineStdout();
bool ok;
int pid = pidString.toInt(&ok);
if (ok) return pid;
return (-1);
#else
TQDir dir("/proc",TQString::null,TQDir::Name,TQDir::Dirs);
for (uint i=0;i<dir.count();i++)
{
@ -88,6 +101,7 @@ int getServerPid()
}
}
return (-1);
#endif
}
const char* getPassword(const char*)

@ -101,11 +101,20 @@ TQString KMCupsManager::driverDbCreationProgram()
TQString KMCupsManager::driverDirectory()
{
TQString d = cupsInstallDir();
if (d.isEmpty())
if (d.isEmpty()) {
#ifdef __OpenBSD__
d = "/usr/local";
#else
d = "/usr";
#endif
}
d.append("/share/cups/model");
// raw foomatic support
#ifdef __OpenBSD__
d.append(":/usr/local/share/foomatic/db/source");
#else
d.append(":/usr/share/foomatic/db/source");
#endif
return d;
}
@ -138,7 +147,7 @@ bool KMCupsManager::createPrinter(KMPrinter *p)
req.setOperation(CUPS_ADD_CLASS);
TQStringList members = p->members(), uris;
TQString s;
s = TQString::fromLocal8Bit("ipp://%1/printers/").arg(CupsInfos::self()->hostaddr());
s = TQString::fromLocal8Bit("ipp://%1/printers/").arg(CupsInfos::self()->hostaddr());
for (TQStringList::ConstIterator it=members.begin(); it!=members.end(); ++it)
uris.append(s+(*it));
req.addURI(IPP_TAG_PRINTER,"member-uris",uris);
@ -627,7 +636,11 @@ DrMain* KMCupsManager::loadMaticDriver(const TQString& drname)
{
TQStringList comps = TQStringList::split('/', drname, false);
TQString tmpFile = locateLocal("tmp", "foomatic_" + kapp->randomString(8));
#ifdef __OpenBSD__
TQString PATH = getenv("PATH") + TQString::fromLatin1(":/usr/local/bin:/usr/sbin:/usr/local/sbin:/opt/sbin:/opt/local/sbin");
#else
TQString PATH = getenv("PATH") + TQString::fromLatin1(":/usr/sbin:/usr/local/sbin:/opt/sbin:/opt/local/sbin");
#endif
TQString exe = TDEStandardDirs::findExe("foomatic-datafile", PATH);
if (exe.isEmpty())
{
@ -937,10 +950,15 @@ void KMCupsManager::exportDriver()
!m_currentprinter->isClass(true) && !m_currentprinter->isSpecial())
{
TQString path = cupsInstallDir();
if (path.isEmpty())
if (path.isEmpty()) {
#ifdef __OpenBSD__
path = "/usr/local/share/cups";
#else
path = "/usr/share/cups";
else
#endif
} else {
path += "/share/cups";
}
CupsAddSmb::exportDest(m_currentprinter->printerName(), path);
}
}

@ -36,6 +36,6 @@ set( ${target}_SRCS
tde_add_kpart( ${target} AUTOMOC
SOURCES ${${target}_SRCS}
LINK tdefx-shared tdecore-shared dl
LINK tdefx-shared tdecore-shared ${DL_LIBRARIES}
DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
)

@ -188,7 +188,11 @@ KSpellConfig::readGlobalSettings()
setDictionary ( kc->readEntry("KSpell_Dictionary") );
setDictFromList ( kc->readNumEntry("KSpell_DictFromList", false) );
setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_UTF8) );
#ifdef __OpenBSD__
setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ASPELL) );
#else
setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ISPELL) );
#endif
return true;
}

Loading…
Cancel
Save