author | llornkcor <llornkcor> | 2004-04-07 08:00:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-07 08:00:32 (UTC) |
commit | eb2e474c18382c50774b868a17dc3cfc8ec026ba (patch) (unidiff) | |
tree | 45e899436fabb58f263e7d7ab404f92078cd6e25 /core/apps/embeddedkonsole/main.cpp | |
parent | 00dda4de55885bf3942fe3d4b6cd552ee6f020bf (diff) | |
download | opie-eb2e474c18382c50774b868a17dc3cfc8ec026ba.zip opie-eb2e474c18382c50774b868a17dc3cfc8ec026ba.tar.gz opie-eb2e474c18382c50774b868a17dc3cfc8ec026ba.tar.bz2 |
non opie main
Diffstat (limited to 'core/apps/embeddedkonsole/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/main.cpp | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/main.cpp b/core/apps/embeddedkonsole/main.cpp index b456ce2..b851d3e 100644 --- a/core/apps/embeddedkonsole/main.cpp +++ b/core/apps/embeddedkonsole/main.cpp | |||
@@ -21,10 +21,65 @@ | |||
21 | 21 | ||
22 | #include "konsole.h" | 22 | #include "konsole.h" |
23 | 23 | ||
24 | #include <opie2/oapplicationfactory.h> | 24 | #ifdef QT_QWS_OPIE |
25 | 25 | ||
26 | #include <opie2/oapplicationfactory.h> | ||
26 | 27 | ||
27 | /* --| main |------------------------------------------------------ */ | 28 | /* --| main |------------------------------------------------------ */ |
28 | using namespace Opie::Core; | 29 | using namespace Opie::Core; |
29 | OPIE_EXPORT_APP( OApplicationFactory<Konsole> ) | 30 | OPIE_EXPORT_APP( OApplicationFactory<Konsole> ) |
30 | 31 | ||
32 | #else //for non opie builds | ||
33 | |||
34 | #include <qpe/qpeapplication.h> | ||
35 | |||
36 | #include <qfile.h> | ||
37 | |||
38 | #include <unistd.h> | ||
39 | #include <stdio.h> | ||
40 | #include <stdlib.h> | ||
41 | |||
42 | #include <pwd.h> | ||
43 | #include <sys/types.h> | ||
44 | |||
45 | |||
46 | /* --| main |------------------------------------------------------ */ | ||
47 | int main(int argc, char* argv[]) { | ||
48 | if(setuid(getuid()) !=0) qDebug("setuid failed"); | ||
49 | if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges | ||
50 | |||
51 | QPEApplication a( argc, argv ); | ||
52 | #ifdef FAKE_CTRL_AND_ALT | ||
53 | qDebug("Fake Ctrl and Alt defined"); | ||
54 | QPEApplication::grabKeyboard(); // for CTRL and ALT | ||
55 | #endif | ||
56 | |||
57 | QStrList tmp; | ||
58 | const char* shell = getenv("SHELL"); | ||
59 | |||
60 | if (shell == NULL || *shell == '\0') { | ||
61 | struct passwd *ent = 0; | ||
62 | uid_t me = getuid(); | ||
63 | shell = "/bin/sh"; | ||
64 | |||
65 | while ( (ent = getpwent()) != 0 ) { | ||
66 | if (ent->pw_uid == me) { | ||
67 | if (ent->pw_shell != "") | ||
68 | shell = ent->pw_shell; | ||
69 | break; | ||
70 | } | ||
71 | } | ||
72 | endpwent(); | ||
73 | } | ||
74 | |||
75 | if( putenv((char*)"COLORTERM=") !=0) | ||
76 | qDebug("putenv failed"); // to trigger mc's color detection | ||
77 | |||
78 | Konsole m( "test", shell, tmp, TRUE ); | ||
79 | m.setCaption( Konsole::tr("Terminal") ); | ||
80 | a.showMainWidget( &m ); | ||
81 | |||
82 | return a.exec(); | ||
83 | } | ||
84 | |||
85 | #endif | ||