summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oprocess.h
Side-by-side diff
Diffstat (limited to 'libopie2/opiecore/oprocess.h') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiecore/oprocess.h80
1 files changed, 40 insertions, 40 deletions
diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h
index 8dd19b5..352485b 100644
--- a/libopie2/opiecore/oprocess.h
+++ b/libopie2/opiecore/oprocess.h
@@ -1,51 +1,55 @@
-/* This file is part of the KDE libraries
- Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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,
+/*
+                This file is part of the Opie Project
+             Copyright (C) 2003-2004 Holger Freyther <zecke@handhelds.org>
+ Copyright (C) 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.
*/
-//
-// KPROCESS -- A class for handling child processes in KDE without
-// having to take care of Un*x specific implementation details
-//
-// version 0.3.1, Jan 8th 1998
-//
-// (C) Christian Czezatke
-// e9025461@student.tuwien.ac.at
-// Ported by Holger Freyther to the Open Palmtop Integrated Environment
-//
-#ifndef __kprocess_h__
-#define __kprocess_h__
+#ifndef OPROCESS_H
+#define OPROCESS_H
+
+/* QT */
+#include <qcstring.h>
+#include <qobject.h>
+#include <qvaluelist.h>
+/* STD */
#include <sys/types.h> // for pid_t
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
-#include <qvaluelist.h>
-#include <qcstring.h>
-#include <qobject.h>
class QSocketNotifier;
class OProcessPrivate;
/**
* Child process invocation, monitoring and control.
*
* @sect General usage and features
*
*This class allows a KDE and OPIE application to start child processes without having
*to worry about UN*X signal handling issues and zombie process reaping.
*
@@ -132,25 +136,25 @@ class OProcessPrivate;
*
*@li void @ref receivedStdout(OProcess *proc, char *buffer, int buflen);
*@li void @ref receivedStderr(OProcess *proc, char *buffer, int buflen);
*@li -- Indicates that new data has arrived from either the
*child process's stdout or stderr.
*
*@li void @ref wroteStdin(OProcess *proc);
*@li -- Indicates that all data that has been sent to the child process
*by a prior call to @ref writeStdin() has actually been transmitted to the
*client .
*
*@author Christian Czezakte e9025461@student.tuwien.ac.at
- *
+ *@author Holger Freyther (Opie Port)
*
**/
class OProcess : public QObject
{
Q_OBJECT
public:
/**
* Modes in which the communication channel can be opened.
*
* If communication for more than one channel is required,
@@ -386,25 +390,28 @@ public:
* This causes the stderr file descriptor of the child process to be
* closed.
*
* @return @p false if no communication to the process's stderr
* had been specified in the call to @ref start().
*/
bool closeStderr();
/**
* Lets you see what your arguments are for debugging.
*/
- const QValueList<QCString> &args() { return arguments; }
+ const QValueList<QCString> &args()
+ {
+ return arguments;
+ }
/**
* Controls whether the started process should drop any
* setuid/segid privileges or whether it should keep them
*
* The default is @p false : drop privileges
*/
void setRunPrivileged(bool keepPrivileges);
/**
* Returns whether the started process will drop any
* setuid/segid privileges or whether it will keep them
@@ -445,26 +452,24 @@ public:
*/
static QString quote(const QString &arg);
/**
* Detaches OProcess from child process. All communication is closed.
* No exit notification is emitted any more for the child process.
* Deleting the OProcess will no longer kill the child process.
* Note that the current process remains the parent process of the
* child process.
*/
void detach();
-
-
signals:
/**
* Emitted after the process has terminated when
* the process was run in the @p NotifyOnExit (==default option to
* @ref start()) or the @ref Block mode.
**/
void processExited(OProcess *proc);
/**
* Emitted, when output from the child process has
@@ -513,25 +518,24 @@ signals:
* You should copy the information contained in @p buffer to your private
* data structures before returning from this slot.
*/
void receivedStderr(OProcess *proc, char *buffer, int buflen);
/**
* Emitted after all the data that has been
* specified by a prior call to @ref writeStdin() has actually been
* written to the child process.
**/
void wroteStdin(OProcess *proc);
-
protected slots:
/**
* This slot gets activated when data from the child's stdout arrives.
* It usually calls "childOutput"
*/
void slotChildOutput(int fdno);
/**
* This slot gets activated when data from the child's stderr arrives.
* It usually calls "childError"
*/
@@ -700,25 +704,24 @@ protected:
// information about the data that has to be sent to the child:
const char *input_data; // the buffer holding the data
int input_sent; // # of bytes already transmitted
int input_total; // total length of input_data
/**
* @ref OProcessController is a friend of OProcess because it has to have
* access to various data members.
*/
friend class OProcessController;
-
private:
/**
* Searches for a valid shell.
* Here is the algorithm used for finding an executable shell:
*
* @li Try the executable pointed to by the "SHELL" environment
* variable with white spaces stripped off
*
* @li If your process runs with uid != euid or gid != egid, a shell
* not listed in /etc/shells will not used.
*
* @li If no valid shell could be found, "/bin/sh" is used as a last resort.
@@ -728,20 +731,17 @@ private:
/**
* Used by @ref searchShell in order to find out whether the shell found
* is actually executable at all.
*/
bool isExecutable(const QCString &filename);
// Disallow assignment and copy-construction
OProcess( const OProcess& );
OProcess& operator= ( const OProcess& );
private:
void init ( );
-
OProcessPrivate *d;
};
-
-
#endif