• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDEsu

process.h

Go to the documentation of this file.
00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * $Id: process.h 802657 2008-04-30 08:22:54Z lunakl $
00004  *
00005  * This file is part of the KDE project, module kdesu.
00006  * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
00007  * 
00008  * This is free software; you can use this library under the GNU Library 
00009  * General Public License, version 2. See the file "COPYING.LIB" for the 
00010  * exact licensing terms.
00011  */
00012 
00013 #ifndef __Process_h_Included__
00014 #define __Process_h_Included__
00015 
00016 #include <sys/types.h>
00017 
00018 #include <qcstring.h>
00019 #include <qstring.h>
00020 #include <qstringlist.h>
00021 #include <qvaluelist.h>
00022 
00023 #include <kdelibs_export.h>
00024 
00025 class PTY;
00026 typedef QValueList<QCString> QCStringList;
00027 
00036 class KDESU_EXPORT PtyProcess
00037 {
00038 public:
00039     PtyProcess();
00040     virtual ~PtyProcess();
00041 
00049     int exec(const QCString &command, const QCStringList &args);
00050 
00057     QCString readLine(bool block=true);
00063     QCString readAll(bool block=true);
00064 
00070     void writeLine(const QCString &line, bool addNewline=true);
00071 
00077     void unreadLine(const QCString &line, bool addNewline=true);
00078 
00083     void setExitString(const QCString &exit) { m_Exit = exit; }
00084 
00088     int waitForChild();
00089 
00095     int WaitSlave();
00096 
00100     int enableLocalEcho(bool enable=true);
00101 
00105     void setTerminal(bool terminal) { m_bTerminal = terminal; }
00106 
00111     void setErase(bool erase) { m_bErase = erase; }
00112 
00116     void setEnvironment( const QCStringList &env );
00117 
00121     int fd() {return m_Fd;}
00122 
00126     int pid() {return m_Pid;}
00127 
00128 public: /* static */
00129     /*
00130     ** This is a collection of static functions that can be
00131     ** used for process control inside kdesu. I'd suggest 
00132     ** against using this publicly. There are probably 
00133     ** nicer Qt based ways to do what you want.
00134     */
00135 
00145     static int waitMS(int fd,int ms);
00146 
00147 
00153     static bool checkPid(pid_t pid);
00154 
00162     enum checkPidStatus { Error=-1, NotExited=-2, Killed=-3 } ;
00163     static int checkPidExited(pid_t pid);
00164 
00165 
00166 protected:
00167     const QCStringList& environment() const;
00168 
00169     bool m_bErase, m_bTerminal;
00170     int m_Pid, m_Fd;
00171     QCString m_Command, m_Exit;
00172 
00173 private:
00174     int init();
00175     int SetupTTY(int fd);
00176 
00177     PTY *m_pPTY;
00178     QCString m_Inbuf, m_TTY;
00179 
00180 protected:
00181     virtual void virtual_hook( int id, void* data );
00182 private:
00183     class PtyProcessPrivate;
00184     PtyProcessPrivate *d;
00185 };
00186 
00187 
00188 #endif

KDEsu

Skip menu "KDEsu"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal