Diffstat (limited to 'libopie2/opiecore/oprocess.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/oprocess.h | 152 |
1 files changed, 76 insertions, 76 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,41 +1,45 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* |
2 | Copyright (C) 1997 Christian Czezakte (e9025461@student.tuwien.ac.at) | 2 | This file is part of the Opie Project |
3 | 3 | Copyright (C) 2003-2004 Holger Freyther <zecke@handhelds.org> | |
4 | This library is free software; you can redistribute it and/or | 4 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | modify it under the terms of the GNU Library General Public | 5 | =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at) |
6 | License as published by the Free Software Foundation; either | 6 | .=l. |
7 | version 2 of the License, or (at your option) any later version. | 7 | .>+-= |
8 | 8 | _;:, .> :=|. This program is free software; you can | |
9 | This library is distributed in the hope that it will be useful, | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | Library General Public License for more details. | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | 13 | ._= =} : or (at your option) any later version. | |
14 | You should have received a copy of the GNU Library General Public License | 14 | .%`+i> _;_. |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | Boston, MA 02111-1307, USA. | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
18 | */ | 29 | */ |
19 | // | ||
20 | // KPROCESS -- A class for handling child processes in KDE without | ||
21 | // having to take care of Un*x specific implementation details | ||
22 | // | ||
23 | // version 0.3.1, Jan 8th 1998 | ||
24 | // | ||
25 | // (C) Christian Czezatke | ||
26 | // e9025461@student.tuwien.ac.at | ||
27 | // Ported by Holger Freyther to the Open Palmtop Integrated Environment | ||
28 | // | ||
29 | |||
30 | #ifndef __kprocess_h__ | ||
31 | #define __kprocess_h__ | ||
32 | 30 | ||
31 | #ifndef OPROCESS_H | ||
32 | #define OPROCESS_H | ||
33 | |||
34 | /* QT */ | ||
35 | #include <qcstring.h> | ||
36 | #include <qobject.h> | ||
37 | #include <qvaluelist.h> | ||
38 | |||
39 | /* STD */ | ||
33 | #include <sys/types.h> // for pid_t | 40 | #include <sys/types.h> // for pid_t |
34 | #include <sys/wait.h> | 41 | #include <sys/wait.h> |
35 | #include <signal.h> | 42 | #include <signal.h> |
36 | #include <unistd.h> | 43 | #include <unistd.h> |
37 | #include <qvaluelist.h> | ||
38 | #include <qcstring.h> | ||
39 | #include <qobject.h> | ||
40 | 44 | ||
41 | class QSocketNotifier; | 45 | class QSocketNotifier; |
@@ -142,5 +146,5 @@ class OProcessPrivate; | |||
142 | * | 146 | * |
143 | *@author Christian Czezakte e9025461@student.tuwien.ac.at | 147 | *@author Christian Czezakte e9025461@student.tuwien.ac.at |
144 | * | 148 | *@author Holger Freyther (Opie Port) |
145 | * | 149 | * |
146 | **/ | 150 | **/ |
@@ -188,13 +192,13 @@ public: | |||
188 | * Constructor | 192 | * Constructor |
189 | */ | 193 | */ |
190 | OProcess(QObject *parent = 0, const char *name = 0); | 194 | OProcess( QObject *parent = 0, const char *name = 0 ); |
191 | /** | 195 | /** |
192 | * Constructor | 196 | * Constructor |
193 | */ | 197 | */ |
194 | OProcess(const QString &arg0, QObject *parent = 0, const char *name = 0); | 198 | OProcess( const QString &arg0, QObject *parent = 0, const char *name = 0 ); |
195 | /** | 199 | /** |
196 | * Constructor | 200 | * Constructor |
197 | */ | 201 | */ |
198 | OProcess(const QStringList &args, QObject *parent = 0, const char *name = 0); | 202 | OProcess( const QStringList &args, QObject *parent = 0, const char *name = 0 ); |
199 | 203 | ||
200 | /** | 204 | /** |
@@ -221,5 +225,5 @@ public: | |||
221 | 225 | ||
222 | */ | 226 | */ |
223 | bool setExecutable(const QString& proc); | 227 | bool setExecutable( const QString& proc ); |
224 | 228 | ||
225 | 229 | ||
@@ -235,13 +239,13 @@ public: | |||
235 | * | 239 | * |
236 | **/ | 240 | **/ |
237 | OProcess &operator<<(const QString& arg); | 241 | OProcess &operator<<( const QString& arg ); |
238 | /** | 242 | /** |
239 | * Similar to previous method, takes a char *, supposed to be in locale 8 bit already. | 243 | * Similar to previous method, takes a char *, supposed to be in locale 8 bit already. |
240 | */ | 244 | */ |
241 | OProcess &operator<<(const char * arg); | 245 | OProcess &operator<<( const char * arg ); |
242 | /** | 246 | /** |
243 | * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already. | 247 | * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already. |
244 | */ | 248 | */ |
245 | OProcess &operator<<(const QCString & arg); | 249 | OProcess &operator<<( const QCString & arg ); |
246 | 250 | ||
247 | /** | 251 | /** |
@@ -249,5 +253,5 @@ public: | |||
249 | * in a single method call, or add a list of arguments. | 253 | * in a single method call, or add a list of arguments. |
250 | **/ | 254 | **/ |
251 | OProcess &operator<<(const QStringList& args); | 255 | OProcess &operator<<( const QStringList& args ); |
252 | 256 | ||
253 | /** | 257 | /** |
@@ -279,6 +283,6 @@ public: | |||
279 | * (see above for error conditions) | 283 | * (see above for error conditions) |
280 | **/ | 284 | **/ |
281 | virtual bool start(RunMode runmode = NotifyOnExit, | 285 | virtual bool start( RunMode runmode = NotifyOnExit, |
282 | Communication comm = NoCommunication); | 286 | Communication comm = NoCommunication ); |
283 | 287 | ||
284 | /** | 288 | /** |
@@ -288,5 +292,5 @@ public: | |||
288 | * @return @p true if the signal was delivered successfully. | 292 | * @return @p true if the signal was delivered successfully. |
289 | */ | 293 | */ |
290 | virtual bool kill(int signo = SIGTERM); | 294 | virtual bool kill( int signo = SIGTERM ); |
291 | 295 | ||
292 | /** | 296 | /** |
@@ -334,5 +338,5 @@ public: | |||
334 | * it does not have a valid exit status. | 338 | * it does not have a valid exit status. |
335 | */ | 339 | */ |
336 | int exitStatus() const; | 340 | int exitStatus() const; |
337 | 341 | ||
338 | 342 | ||
@@ -361,5 +365,5 @@ public: | |||
361 | * the child process is no longer alive... | 365 | * the child process is no longer alive... |
362 | **/ | 366 | **/ |
363 | bool writeStdin(const char *buffer, int buflen); | 367 | bool writeStdin( const char *buffer, int buflen ); |
364 | 368 | ||
365 | void flushStdin(); | 369 | void flushStdin(); |
@@ -396,5 +400,8 @@ public: | |||
396 | */ | 400 | */ |
397 | 401 | ||
398 | const QValueList<QCString> &args() { return arguments; } | 402 | const QValueList<QCString> &args() |
403 | { | ||
404 | return arguments; | ||
405 | } | ||
399 | 406 | ||
400 | /** | 407 | /** |
@@ -404,5 +411,5 @@ public: | |||
404 | * The default is @p false : drop privileges | 411 | * The default is @p false : drop privileges |
405 | */ | 412 | */ |
406 | void setRunPrivileged(bool keepPrivileges); | 413 | void setRunPrivileged( bool keepPrivileges ); |
407 | 414 | ||
408 | /** | 415 | /** |
@@ -416,5 +423,5 @@ public: | |||
416 | * This function must be called before starting the process. | 423 | * This function must be called before starting the process. |
417 | */ | 424 | */ |
418 | void setEnvironment(const QString &name, const QString &value); | 425 | void setEnvironment( const QString &name, const QString &value ); |
419 | 426 | ||
420 | /** | 427 | /** |
@@ -423,5 +430,5 @@ public: | |||
423 | * This function must be called before starting the process. | 430 | * This function must be called before starting the process. |
424 | */ | 431 | */ |
425 | void setWorkingDirectory(const QString &dir); | 432 | void setWorkingDirectory( const QString &dir ); |
426 | 433 | ||
427 | /** | 434 | /** |
@@ -436,5 +443,5 @@ public: | |||
436 | * @see quote() | 443 | * @see quote() |
437 | */ | 444 | */ |
438 | void setUseShell(bool useShell, const char *shell = 0); | 445 | void setUseShell( bool useShell, const char *shell = 0 ); |
439 | 446 | ||
440 | /** | 447 | /** |
@@ -444,5 +451,5 @@ public: | |||
444 | * It also prevents expansion of wild cards and environment variables. | 451 | * It also prevents expansion of wild cards and environment variables. |
445 | */ | 452 | */ |
446 | static QString quote(const QString &arg); | 453 | static QString quote( const QString &arg ); |
447 | 454 | ||
448 | /** | 455 | /** |
@@ -455,6 +462,4 @@ public: | |||
455 | void detach(); | 462 | void detach(); |
456 | 463 | ||
457 | |||
458 | |||
459 | signals: | 464 | signals: |
460 | 465 | ||
@@ -464,5 +469,5 @@ signals: | |||
464 | * @ref start()) or the @ref Block mode. | 469 | * @ref start()) or the @ref Block mode. |
465 | **/ | 470 | **/ |
466 | void processExited(OProcess *proc); | 471 | void processExited( OProcess *proc ); |
467 | 472 | ||
468 | 473 | ||
@@ -481,5 +486,5 @@ signals: | |||
481 | * data structures before returning from this slot. | 486 | * data structures before returning from this slot. |
482 | **/ | 487 | **/ |
483 | void receivedStdout(OProcess *proc, char *buffer, int buflen); | 488 | void receivedStdout( OProcess *proc, char *buffer, int buflen ); |
484 | 489 | ||
485 | /** | 490 | /** |
@@ -498,5 +503,5 @@ signals: | |||
498 | * The data still has to be read from file descriptor @p fd. | 503 | * The data still has to be read from file descriptor @p fd. |
499 | **/ | 504 | **/ |
500 | void receivedStdout(int fd, int &len); | 505 | void receivedStdout( int fd, int &len ); |
501 | 506 | ||
502 | 507 | ||
@@ -514,5 +519,5 @@ signals: | |||
514 | * data structures before returning from this slot. | 519 | * data structures before returning from this slot. |
515 | */ | 520 | */ |
516 | void receivedStderr(OProcess *proc, char *buffer, int buflen); | 521 | void receivedStderr( OProcess *proc, char *buffer, int buflen ); |
517 | 522 | ||
518 | /** | 523 | /** |
@@ -521,6 +526,5 @@ signals: | |||
521 | * written to the child process. | 526 | * written to the child process. |
522 | **/ | 527 | **/ |
523 | void wroteStdin(OProcess *proc); | 528 | void wroteStdin( OProcess *proc ); |
524 | |||
525 | 529 | ||
526 | protected slots: | 530 | protected slots: |
@@ -530,5 +534,5 @@ protected slots: | |||
530 | * It usually calls "childOutput" | 534 | * It usually calls "childOutput" |
531 | */ | 535 | */ |
532 | void slotChildOutput(int fdno); | 536 | void slotChildOutput( int fdno ); |
533 | 537 | ||
534 | /** | 538 | /** |
@@ -536,5 +540,5 @@ protected slots: | |||
536 | * It usually calls "childError" | 540 | * It usually calls "childError" |
537 | */ | 541 | */ |
538 | void slotChildError(int fdno); | 542 | void slotChildError( int fdno ); |
539 | /* | 543 | /* |
540 | Slot functions for capturing stdout and stderr of the child | 544 | Slot functions for capturing stdout and stderr of the child |
@@ -546,5 +550,5 @@ protected slots: | |||
546 | * available, this function must disable the QSocketNotifier "innot". | 550 | * available, this function must disable the QSocketNotifier "innot". |
547 | */ | 551 | */ |
548 | void slotSendData(int dummy); | 552 | void slotSendData( int dummy ); |
549 | 553 | ||
550 | protected: | 554 | protected: |
@@ -625,5 +629,5 @@ protected: | |||
625 | * network communication, for example. | 629 | * network communication, for example. |
626 | */ | 630 | */ |
627 | virtual int setupCommunication(Communication comm); | 631 | virtual int setupCommunication( Communication comm ); |
628 | 632 | ||
629 | /** | 633 | /** |
@@ -655,5 +659,5 @@ protected: | |||
655 | * not running in the "DontCare" mode). | 659 | * not running in the "DontCare" mode). |
656 | */ | 660 | */ |
657 | virtual void processHasExited(int state); | 661 | virtual void processHasExited( int state ); |
658 | 662 | ||
659 | /** | 663 | /** |
@@ -667,7 +671,7 @@ protected: | |||
667 | * the socket descriptors for stdin/stdout/stderr. | 671 | * the socket descriptors for stdin/stdout/stderr. |
668 | */ | 672 | */ |
669 | int out[2]; | 673 | int out[ 2 ]; |
670 | int in[2]; | 674 | int in[ 2 ]; |
671 | int err[2]; | 675 | int err[ 2 ]; |
672 | 676 | ||
673 | /** | 677 | /** |
@@ -689,5 +693,5 @@ protected: | |||
689 | * "@ref receivedStderr". | 693 | * "@ref receivedStderr". |
690 | */ | 694 | */ |
691 | int childOutput(int fdno); | 695 | int childOutput( int fdno ); |
692 | 696 | ||
693 | /** | 697 | /** |
@@ -696,5 +700,5 @@ protected: | |||
696 | * "@ref receivedStderr" | 700 | * "@ref receivedStderr" |
697 | */ | 701 | */ |
698 | int childError(int fdno); | 702 | int childError( int fdno ); |
699 | 703 | ||
700 | // information about the data that has to be sent to the child: | 704 | // information about the data that has to be sent to the child: |
@@ -710,5 +714,4 @@ protected: | |||
710 | friend class OProcessController; | 714 | friend class OProcessController; |
711 | 715 | ||
712 | |||
713 | private: | 716 | private: |
714 | /** | 717 | /** |
@@ -730,5 +733,5 @@ private: | |||
730 | * is actually executable at all. | 733 | * is actually executable at all. |
731 | */ | 734 | */ |
732 | bool isExecutable(const QCString &filename); | 735 | bool isExecutable( const QCString &filename ); |
733 | 736 | ||
734 | // Disallow assignment and copy-construction | 737 | // Disallow assignment and copy-construction |
@@ -738,10 +741,7 @@ private: | |||
738 | private: | 741 | private: |
739 | void init ( ); | 742 | void init ( ); |
740 | |||
741 | OProcessPrivate *d; | 743 | OProcessPrivate *d; |
742 | }; | 744 | }; |
743 | 745 | ||
744 | |||
745 | |||
746 | #endif | 746 | #endif |
747 | 747 | ||