-rw-r--r-- | microkde/oprocess.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/microkde/oprocess.cpp b/microkde/oprocess.cpp index 95e3e4b..a935792 100644 --- a/microkde/oprocess.cpp +++ b/microkde/oprocess.cpp @@ -1,168 +1,169 @@ /* This file is part of the Opie Project Copyright (C) 2002-2004 Holger Freyther <zecke@handhelds.org> and The Opie Team <opie-devel@handhelds.org> =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at) .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "oprocctrl.h" /* OPIE */ #include <oprocess.h> /* QT */ #include <qapplication.h> #include <qdir.h> #include <qmap.h> +#include <qregexp.h> #include <qsocketnotifier.h> #include <qtextstream.h> /* STD */ #include <errno.h> #include <fcntl.h> #include <pwd.h> #include <stdlib.h> #include <signal.h> #include <stdio.h> #include <string.h> #include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/socket.h> #include <unistd.h> #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif #ifdef HAVE_INITGROUPS #include <grp.h> #endif using namespace Opie::Core::Internal; namespace Opie { namespace Core { namespace Internal { class OProcessPrivate { public: OProcessPrivate() : useShell( false ) { } bool useShell; QMap<QString, QString> env; QString wd; QCString shell; }; } OProcess::OProcess( QObject *parent, const char *name ) : QObject( parent, name ) { init ( ); } OProcess::OProcess( const QString &arg0, QObject *parent, const char *name ) : QObject( parent, name ) { init ( ); *this << arg0; } OProcess::OProcess( const QStringList &args, QObject *parent, const char *name ) : QObject( parent, name ) { init ( ); *this << args; } void OProcess::init ( ) { run_mode = NotifyOnExit; runs = false; pid_ = 0; status = 0; keepPrivs = false; innot = 0; outnot = 0; errnot = 0; communication = NoCommunication; input_data = 0; input_sent = 0; input_total = 0; d = 0; if ( 0 == OProcessController::theOProcessController ) { ( void ) new OProcessController(); CHECK_PTR( OProcessController::theOProcessController ); } OProcessController::theOProcessController->addOProcess( this ); out[ 0 ] = out[ 1 ] = -1; in[ 0 ] = in[ 1 ] = -1; err[ 0 ] = err[ 1 ] = -1; } void OProcess::setEnvironment( const QString &name, const QString &value ) { if ( !d ) d = new OProcessPrivate; d->env.insert( name, value ); } void OProcess::setWorkingDirectory( const QString &dir ) { if ( !d ) d = new OProcessPrivate; d->wd = dir; } void OProcess::setupEnvironment() { if ( d ) { QMap<QString, QString>::Iterator it; for ( it = d->env.begin(); it != d->env.end(); ++it ) setenv( QFile::encodeName( it.key() ).data(), QFile::encodeName( it.data() ).data(), 1 ); if ( !d->wd.isEmpty() ) chdir( QFile::encodeName( d->wd ).data() ); } } void OProcess::setRunPrivileged( bool keepPrivileges ) { keepPrivs = keepPrivileges; } bool OProcess::runPrivileged() const { return keepPrivs; } OProcess::~OProcess() { |