summaryrefslogtreecommitdiffabout
path: root/microkde/oprocess.cpp
Unidiff
Diffstat (limited to 'microkde/oprocess.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/oprocess.cpp1
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,136 +1,137 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3             Copyright (C) 2002-2004 Holger Freyther <zecke@handhelds.org> 3             Copyright (C) 2002-2004 Holger Freyther <zecke@handhelds.org>
4 and The Opie Team <opie-devel@handhelds.org> 4 and The Opie Team <opie-devel@handhelds.org>
5 =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at) 5 =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at)
6 .=l. 6 .=l.
7          .>+-= 7          .>+-=
8_;:,     .>    :=|. This program is free software; you can 8_;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12- .   .-<_>     .<> Foundation; either version 2 of the License, 12- .   .-<_>     .<> Foundation; either version 2 of the License,
13    ._= =}       : or (at your option) any later version. 13    ._= =}       : or (at your option) any later version.
14   .%`+i>       _;_. 14   .%`+i>       _;_.
15   .i_,=:_.      -<s. This program is distributed in the hope that 15   .i_,=:_.      -<s. This program is distributed in the hope that
16    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16    +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17   : ..    .:,     . . . without even the implied warranty of 17   : ..    .:,     . . . without even the implied warranty of
18   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18   =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22:     =  ...= . :.=- 22:     =  ...= . :.=-
23-.   .:....=;==+<; You should have received a copy of the GNU 23-.   .:....=;==+<; You should have received a copy of the GNU
24 -_. . .   )=.  = Library General Public License along with 24 -_. . .   )=.  = Library General Public License along with
25   --        :-=` this library; see the file COPYING.LIB. 25   --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include "oprocctrl.h" 31#include "oprocctrl.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <oprocess.h> 34#include <oprocess.h>
35 35
36/* QT */ 36/* QT */
37 37
38#include <qapplication.h> 38#include <qapplication.h>
39#include <qdir.h> 39#include <qdir.h>
40#include <qmap.h> 40#include <qmap.h>
41#include <qregexp.h>
41#include <qsocketnotifier.h> 42#include <qsocketnotifier.h>
42#include <qtextstream.h> 43#include <qtextstream.h>
43 44
44/* STD */ 45/* STD */
45#include <errno.h> 46#include <errno.h>
46#include <fcntl.h> 47#include <fcntl.h>
47#include <pwd.h> 48#include <pwd.h>
48#include <stdlib.h> 49#include <stdlib.h>
49#include <signal.h> 50#include <signal.h>
50#include <stdio.h> 51#include <stdio.h>
51#include <string.h> 52#include <string.h>
52#include <sys/time.h> 53#include <sys/time.h>
53#include <sys/types.h> 54#include <sys/types.h>
54#include <sys/stat.h> 55#include <sys/stat.h>
55#include <sys/socket.h> 56#include <sys/socket.h>
56#include <unistd.h> 57#include <unistd.h>
57#ifdef HAVE_SYS_SELECT_H 58#ifdef HAVE_SYS_SELECT_H
58#include <sys/select.h> 59#include <sys/select.h>
59#endif 60#endif
60#ifdef HAVE_INITGROUPS 61#ifdef HAVE_INITGROUPS
61#include <grp.h> 62#include <grp.h>
62#endif 63#endif
63 64
64using namespace Opie::Core::Internal; 65using namespace Opie::Core::Internal;
65 66
66namespace Opie { 67namespace Opie {
67namespace Core { 68namespace Core {
68namespace Internal { 69namespace Internal {
69class OProcessPrivate 70class OProcessPrivate
70{ 71{
71public: 72public:
72 OProcessPrivate() : useShell( false ) 73 OProcessPrivate() : useShell( false )
73 { } 74 { }
74 75
75 bool useShell; 76 bool useShell;
76 QMap<QString, QString> env; 77 QMap<QString, QString> env;
77 QString wd; 78 QString wd;
78 QCString shell; 79 QCString shell;
79}; 80};
80} 81}
81 82
82OProcess::OProcess( QObject *parent, const char *name ) 83OProcess::OProcess( QObject *parent, const char *name )
83 : QObject( parent, name ) 84 : QObject( parent, name )
84{ 85{
85 init ( ); 86 init ( );
86} 87}
87 88
88OProcess::OProcess( const QString &arg0, QObject *parent, const char *name ) 89OProcess::OProcess( const QString &arg0, QObject *parent, const char *name )
89 : QObject( parent, name ) 90 : QObject( parent, name )
90{ 91{
91 init ( ); 92 init ( );
92 *this << arg0; 93 *this << arg0;
93} 94}
94 95
95OProcess::OProcess( const QStringList &args, QObject *parent, const char *name ) 96OProcess::OProcess( const QStringList &args, QObject *parent, const char *name )
96 : QObject( parent, name ) 97 : QObject( parent, name )
97{ 98{
98 init ( ); 99 init ( );
99 *this << args; 100 *this << args;
100} 101}
101 102
102void OProcess::init ( ) 103void OProcess::init ( )
103{ 104{
104 run_mode = NotifyOnExit; 105 run_mode = NotifyOnExit;
105 runs = false; 106 runs = false;
106 pid_ = 0; 107 pid_ = 0;
107 status = 0; 108 status = 0;
108 keepPrivs = false; 109 keepPrivs = false;
109 innot = 0; 110 innot = 0;
110 outnot = 0; 111 outnot = 0;
111 errnot = 0; 112 errnot = 0;
112 communication = NoCommunication; 113 communication = NoCommunication;
113 input_data = 0; 114 input_data = 0;
114 input_sent = 0; 115 input_sent = 0;
115 input_total = 0; 116 input_total = 0;
116 d = 0; 117 d = 0;
117 118
118 if ( 0 == OProcessController::theOProcessController ) 119 if ( 0 == OProcessController::theOProcessController )
119 { 120 {
120 ( void ) new OProcessController(); 121 ( void ) new OProcessController();
121 CHECK_PTR( OProcessController::theOProcessController ); 122 CHECK_PTR( OProcessController::theOProcessController );
122 } 123 }
123 124
124 OProcessController::theOProcessController->addOProcess( this ); 125 OProcessController::theOProcessController->addOProcess( this );
125 out[ 0 ] = out[ 1 ] = -1; 126 out[ 0 ] = out[ 1 ] = -1;
126 in[ 0 ] = in[ 1 ] = -1; 127 in[ 0 ] = in[ 1 ] = -1;
127 err[ 0 ] = err[ 1 ] = -1; 128 err[ 0 ] = err[ 1 ] = -1;
128} 129}
129 130
130void OProcess::setEnvironment( const QString &name, const QString &value ) 131void OProcess::setEnvironment( const QString &name, const QString &value )
131{ 132{
132 if ( !d ) 133 if ( !d )
133 d = new OProcessPrivate; 134 d = new OProcessPrivate;
134 d->env.insert( name, value ); 135 d->env.insert( name, value );
135} 136}
136 137