+ // assume that the test doesn't work
+ int netDevice = NetDevice_Unknown;
+
+ // first time check for ifconfig location
+ if ( m_CanUseIfconfig == -1 ) // unknown
+ {
+ static const wxChar *const ifconfigLocations[] =
+ {
+ wxT("/sbin"), // Linux, FreeBSD, Darwin
+ wxT("/usr/sbin"), // SunOS, Solaris, AIX, HP-UX
+ wxT("/usr/etc"), // IRIX
+ wxT("/etc"), // AIX 5
+ };
+
+ for ( size_t n = 0; n < WXSIZEOF(ifconfigLocations); n++ )
+ {
+ wxString path(ifconfigLocations[n]);
+ path << wxT("/ifconfig");
+
+ if ( wxFileExists(path) )
+ {
+ m_IfconfigPath = path;
+ break;
+ }
+ }
+ }
+
+ if ( m_CanUseIfconfig != 0 ) // unknown or yes
+ {
+ wxLogNull ln; // suppress all error messages
+
+ wxASSERT_MSG( !m_IfconfigPath.empty(),
+ wxT("can't use ifconfig if it wasn't found") );
+
+ wxString tmpfile = wxFileName::CreateTempFileName( wxT("_wxdialuptest") );
+ wxString cmd = wxT("/bin/sh -c \'");
+ cmd << m_IfconfigPath;
+#if defined(__AIX__) || \
+ defined(__NETBSD__) || \
+ defined(__OSF__) || \
+ defined(__SOLARIS__) || defined (__SUNOS__)
+ // need to add -a flag
+ cmd << wxT(" -a");
+#elif defined(__LINUX__) || defined(__SGI__)
+ // nothing to be added to ifconfig
+#elif defined(__FREEBSD__) || defined(__DARWIN__) || defined(__QNX__)
+ // add -l flag
+ cmd << wxT(" -l");
+#elif defined(__HPUX__)
+ // VZ: a wild guess (but without it, ifconfig fails completely)
+ cmd << wxT(" ppp0");
+#else
+ #if defined(__GNUG__)
+ #warning "No ifconfig information for this OS."
+ #else
+ #pragma warning "No ifconfig information for this OS."
+ #endif
+
+ m_CanUseIfconfig = 0;
+ return -1;