summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui
authormickeyl <mickeyl>2004-01-05 23:37:19 (UTC)
committer mickeyl <mickeyl>2004-01-05 23:37:19 (UTC)
commit4b272b07b86e4dce14ab71054a3741fa9ad33572 (patch) (side-by-side diff)
tree381bf51d8e3258cbd15d36815b13dcfcac33845c /noncore/net/wellenreiter/gui
parentfa6a2e24a70be69724387355970814c0fb63701d (diff)
downloadopie-4b272b07b86e4dce14ab71054a3741fa9ad33572.zip
opie-4b272b07b86e4dce14ab71054a3741fa9ad33572.tar.gz
opie-4b272b07b86e4dce14ab71054a3741fa9ad33572.tar.bz2
add -nocheck command line option
Diffstat (limited to 'noncore/net/wellenreiter/gui') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index 55a5260..dd757b5 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -49,13 +49,27 @@ int main( int argc, char **argv )
w->setCaption( "Wellenreiter II" );
w->show();
#endif
a.processEvents(); // show the window before doing the safety checks
int result = -1;
+ static int killed = false;
+ bool check = true;
+ for ( int i = 1; i < argc; ++i )
+ {
+ if ( !strcmp( "-nocheck", argv[i] ) )
+ {
+ qDebug( "-nocheck found" );
+ check = false;
+ break;
+ }
+ }
+
+ if ( check )
+ {
// root check
if ( getuid() )
{
qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) );
result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n"
"as non-root. You will have\nonly limited functionality.\nProceed anyway?" ),
@@ -63,14 +77,12 @@ int main( int argc, char **argv )
if ( result == QMessageBox::No ) return -1;
}
// dhcp check - NOT HERE! This really belongs as a static member to OProcess
// and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ...
- static int killed = false;
-
QString line;
QDir d = QDir( "/proc" );
QStringList dirs = d.entryList( QDir::Dirs );
QStringList::Iterator it;
for ( it = dirs.begin(); it != dirs.end(); ++it )
{
@@ -94,21 +106,26 @@ int main( int argc, char **argv )
if ( -1 == ::kill( (*it).toInt(), SIGTERM ) )
qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) );
else
killed = true;
}
}
+ }
a.exec();
+ if ( check )
+ {
+
if ( killed )
{
result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No );
if ( result == QMessageBox::Yes )
{
system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) );
}
}
delete w;
+ }
return 0;
}