summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-04-07 08:00:32 (UTC)
committer llornkcor <llornkcor>2004-04-07 08:00:32 (UTC)
commiteb2e474c18382c50774b868a17dc3cfc8ec026ba (patch) (unidiff)
tree45e899436fabb58f263e7d7ab404f92078cd6e25
parent00dda4de55885bf3942fe3d4b6cd552ee6f020bf (diff)
downloadopie-eb2e474c18382c50774b868a17dc3cfc8ec026ba.zip
opie-eb2e474c18382c50774b868a17dc3cfc8ec026ba.tar.gz
opie-eb2e474c18382c50774b868a17dc3cfc8ec026ba.tar.bz2
non opie main
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/main.cpp57
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
@@ -1,30 +1,85 @@
1/* ---------------------------------------------------------------------- */ 1/* ---------------------------------------------------------------------- */
2/* */ 2/* */
3/* [main.C] Konsole */ 3/* [main.C] Konsole */
4/* */ 4/* */
5/* ---------------------------------------------------------------------- */ 5/* ---------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole, an X terminal. */ 9/* This file is part of Konsole, an X terminal. */
10/* */ 10/* */
11/* The material contained in here more or less directly orginates from */ 11/* The material contained in here more or less directly orginates from */
12/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ 12/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */
13/* */ 13/* */
14/* ---------------------------------------------------------------------- */ 14/* ---------------------------------------------------------------------- */
15/* */ 15/* */
16/* Ported Konsole to Qt/Embedded */ 16/* Ported Konsole to Qt/Embedded */
17/* */ 17/* */
18/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 18/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
19/* */ 19/* */
20/* -------------------------------------------------------------------------- */ 20/* -------------------------------------------------------------------------- */
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 |------------------------------------------------------ */
28using namespace Opie::Core; 29using namespace Opie::Core;
29OPIE_EXPORT_APP( OApplicationFactory<Konsole> ) 30OPIE_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