summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/main.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index 6bbc39b..62db967 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -11,30 +11,33 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "mainwindow.h" 16#include "mainwindow.h"
17
17#ifdef QWS 18#ifdef QWS
19#include <opie2/odebug.h>
18#include <opie2/oapplication.h> 20#include <opie2/oapplication.h>
19#include <opie2/oprocess.h> 21#include <opie2/oprocess.h>
20#else 22#else
21#include <qapplication.h> 23#include <qapplication.h>
22#endif 24#endif
23 25
26/* QT */
24#include <qmessagebox.h> 27#include <qmessagebox.h>
25#include <qstringlist.h> 28#include <qstringlist.h>
26 29
30/* STD */
27#include <errno.h> 31#include <errno.h>
28#include <signal.h> 32#include <signal.h>
29#include <string.h> 33#include <string.h>
30#include <unistd.h> 34#include <unistd.h>
31 35
32using namespace Opie::Core; 36using namespace Opie::Core;
33using namespace Opie::Core; 37
34using namespace Opie::Core;
35int main( int argc, char **argv ) 38int main( int argc, char **argv )
36{ 39{
37 #ifdef QWS 40 #ifdef QWS
38 OApplication a( argc, argv, "Wellenreiter II" ); 41 OApplication a( argc, argv, "Wellenreiter II" );
39 #else 42 #else
40 QApplication a( argc, argv ); 43 QApplication a( argc, argv );
@@ -52,27 +55,27 @@ int main( int argc, char **argv )
52 int result = -1; 55 int result = -1;
53 static int killed = false; 56 static int killed = false;
54 57
55 bool check = true; 58 bool check = true;
56 for ( int i = 1; i < argc; ++i ) 59 for ( int i = 1; i < argc; ++i )
57 { 60 {
58 qDebug( "Wellenreiter::main() parsing argument %d = '%s'", i, argv[i] ); 61 odebug << "Wellenreiter::main() parsing argument " << i << " = '" << argv[i] << "'" << oendl;
59 if ( !strcmp( "-nocheck", argv[i] ) ) 62 if ( !strcmp( "-nocheck", argv[i] ) )
60 { 63 {
61 qDebug( "-nocheck found" ); 64 odebug << "-nocheck found" << oendl;
62 check = false; 65 check = false;
63 break; 66 break;
64 } 67 }
65 } 68 }
66 69
67 if ( check ) 70 if ( check )
68 { 71 {
69 // root check 72 // root check
70 if ( getuid() ) 73 if ( getuid() )
71 { 74 {
72 qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); 75 owarn << QObject::tr( "Wellenreiter: trying to run as non-root!" ) << oendl;
73 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" 76 result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n"
74 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), 77 "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ),
75 QMessageBox::Yes, QMessageBox::No ); 78 QMessageBox::Yes, QMessageBox::No );
76 if ( result == QMessageBox::No ) return -1; 79 if ( result == QMessageBox::No ) return -1;
77 } 80 }
78 81
@@ -83,13 +86,13 @@ int main( int argc, char **argv )
83 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" 86 result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
84 "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ), 87 "(PID = %1)\nThis can severly limit scanning!\nShould I kill it for you?" ).arg( dhcpid ),
85 QMessageBox::Yes, QMessageBox::No ); 88 QMessageBox::Yes, QMessageBox::No );
86 if ( result == QMessageBox::Yes ) 89 if ( result == QMessageBox::Yes )
87 { 90 {
88 if ( -1 == ::kill( dhcpid, SIGTERM ) ) 91 if ( -1 == ::kill( dhcpid, SIGTERM ) )
89 qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); 92 owarn << "Wellenreiter: can't kill process #" << result << " (" << strerror( errno ) << ")" << oendl;
90 else 93 else
91 killed = true; 94 killed = true;
92 } 95 }
93 } 96 }
94 } 97 }
95 98