summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/main.cpp32
1 files changed, 4 insertions, 28 deletions
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp
index 702a7cc..d32b362 100644
--- a/noncore/net/wellenreiter/gui/main.cpp
+++ b/noncore/net/wellenreiter/gui/main.cpp
@@ -1,3 +1,3 @@
/**********************************************************************
-** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
+** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved.
**
@@ -18,2 +18,3 @@
#include <opie2/oapplication.h>
+#include <opie2/oprocess.h>
#else
@@ -25,8 +26,2 @@
-// ==> OProcess
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
-#include <qtextstream.h>
-
#include <errno.h>
@@ -79,23 +74,4 @@ int main( int argc, char **argv )
- // 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& ) ) ...
-
- QString line;
- QDir d = QDir( "/proc" );
- QStringList dirs = d.entryList( QDir::Dirs );
- QStringList::Iterator it;
- for ( it = dirs.begin(); it != dirs.end(); ++it )
- {
- //qDebug( "next entry: %s", (const char*) *it );
- QFile file( "/proc/"+*it+"/cmdline" );
- file.open( IO_ReadOnly );
- if ( !file.isOpen() ) continue;
- QTextStream t( &file );
- line = t.readLine();
- //qDebug( "cmdline = %s", (const char*) line );
- if ( line.contains( "dhcp" ) ) break;
- }
- if ( line.contains( "dhcp" ) )
+ if ( OProcess::processPID( "dhcpc" ) )
{
- qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() );
result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n"
@@ -105,3 +81,3 @@ int main( int argc, char **argv )
{
- if ( -1 == ::kill( (*it).toInt(), SIGTERM ) )
+ if ( -1 == ::kill( OProcess::processPID( "dhcpc" ), SIGTERM ) )
qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) );