00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "konsole.h"
00023
00024 #ifdef QT_QWS_OPIE
00025
00026 #include <opie2/oapplicationfactory.h>
00027
00028
00029 using namespace Opie::Core;
00030 OPIE_EXPORT_APP( OApplicationFactory<Konsole> )
00031
00032 #else
00033
00034 #include <qpe/qpeapplication.h>
00035
00036 #include <qfile.h>
00037
00038 #include <unistd.h>
00039 #include <stdio.h>
00040 #include <stdlib.h>
00041
00042 #include <pwd.h>
00043 #include <sys/types.h>
00044
00045
00046
00047 int main(int argc, char* argv[]) {
00048 if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl;
00049 if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl;
00050
00051 QPEApplication a( argc, argv );
00052 #ifdef FAKE_CTRL_AND_ALT
00053 odebug << "Fake Ctrl and Alt defined" << oendl;
00054 QPEApplication::grabKeyboard();
00055 #endif
00056
00057 QStrList tmp;
00058 const char* shell = getenv("SHELL");
00059
00060 if (shell == NULL || *shell == '\0') {
00061 struct passwd *ent = 0;
00062 uid_t me = getuid();
00063 shell = "/bin/sh";
00064
00065 while ( (ent = getpwent()) != 0 ) {
00066 if (ent->pw_uid == me) {
00067 if (ent->pw_shell != "")
00068 shell = ent->pw_shell;
00069 break;
00070 }
00071 }
00072 endpwent();
00073 }
00074
00075 if( putenv((char*)"COLORTERM=") !=0)
00076 odebug << "putenv failed" << oendl;
00077
00078 Konsole m( "test", shell, tmp, TRUE );
00079 m.setCaption( Konsole::tr("Terminal") );
00080 a.showMainWidget( &m );
00081
00082 return a.exec();
00083 }
00084
00085 #endif