Diffstat (limited to 'core/apps/embeddedkonsole/MyPty.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/MyPty.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/core/apps/embeddedkonsole/MyPty.h b/core/apps/embeddedkonsole/MyPty.h new file mode 100644 index 0000000..b2a5b58 --- a/dev/null +++ b/core/apps/embeddedkonsole/MyPty.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /* -------------------------------------------------------------------------- */ | ||
2 | /* */ | ||
3 | /* [MyPty.h] Pseudo Terminal Device */ | ||
4 | /* */ | ||
5 | /* -------------------------------------------------------------------------- */ | ||
6 | /* */ | ||
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | ||
8 | /* */ | ||
9 | /* This file is part of Konsole - an X terminal for KDE */ | ||
10 | /* */ | ||
11 | /* -------------------------------------------------------------------------- */ | ||
12 | /* */ | ||
13 | /* Ported Konsole to Qt/Embedded */ | ||
14 | /* */ | ||
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | ||
16 | /* */ | ||
17 | /* -------------------------------------------------------------------------- */ | ||
18 | |||
19 | /*! \file | ||
20 | */ | ||
21 | |||
22 | #ifndef MY_PTY_H | ||
23 | #define MY_PTY_H | ||
24 | |||
25 | #include <qobject.h> | ||
26 | #include <qstrlist.h> | ||
27 | |||
28 | |||
29 | class MyPty : public QObject | ||
30 | { | ||
31 | Q_OBJECT | ||
32 | |||
33 | public: | ||
34 | |||
35 | MyPty(); | ||
36 | ~MyPty(); | ||
37 | |||
38 | /*! | ||
39 | having a `run' separate from the constructor allows to make | ||
40 | the necessary connections to the signals and slots of the | ||
41 | instance before starting the execution of the client. | ||
42 | */ | ||
43 | int run(const char* pgm, QStrList & args, const char* term, int addutmp); | ||
44 | |||
45 | public slots: | ||
46 | |||
47 | void send_bytes(const char* s, int len); | ||
48 | void setSize(int lines, int columns); | ||
49 | void error(); | ||
50 | |||
51 | signals: | ||
52 | |||
53 | /*! | ||
54 | emitted when the client program terminates. | ||
55 | \param status the wait(2) status code of the terminated client program. | ||
56 | */ | ||
57 | void done(int status); | ||
58 | |||
59 | /*! | ||
60 | emitted when a new block of data comes in. | ||
61 | \param s - the data | ||
62 | \param len - the length of the block | ||
63 | */ | ||
64 | void block_in(const char* s, int len); | ||
65 | |||
66 | public: | ||
67 | |||
68 | void send_byte(char s); | ||
69 | // void send_string(const char* s); | ||
70 | |||
71 | const char* deviceName(); | ||
72 | |||
73 | protected slots: | ||
74 | void readPty(); | ||
75 | void donePty(); | ||
76 | |||
77 | private: | ||
78 | int openPty(); | ||
79 | |||
80 | private: | ||
81 | |||
82 | char ptynam[16]; // "/dev/ptyxx" | "/dev/ptmx" | ||
83 | char ttynam[16]; // "/dev/ttyxx" | "/dev/pts/########..." | ||
84 | int fd; | ||
85 | int cpid; | ||
86 | }; | ||
87 | |||
88 | #endif | ||