summaryrefslogtreecommitdiff
authorclem <clem>2004-09-16 22:30:54 (UTC)
committer clem <clem>2004-09-16 22:30:54 (UTC)
commitba8276a03172cfdb41aac4b0cd53307dfdd2b8f1 (patch) (unidiff)
treec1a6f6712064942b773bbc0b11cc474955a96a74
parent85ebe50b5cfa9244c1610aac5d72de8a4cc263b6 (diff)
downloadopie-ba8276a03172cfdb41aac4b0cd53307dfdd2b8f1.zip
opie-ba8276a03172cfdb41aac4b0cd53307dfdd2b8f1.tar.gz
opie-ba8276a03172cfdb41aac4b0cd53307dfdd2b8f1.tar.bz2
define ARPHRD_IEEE80211 if <net/if_arp.h> doesn't (i.e. if our crosscompiler's version is 2.95 and not 3.3)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/system.cpp b/noncore/settings/networksettings2/networksettings2/system.cpp
index 271e73d..298bdc9 100644
--- a/noncore/settings/networksettings2/networksettings2/system.cpp
+++ b/noncore/settings/networksettings2/networksettings2/system.cpp
@@ -1,75 +1,79 @@
1#include <sys/types.h> 1#include <sys/types.h>
2#include <sys/wait.h> 2#include <sys/wait.h>
3 3
4#include <net/if.h> 4#include <net/if.h>
5#include <net/if_arp.h> 5#include <net/if_arp.h>
6#include <netinet/in.h> 6#include <netinet/in.h>
7#include <arpa/inet.h> 7#include <arpa/inet.h>
8#include <sys/ioctl.h> 8#include <sys/ioctl.h>
9#include <sys/socket.h> 9#include <sys/socket.h>
10#include <stdlib.h> 10#include <stdlib.h>
11#include <stdio.h> 11#include <stdio.h>
12#include <fcntl.h> 12#include <fcntl.h>
13#include <errno.h> 13#include <errno.h>
14#include <unistd.h> 14#include <unistd.h>
15 15
16#include <qdir.h> 16#include <qdir.h>
17#include <qregexp.h> 17#include <qregexp.h>
18#include <qstringlist.h> 18#include <qstringlist.h>
19#include <qfile.h> 19#include <qfile.h>
20#include <qtextstream.h> 20#include <qtextstream.h>
21#include <qapplication.h> 21#include <qapplication.h>
22 22
23#include "resources.h" 23#include "resources.h"
24#include "system.h" 24#include "system.h"
25 25
26#define PROCNETDEV "/proc/net/dev" 26#define PROCNETDEV "/proc/net/dev"
27 27
28#ifndef ARPHRD_IEEE80211
29#define ARPHRD_IEEE80211 801
30#endif
31
28static char Dig2Hex[] = { 32static char Dig2Hex[] = {
29 '0', '1', '2', '3', 33 '0', '1', '2', '3',
30 '4', '5', '6', '7', 34 '4', '5', '6', '7',
31 '8', '9', 'A', 'B', 35 '8', '9', 'A', 'B',
32 'C', 'D', 'E', 'F' 36 'C', 'D', 'E', 'F'
33}; 37};
34 38
35// get HIGH nibble of byte 39// get HIGH nibble of byte
36#define HN(x) Dig2Hex[(((x)&0xf0)>>4)] 40#define HN(x) Dig2Hex[(((x)&0xf0)>>4)]
37// get LOW nibble of byte 41// get LOW nibble of byte
38#define LN(x) Dig2Hex[((x)&0x0f)] 42#define LN(x) Dig2Hex[((x)&0x0f)]
39 43
40System::System( void ) : QObject(), ProbedInterfaces() { 44System::System( void ) : QObject(), ProbedInterfaces() {
41 probeInterfaces(); 45 probeInterfaces();
42} 46}
43 47
44System::~System( void ) { 48System::~System( void ) {
45 if( ProcDevNet ) 49 if( ProcDevNet )
46 delete ProcDevNet; 50 delete ProcDevNet;
47} 51}
48 52
49int System::runAsRoot( const QString & S ) { 53int System::runAsRoot( const QString & S ) {
50 QString MyS = S; 54 QString MyS = S;
51 char * usr = getenv("USER"); 55 char * usr = getenv("USER");
52 char ch; 56 char ch;
53 57
54 if( S.isEmpty() ) { 58 if( S.isEmpty() ) {
55 // loophole to start shell 59 // loophole to start shell
56 return 8888; 60 return 8888;
57 } 61 }
58 if( usr == 0 || strcmp( usr, "root" ) ) { 62 if( usr == 0 || strcmp( usr, "root" ) ) {
59 // unknown or non-root user -> use SUDO 63 // unknown or non-root user -> use SUDO
60 MyS.prepend( "sudo " ); 64 MyS.prepend( "sudo " );
61 } 65 }
62 66
63 Log(("Executing %s\n", MyS.latin1() )); 67 Log(("Executing %s\n", MyS.latin1() ));
64 68
65 emit lineFromCommand( tr("Command : ") + MyS ); 69 emit lineFromCommand( tr("Command : ") + MyS );
66 emit lineFromCommand( "---------------" ); 70 emit lineFromCommand( "---------------" );
67 Log(( "Command : %s\n", MyS.latin1() ) ); 71 Log(( "Command : %s\n", MyS.latin1() ) );
68 MyS += " 2>&1 "; 72 MyS += " 2>&1 ";
69 OutputOfCmd = popen( MyS.latin1(), "r" ) ; 73 OutputOfCmd = popen( MyS.latin1(), "r" ) ;
70 if( ! OutputOfCmd ) { 74 if( ! OutputOfCmd ) {
71 // cannot fork 75 // cannot fork
72 return 1; 76 return 1;
73 } 77 }
74 78
75 // read all data 79 // read all data