author | mickeyl <mickeyl> | 2004-01-13 20:03:55 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-13 20:03:55 (UTC) |
commit | a730fd614ed213ca590ae075ed99feec65522868 (patch) (unidiff) | |
tree | 072f5342fc43c4cd5acf9620a150bd9247469f91 /noncore/net/wellenreiter/gui/main.cpp | |
parent | e117e8427cd8bcd0ab1a74abdc5cd4ab12654194 (diff) | |
download | opie-a730fd614ed213ca590ae075ed99feec65522868.zip opie-a730fd614ed213ca590ae075ed99feec65522868.tar.gz opie-a730fd614ed213ca590ae075ed99feec65522868.tar.bz2 |
use OProcess::processPID()
Diffstat (limited to 'noncore/net/wellenreiter/gui/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/main.cpp | 32 |
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 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002-2004 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
@@ -18,2 +18,3 @@ | |||
18 | #include <opie2/oapplication.h> | 18 | #include <opie2/oapplication.h> |
19 | #include <opie2/oprocess.h> | ||
19 | #else | 20 | #else |
@@ -25,8 +26,2 @@ | |||
25 | 26 | ||
26 | // ==> OProcess | ||
27 | #include <qdir.h> | ||
28 | #include <qfileinfo.h> | ||
29 | #include <qregexp.h> | ||
30 | #include <qtextstream.h> | ||
31 | |||
32 | #include <errno.h> | 27 | #include <errno.h> |
@@ -79,23 +74,4 @@ int main( int argc, char **argv ) | |||
79 | 74 | ||
80 | // dhcp check - NOT HERE! This really belongs as a static member to OProcess | 75 | if ( OProcess::processPID( "dhcpc" ) ) |
81 | // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... | ||
82 | |||
83 | QString line; | ||
84 | QDir d = QDir( "/proc" ); | ||
85 | QStringList dirs = d.entryList( QDir::Dirs ); | ||
86 | QStringList::Iterator it; | ||
87 | for ( it = dirs.begin(); it != dirs.end(); ++it ) | ||
88 | { | ||
89 | //qDebug( "next entry: %s", (const char*) *it ); | ||
90 | QFile file( "/proc/"+*it+"/cmdline" ); | ||
91 | file.open( IO_ReadOnly ); | ||
92 | if ( !file.isOpen() ) continue; | ||
93 | QTextStream t( &file ); | ||
94 | line = t.readLine(); | ||
95 | //qDebug( "cmdline = %s", (const char*) line ); | ||
96 | if ( line.contains( "dhcp" ) ) break; | ||
97 | } | ||
98 | if ( line.contains( "dhcp" ) ) | ||
99 | { | 76 | { |
100 | qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); | ||
101 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" | 77 | 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 ) | |||
105 | { | 81 | { |
106 | if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) | 82 | if ( -1 == ::kill( OProcess::processPID( "dhcpc" ), SIGTERM ) ) |
107 | qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); | 83 | qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); |