process.h
/* vi: ts=8 sts=4 sw=4
*
* $Id: process.h 802657 2008-04-30 08:22:54Z lunakl $
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
*
* This is free software; you can use this library under the GNU Library
* General Public License, version 2. See the file "COPYING.LIB" for the
* exact licensing terms.
*/
#ifndef __Process_h_Included__
#define __Process_h_Included__
#include <sys/types.h>
#include <qcstring.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qvaluelist.h>
#include <kdelibs_export.h>
class PTY;
typedef QValueList<QCString> QCStringList;
class KDESU_EXPORT PtyProcess
{
public:
PtyProcess();
virtual ~PtyProcess();
int exec(const QCString &command, const QCStringList &args);
QCString readLine(bool block=true);
QCString readAll(bool block=true);
void writeLine(const QCString &line, bool addNewline=true);
void unreadLine(const QCString &line, bool addNewline=true);
void setExitString(const QCString &exit) { m_Exit = exit; }
int waitForChild();
int WaitSlave();
int enableLocalEcho(bool enable=true);
void setTerminal(bool terminal) { m_bTerminal = terminal; }
void setErase(bool erase) { m_bErase = erase; }
void setEnvironment( const QCStringList &env );
int fd() {return m_Fd;}
int pid() {return m_Pid;}
public: /* static */
/*
** This is a collection of static functions that can be
** used for process control inside kdesu. I'd suggest
** against using this publicly. There are probably
** nicer Qt based ways to do what you want.
*/
static int waitMS(int fd,int ms);
static bool checkPid(pid_t pid);
enum checkPidStatus { Error=-1, NotExited=-2, Killed=-3 } ;
static int checkPidExited(pid_t pid);
protected:
const QCStringList& environment() const;
bool m_bErase, m_bTerminal;
int m_Pid, m_Fd;
QCString m_Command, m_Exit;
private:
int init();
int SetupTTY(int fd);
PTY *m_pPTY;
QCString m_Inbuf, m_TTY;
protected:
virtual void virtual_hook( int id, void* data );
private:
class PtyProcessPrivate;
PtyProcessPrivate *d;
};
#endif
PTY
PTY compatibility routines.
Definition: kdesu_pty.h:25
PtyProcess::pid
int pid()
Returns the pid of the process.
Definition: process.h:126
PtyProcess::setErase
void setErase(bool erase)
Overwrites the password as soon as it is used.
Definition: process.h:111
PtyProcess::setExitString
void setExitString(const QCString &exit)
Sets the exit string.
Definition: process.h:83
PtyProcess::setTerminal
void setTerminal(bool terminal)
Enables/disables terminal output.
Definition: process.h:105
PtyProcess::checkPidStatus
checkPidStatus
Check process exit status for process pid.
Definition: process.h:162
PtyProcess
Synchronous communication with tty programs.
Definition: process.h:36
PtyProcess::fd
int fd()
Returns the filedescriptor of the process.
Definition: process.h:121

KDE Home | KDE Accessibility Home | Description of Access Keys